]>
Commit | Line | Data |
---|---|---|
8f590d45 VK |
1 | /* |
2 | * arch/arm/mach-spear6xx/spear6xx.c | |
3 | * | |
4 | * SPEAr6XX machines common source file | |
5 | * | |
6 | * Copyright (C) 2009 ST Microelectronics | |
7 | * Rajeev Kumar<rajeev-dlh.kumar@st.com> | |
8 | * | |
9652e8bd SR |
9 | * Copyright 2012 Stefan Roese <sr@denx.de> |
10 | * | |
8f590d45 VK |
11 | * This file is licensed under the terms of the GNU General Public |
12 | * License version 2. This program is licensed "as is" without any | |
13 | * warranty of any kind, whether express or implied. | |
14 | */ | |
15 | ||
9652e8bd SR |
16 | #include <linux/of.h> |
17 | #include <linux/of_address.h> | |
18 | #include <linux/of_irq.h> | |
19 | #include <linux/of_platform.h> | |
8f590d45 | 20 | #include <asm/hardware/vic.h> |
8f590d45 | 21 | #include <asm/mach/arch.h> |
8f590d45 | 22 | #include <mach/generic.h> |
02aa06bc | 23 | #include <mach/hardware.h> |
8f590d45 VK |
24 | |
25 | /* Following will create static virtual/physical mappings */ | |
26 | static struct map_desc spear6xx_io_desc[] __initdata = { | |
27 | { | |
28 | .virtual = VA_SPEAR6XX_ICM1_UART0_BASE, | |
29 | .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE), | |
53821162 | 30 | .length = SZ_4K, |
8f590d45 VK |
31 | .type = MT_DEVICE |
32 | }, { | |
33 | .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE, | |
34 | .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE), | |
53821162 | 35 | .length = SZ_4K, |
8f590d45 VK |
36 | .type = MT_DEVICE |
37 | }, { | |
38 | .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE, | |
39 | .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE), | |
53821162 | 40 | .length = SZ_4K, |
8f590d45 VK |
41 | .type = MT_DEVICE |
42 | }, { | |
43 | .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE, | |
44 | .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE), | |
53821162 | 45 | .length = SZ_4K, |
8f590d45 VK |
46 | .type = MT_DEVICE |
47 | }, { | |
48 | .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE, | |
49 | .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE), | |
53821162 | 50 | .length = SZ_4K, |
8f590d45 VK |
51 | .type = MT_DEVICE |
52 | }, | |
53 | }; | |
54 | ||
55 | /* This will create static memory mapping for selected devices */ | |
56 | void __init spear6xx_map_io(void) | |
57 | { | |
58 | iotable_init(spear6xx_io_desc, ARRAY_SIZE(spear6xx_io_desc)); | |
8f590d45 | 59 | } |
5c881d9a SH |
60 | |
61 | static void __init spear6xx_timer_init(void) | |
62 | { | |
63 | char pclk_name[] = "pll3_48m_clk"; | |
64 | struct clk *gpt_clk, *pclk; | |
65 | ||
5df33a62 VK |
66 | spear6xx_clk_init(); |
67 | ||
5c881d9a SH |
68 | /* get the system timer clock */ |
69 | gpt_clk = clk_get_sys("gpt0", NULL); | |
70 | if (IS_ERR(gpt_clk)) { | |
71 | pr_err("%s:couldn't get clk for gpt\n", __func__); | |
72 | BUG(); | |
73 | } | |
74 | ||
75 | /* get the suitable parent clock for timer*/ | |
76 | pclk = clk_get(NULL, pclk_name); | |
77 | if (IS_ERR(pclk)) { | |
78 | pr_err("%s:couldn't get %s as parent for gpt\n", | |
79 | __func__, pclk_name); | |
80 | BUG(); | |
81 | } | |
82 | ||
83 | clk_set_parent(gpt_clk, pclk); | |
84 | clk_put(gpt_clk); | |
85 | clk_put(pclk); | |
86 | ||
87 | spear_setup_timer(); | |
88 | } | |
89 | ||
90 | struct sys_timer spear6xx_timer = { | |
91 | .init = spear6xx_timer_init, | |
92 | }; | |
9652e8bd SR |
93 | |
94 | static void __init spear600_dt_init(void) | |
95 | { | |
96 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | |
97 | } | |
98 | ||
99 | static const char *spear600_dt_board_compat[] = { | |
100 | "st,spear600", | |
101 | NULL | |
102 | }; | |
103 | ||
104 | static const struct of_device_id vic_of_match[] __initconst = { | |
105 | { .compatible = "arm,pl190-vic", .data = vic_of_init, }, | |
106 | { /* Sentinel */ } | |
107 | }; | |
108 | ||
109 | static void __init spear6xx_dt_init_irq(void) | |
110 | { | |
111 | of_irq_init(vic_of_match); | |
112 | } | |
113 | ||
114 | DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)") | |
115 | .map_io = spear6xx_map_io, | |
116 | .init_irq = spear6xx_dt_init_irq, | |
117 | .handle_irq = vic_handle_irq, | |
118 | .timer = &spear6xx_timer, | |
119 | .init_machine = spear600_dt_init, | |
120 | .restart = spear_restart, | |
121 | .dt_compat = spear600_dt_board_compat, | |
122 | MACHINE_END |