diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2012-11-21 04:48:33 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-21 04:48:33 -0500 |
commit | 17d6b293e72547f75f5d9b680b75459cb8f2c9cf (patch) | |
tree | 54e794b046e0c7c1f819d49e9ff4499f9b6f19e5 /arch/arm/mach-at91 | |
parent | e59d969f441fb8e25b30125bdf201153adc5a7e3 (diff) | |
parent | ad8a15d99cf2c8ab8ac1ab28402c49ec2548358d (diff) |
Merge branch 'delivery/pinctrl-at91-3.8' of http://github.com/at91linux/linux-at91 into at91
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r-- | arch/arm/mach-at91/Kconfig | 9 | ||||
-rw-r--r-- | arch/arm/mach-at91/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91rm9200.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_time.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-at91/board-rm9200-dt.c | 57 | ||||
-rw-r--r-- | arch/arm/mach-at91/generic.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-at91/setup.c | 14 |
7 files changed, 161 insertions, 2 deletions
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 043624219b55..e34c1bdb804d 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig | |||
@@ -494,8 +494,17 @@ endif | |||
494 | 494 | ||
495 | comment "Generic Board Type" | 495 | comment "Generic Board Type" |
496 | 496 | ||
497 | config MACH_AT91RM9200_DT | ||
498 | bool "Atmel AT91RM9200 Evaluation Kits with device-tree support" | ||
499 | depends on SOC_AT91RM9200 | ||
500 | select USE_OF | ||
501 | help | ||
502 | Select this if you want to experiment device-tree with | ||
503 | an Atmel RM9200 Evaluation Kit. | ||
504 | |||
497 | config MACH_AT91SAM_DT | 505 | config MACH_AT91SAM_DT |
498 | bool "Atmel AT91SAM Evaluation Kits with device-tree support" | 506 | bool "Atmel AT91SAM Evaluation Kits with device-tree support" |
507 | depends on SOC_AT91SAM9 | ||
499 | select USE_OF | 508 | select USE_OF |
500 | help | 509 | help |
501 | Select this if you want to experiment device-tree with | 510 | Select this if you want to experiment device-tree with |
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile index 3bb7a51efc9d..b38a1dcb79b8 100644 --- a/arch/arm/mach-at91/Makefile +++ b/arch/arm/mach-at91/Makefile | |||
@@ -88,6 +88,7 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o | |||
88 | obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o | 88 | obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o |
89 | 89 | ||
90 | # AT91SAM board with device-tree | 90 | # AT91SAM board with device-tree |
91 | obj-$(CONFIG_MACH_AT91RM9200_DT) += board-rm9200-dt.o | ||
91 | obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o | 92 | obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o |
92 | 93 | ||
93 | # AT91X40 board-specific support | 94 | # AT91X40 board-specific support |
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c index a3e4710d7352..6cceb42a4c33 100644 --- a/arch/arm/mach-at91/at91rm9200.c +++ b/arch/arm/mach-at91/at91rm9200.c | |||
@@ -194,6 +194,24 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
194 | CLKDEV_CON_ID("pioB", &pioB_clk), | 194 | CLKDEV_CON_ID("pioB", &pioB_clk), |
195 | CLKDEV_CON_ID("pioC", &pioC_clk), | 195 | CLKDEV_CON_ID("pioC", &pioC_clk), |
196 | CLKDEV_CON_ID("pioD", &pioD_clk), | 196 | CLKDEV_CON_ID("pioD", &pioD_clk), |
197 | /* usart lookup table for DT entries */ | ||
198 | CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck), | ||
199 | CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk), | ||
200 | CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk), | ||
201 | CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk), | ||
202 | CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk), | ||
203 | /* tc lookup table for DT entries */ | ||
204 | CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk), | ||
205 | CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk), | ||
206 | CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk), | ||
207 | CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk), | ||
208 | CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk), | ||
209 | CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk), | ||
210 | CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk), | ||
211 | CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk), | ||
212 | CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk), | ||
213 | CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk), | ||
214 | CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk), | ||
197 | }; | 215 | }; |
198 | 216 | ||
199 | static struct clk_lookup usart_clocks_lookups[] = { | 217 | static struct clk_lookup usart_clocks_lookups[] = { |
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index aaa443b48c91..cafe98836c8a 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/clockchips.h> | 25 | #include <linux/clockchips.h> |
26 | #include <linux/export.h> | 26 | #include <linux/export.h> |
27 | #include <linux/of.h> | ||
28 | #include <linux/of_address.h> | ||
29 | #include <linux/of_irq.h> | ||
27 | 30 | ||
28 | #include <asm/mach/time.h> | 31 | #include <asm/mach/time.h> |
29 | 32 | ||
@@ -91,7 +94,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) | |||
91 | static struct irqaction at91rm9200_timer_irq = { | 94 | static struct irqaction at91rm9200_timer_irq = { |
92 | .name = "at91_tick", | 95 | .name = "at91_tick", |
93 | .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 96 | .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
94 | .handler = at91rm9200_timer_interrupt | 97 | .handler = at91rm9200_timer_interrupt, |
98 | .irq = NR_IRQS_LEGACY + AT91_ID_SYS, | ||
95 | }; | 99 | }; |
96 | 100 | ||
97 | static cycle_t read_clk32k(struct clocksource *cs) | 101 | static cycle_t read_clk32k(struct clocksource *cs) |
@@ -179,8 +183,60 @@ static struct clock_event_device clkevt = { | |||
179 | void __iomem *at91_st_base; | 183 | void __iomem *at91_st_base; |
180 | EXPORT_SYMBOL_GPL(at91_st_base); | 184 | EXPORT_SYMBOL_GPL(at91_st_base); |
181 | 185 | ||
186 | #ifdef CONFIG_OF | ||
187 | static struct of_device_id at91rm9200_st_timer_ids[] = { | ||
188 | { .compatible = "atmel,at91rm9200-st" }, | ||
189 | { /* sentinel */ } | ||
190 | }; | ||
191 | |||
192 | static int __init of_at91rm9200_st_init(void) | ||
193 | { | ||
194 | struct device_node *np; | ||
195 | int ret; | ||
196 | |||
197 | np = of_find_matching_node(NULL, at91rm9200_st_timer_ids); | ||
198 | if (!np) | ||
199 | goto err; | ||
200 | |||
201 | at91_st_base = of_iomap(np, 0); | ||
202 | if (!at91_st_base) | ||
203 | goto node_err; | ||
204 | |||
205 | /* Get the interrupts property */ | ||
206 | ret = irq_of_parse_and_map(np, 0); | ||
207 | if (!ret) | ||
208 | goto ioremap_err; | ||
209 | at91rm9200_timer_irq.irq = ret; | ||
210 | |||
211 | of_node_put(np); | ||
212 | |||
213 | return 0; | ||
214 | |||
215 | ioremap_err: | ||
216 | iounmap(at91_st_base); | ||
217 | node_err: | ||
218 | of_node_put(np); | ||
219 | err: | ||
220 | return -EINVAL; | ||
221 | } | ||
222 | #else | ||
223 | static int __init of_at91rm9200_st_init(void) | ||
224 | { | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | #endif | ||
228 | |||
182 | void __init at91rm9200_ioremap_st(u32 addr) | 229 | void __init at91rm9200_ioremap_st(u32 addr) |
183 | { | 230 | { |
231 | #ifdef CONFIG_OF | ||
232 | struct device_node *np; | ||
233 | |||
234 | np = of_find_matching_node(NULL, at91rm9200_st_timer_ids); | ||
235 | if (np) { | ||
236 | of_node_put(np); | ||
237 | return; | ||
238 | } | ||
239 | #endif | ||
184 | at91_st_base = ioremap(addr, 256); | 240 | at91_st_base = ioremap(addr, 256); |
185 | if (!at91_st_base) | 241 | if (!at91_st_base) |
186 | panic("Impossible to ioremap ST\n"); | 242 | panic("Impossible to ioremap ST\n"); |
@@ -191,13 +247,16 @@ void __init at91rm9200_ioremap_st(u32 addr) | |||
191 | */ | 247 | */ |
192 | void __init at91rm9200_timer_init(void) | 248 | void __init at91rm9200_timer_init(void) |
193 | { | 249 | { |
250 | /* For device tree enabled device: initialize here */ | ||
251 | of_at91rm9200_st_init(); | ||
252 | |||
194 | /* Disable all timer interrupts, and clear any pending ones */ | 253 | /* Disable all timer interrupts, and clear any pending ones */ |
195 | at91_st_write(AT91_ST_IDR, | 254 | at91_st_write(AT91_ST_IDR, |
196 | AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); | 255 | AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); |
197 | at91_st_read(AT91_ST_SR); | 256 | at91_st_read(AT91_ST_SR); |
198 | 257 | ||
199 | /* Make IRQs happen for the system timer */ | 258 | /* Make IRQs happen for the system timer */ |
200 | setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq); | 259 | setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq); |
201 | 260 | ||
202 | /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used | 261 | /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used |
203 | * directly for the clocksource and all clockevents, after adjusting | 262 | * directly for the clocksource and all clockevents, after adjusting |
diff --git a/arch/arm/mach-at91/board-rm9200-dt.c b/arch/arm/mach-at91/board-rm9200-dt.c new file mode 100644 index 000000000000..5f9ce3da3fde --- /dev/null +++ b/arch/arm/mach-at91/board-rm9200-dt.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Setup code for AT91RM9200 Evaluation Kits with Device Tree support | ||
3 | * | ||
4 | * Copyright (C) 2011 Atmel, | ||
5 | * 2011 Nicolas Ferre <nicolas.ferre@atmel.com> | ||
6 | * 2012 Joachim Eastwood <manabian@gmail.com> | ||
7 | * | ||
8 | * Licensed under GPLv2 or later. | ||
9 | */ | ||
10 | |||
11 | #include <linux/types.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/gpio.h> | ||
15 | #include <linux/of.h> | ||
16 | #include <linux/of_irq.h> | ||
17 | #include <linux/of_platform.h> | ||
18 | |||
19 | #include <asm/setup.h> | ||
20 | #include <asm/irq.h> | ||
21 | #include <asm/mach/arch.h> | ||
22 | #include <asm/mach/map.h> | ||
23 | #include <asm/mach/irq.h> | ||
24 | |||
25 | #include "at91_aic.h" | ||
26 | #include "generic.h" | ||
27 | |||
28 | |||
29 | static const struct of_device_id irq_of_match[] __initconst = { | ||
30 | { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, | ||
31 | { /*sentinel*/ } | ||
32 | }; | ||
33 | |||
34 | static void __init at91rm9200_dt_init_irq(void) | ||
35 | { | ||
36 | of_irq_init(irq_of_match); | ||
37 | } | ||
38 | |||
39 | static void __init at91rm9200_dt_device_init(void) | ||
40 | { | ||
41 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | ||
42 | } | ||
43 | |||
44 | static const char *at91rm9200_dt_board_compat[] __initdata = { | ||
45 | "atmel,at91rm9200", | ||
46 | NULL | ||
47 | }; | ||
48 | |||
49 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") | ||
50 | .timer = &at91rm9200_timer, | ||
51 | .map_io = at91_map_io, | ||
52 | .handle_irq = at91_aic_handle_irq, | ||
53 | .init_early = at91rm9200_dt_initialize, | ||
54 | .init_irq = at91rm9200_dt_init_irq, | ||
55 | .init_machine = at91rm9200_dt_device_init, | ||
56 | .dt_compat = at91rm9200_dt_board_compat, | ||
57 | MACHINE_END | ||
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h index b62f560e6c75..fc593d615e7d 100644 --- a/arch/arm/mach-at91/generic.h +++ b/arch/arm/mach-at91/generic.h | |||
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base, | |||
20 | extern void __init at91rm9200_set_type(int type); | 20 | extern void __init at91rm9200_set_type(int type); |
21 | extern void __init at91_initialize(unsigned long main_clock); | 21 | extern void __init at91_initialize(unsigned long main_clock); |
22 | extern void __init at91x40_initialize(unsigned long main_clock); | 22 | extern void __init at91x40_initialize(unsigned long main_clock); |
23 | extern void __init at91rm9200_dt_initialize(void); | ||
23 | extern void __init at91_dt_initialize(void); | 24 | extern void __init at91_dt_initialize(void); |
24 | 25 | ||
25 | /* Interrupts */ | 26 | /* Interrupts */ |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 80f4bfd913b3..19cdd0b5b391 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -339,6 +339,7 @@ static void at91_dt_rstc(void) | |||
339 | } | 339 | } |
340 | 340 | ||
341 | static struct of_device_id ramc_ids[] = { | 341 | static struct of_device_id ramc_ids[] = { |
342 | { .compatible = "atmel,at91rm9200-sdramc" }, | ||
342 | { .compatible = "atmel,at91sam9260-sdramc" }, | 343 | { .compatible = "atmel,at91sam9260-sdramc" }, |
343 | { .compatible = "atmel,at91sam9g45-ddramc" }, | 344 | { .compatible = "atmel,at91sam9g45-ddramc" }, |
344 | { /*sentinel*/ } | 345 | { /*sentinel*/ } |
@@ -437,6 +438,19 @@ end: | |||
437 | of_node_put(np); | 438 | of_node_put(np); |
438 | } | 439 | } |
439 | 440 | ||
441 | void __init at91rm9200_dt_initialize(void) | ||
442 | { | ||
443 | at91_dt_ramc(); | ||
444 | |||
445 | /* Init clock subsystem */ | ||
446 | at91_dt_clock_init(); | ||
447 | |||
448 | /* Register the processor-specific clocks */ | ||
449 | at91_boot_soc.register_clocks(); | ||
450 | |||
451 | at91_boot_soc.init(); | ||
452 | } | ||
453 | |||
440 | void __init at91_dt_initialize(void) | 454 | void __init at91_dt_initialize(void) |
441 | { | 455 | { |
442 | at91_dt_rstc(); | 456 | at91_dt_rstc(); |