diff options
Diffstat (limited to 'arch/arm/mach-nomadik/cpu-8815.c')
-rw-r--r-- | arch/arm/mach-nomadik/cpu-8815.c | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c index 351404673f6c..7c8e3487f4eb 100644 --- a/arch/arm/mach-nomadik/cpu-8815.c +++ b/arch/arm/mach-nomadik/cpu-8815.c | |||
@@ -25,13 +25,19 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/irq.h> | 26 | #include <linux/irq.h> |
27 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
28 | #include <linux/irqchip/arm-vic.h> | 28 | #include <linux/irqchip.h> |
29 | #include <linux/platform_data/clk-nomadik.h> | 29 | #include <linux/platform_data/clk-nomadik.h> |
30 | #include <linux/platform_data/pinctrl-nomadik.h> | 30 | #include <linux/platform_data/pinctrl-nomadik.h> |
31 | #include <linux/platform_data/clocksource-nomadik-mtu.h> | ||
32 | #include <linux/of_irq.h> | ||
33 | #include <linux/of_address.h> | ||
34 | #include <linux/of_platform.h> | ||
31 | 35 | ||
32 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
33 | #include <mach/irqs.h> | 37 | #include <mach/irqs.h> |
38 | #include <asm/mach/arch.h> | ||
34 | #include <asm/mach/map.h> | 39 | #include <asm/mach/map.h> |
40 | #include <asm/mach/time.h> | ||
35 | 41 | ||
36 | #include <asm/cacheflush.h> | 42 | #include <asm/cacheflush.h> |
37 | #include <asm/hardware/cache-l2x0.h> | 43 | #include <asm/hardware/cache-l2x0.h> |
@@ -160,3 +166,73 @@ void cpu8815_restart(char mode, const char *cmd) | |||
160 | /* Write anything to Reset status register */ | 166 | /* Write anything to Reset status register */ |
161 | writel(1, src_rstsr); | 167 | writel(1, src_rstsr); |
162 | } | 168 | } |
169 | |||
170 | #ifdef CONFIG_OF | ||
171 | |||
172 | /* Initial value for SRC control register: all timers use MXTAL/8 source */ | ||
173 | #define SRC_CR_INIT_MASK 0x00007fff | ||
174 | #define SRC_CR_INIT_VAL 0x2aaa8000 | ||
175 | |||
176 | static void __init cpu8815_timer_init_of(void) | ||
177 | { | ||
178 | struct device_node *mtu; | ||
179 | void __iomem *base; | ||
180 | int irq; | ||
181 | u32 src_cr; | ||
182 | |||
183 | /* We need this to be up now */ | ||
184 | nomadik_clk_init(); | ||
185 | |||
186 | mtu = of_find_node_by_path("/mtu0"); | ||
187 | if (!mtu) | ||
188 | return; | ||
189 | base = of_iomap(mtu, 0); | ||
190 | if (WARN_ON(!base)) | ||
191 | return; | ||
192 | irq = irq_of_parse_and_map(mtu, 0); | ||
193 | |||
194 | pr_info("Remapped MTU @ %p, irq: %d\n", base, irq); | ||
195 | |||
196 | /* Configure timer sources in "system reset controller" ctrl reg */ | ||
197 | src_cr = readl(base); | ||
198 | src_cr &= SRC_CR_INIT_MASK; | ||
199 | src_cr |= SRC_CR_INIT_VAL; | ||
200 | writel(src_cr, base); | ||
201 | |||
202 | nmdk_timer_init(base, irq); | ||
203 | } | ||
204 | |||
205 | /* These are mostly to get the right device names for the clock lookups */ | ||
206 | static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { | ||
207 | OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART0_BASE, | ||
208 | "uart0", NULL), | ||
209 | OF_DEV_AUXDATA("arm,primecell", NOMADIK_UART1_BASE, | ||
210 | "uart1", NULL), | ||
211 | { /* sentinel */ }, | ||
212 | }; | ||
213 | |||
214 | static void __init cpu8815_init_of(void) | ||
215 | { | ||
216 | #ifdef CONFIG_CACHE_L2X0 | ||
217 | /* At full speed latency must be >=2, so 0x249 in low bits */ | ||
218 | l2x0_of_init(0x00730249, 0xfe000fff); | ||
219 | #endif | ||
220 | of_platform_populate(NULL, of_default_bus_match_table, | ||
221 | cpu8815_auxdata_lookup, NULL); | ||
222 | } | ||
223 | |||
224 | static const char * cpu8815_board_compat[] = { | ||
225 | "calaosystems,usb-s8815", | ||
226 | NULL, | ||
227 | }; | ||
228 | |||
229 | DT_MACHINE_START(NOMADIK_DT, "Nomadik STn8815") | ||
230 | .map_io = cpu8815_map_io, | ||
231 | .init_irq = irqchip_init, | ||
232 | .init_time = cpu8815_timer_init_of, | ||
233 | .init_machine = cpu8815_init_of, | ||
234 | .restart = cpu8815_restart, | ||
235 | .dt_compat = cpu8815_board_compat, | ||
236 | MACHINE_END | ||
237 | |||
238 | #endif | ||