diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-02 07:54:37 -0500 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-03-15 11:37:56 -0400 |
commit | a7776ec625c8ca90d050953946a5b72eaf41c21c (patch) | |
tree | cc2717698bc80e5511b06fa83936f0fd9617aa9c /arch/arm | |
parent | c8082d344ac4c05932fec1766e5e9ce72cf286ed (diff) |
ARM: at91: add ram controller DT support
We can now drop the call to ioremap_registers() as we have the binding for the
SDRAM/DDR Controller.
Drop ioremap_registers() for sam9x5 too.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/boot/dts/at91sam9g20.dtsi | 5 | ||||
-rw-r--r-- | arch/arm/boot/dts/at91sam9g45.dtsi | 6 | ||||
-rw-r--r-- | arch/arm/boot/dts/at91sam9x5.dtsi | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9x5.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9x5.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/pm.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-at91/setup.c | 40 |
7 files changed, 53 insertions, 27 deletions
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi index bcad6e7dccce..0a1df8d9bfb6 100644 --- a/arch/arm/boot/dts/at91sam9g20.dtsi +++ b/arch/arm/boot/dts/at91sam9g20.dtsi | |||
@@ -59,6 +59,11 @@ | |||
59 | reg = <0xfffff000 0x200>; | 59 | reg = <0xfffff000 0x200>; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | ramc0: ramc@ffffea00 { | ||
63 | compatible = "atmel,at91sam9260-sdramc"; | ||
64 | reg = <0xffffea00 0x200>; | ||
65 | }; | ||
66 | |||
62 | pmc: pmc@fffffc00 { | 67 | pmc: pmc@fffffc00 { |
63 | compatible = "atmel,at91rm9200-pmc"; | 68 | compatible = "atmel,at91rm9200-pmc"; |
64 | reg = <0xfffffc00 0x100>; | 69 | reg = <0xfffffc00 0x100>; |
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi index faccd4f5aace..587a1913c062 100644 --- a/arch/arm/boot/dts/at91sam9g45.dtsi +++ b/arch/arm/boot/dts/at91sam9g45.dtsi | |||
@@ -60,6 +60,12 @@ | |||
60 | reg = <0xfffff000 0x200>; | 60 | reg = <0xfffff000 0x200>; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | ramc0: ramc@ffffe400 { | ||
64 | compatible = "atmel,at91sam9g45-ddramc"; | ||
65 | reg = <0xffffe400 0x200 | ||
66 | 0xffffe600 0x200>; | ||
67 | }; | ||
68 | |||
63 | pmc: pmc@fffffc00 { | 69 | pmc: pmc@fffffc00 { |
64 | compatible = "atmel,at91rm9200-pmc"; | 70 | compatible = "atmel,at91rm9200-pmc"; |
65 | reg = <0xfffffc00 0x100>; | 71 | reg = <0xfffffc00 0x100>; |
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi index d9a93fdd35a5..73c46e3dffab 100644 --- a/arch/arm/boot/dts/at91sam9x5.dtsi +++ b/arch/arm/boot/dts/at91sam9x5.dtsi | |||
@@ -58,6 +58,11 @@ | |||
58 | reg = <0xfffff000 0x200>; | 58 | reg = <0xfffff000 0x200>; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | ramc0: ramc@ffffe800 { | ||
62 | compatible = "atmel,at91sam9g45-ddramc"; | ||
63 | reg = <0xffffe800 0x200>; | ||
64 | }; | ||
65 | |||
61 | pmc: pmc@fffffc00 { | 66 | pmc: pmc@fffffc00 { |
62 | compatible = "atmel,at91rm9200-pmc"; | 67 | compatible = "atmel,at91rm9200-pmc"; |
63 | reg = <0xfffffc00 0x100>; | 68 | reg = <0xfffffc00 0x100>; |
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c index c121fe5fabbd..01b2bd816a9a 100644 --- a/arch/arm/mach-at91/at91sam9x5.c +++ b/arch/arm/mach-at91/at91sam9x5.c | |||
@@ -299,11 +299,6 @@ static void __init at91sam9x5_map_io(void) | |||
299 | at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); | 299 | at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); |
300 | } | 300 | } |
301 | 301 | ||
302 | static void __init at91sam9x5_ioremap_registers(void) | ||
303 | { | ||
304 | at91_ioremap_ramc(0, AT91SAM9X5_BASE_DDRSDRC0, 512); | ||
305 | } | ||
306 | |||
307 | void __init at91sam9x5_initialize(void) | 302 | void __init at91sam9x5_initialize(void) |
308 | { | 303 | { |
309 | at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0); | 304 | at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0); |
@@ -356,7 +351,6 @@ static unsigned int at91sam9x5_default_irq_priority[NR_AIC_IRQS] __initdata = { | |||
356 | struct at91_init_soc __initdata at91sam9x5_soc = { | 351 | struct at91_init_soc __initdata at91sam9x5_soc = { |
357 | .map_io = at91sam9x5_map_io, | 352 | .map_io = at91sam9x5_map_io, |
358 | .default_irq_priority = at91sam9x5_default_irq_priority, | 353 | .default_irq_priority = at91sam9x5_default_irq_priority, |
359 | .ioremap_registers = at91sam9x5_ioremap_registers, | ||
360 | .register_clocks = at91sam9x5_register_clocks, | 354 | .register_clocks = at91sam9x5_register_clocks, |
361 | .init = at91sam9x5_initialize, | 355 | .init = at91sam9x5_initialize, |
362 | }; | 356 | }; |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h index a297a77d88e2..88e43d534cdf 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9x5.h +++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h | |||
@@ -55,11 +55,6 @@ | |||
55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 | 55 | #define AT91SAM9X5_BASE_USART2 0xf8024000 |
56 | 56 | ||
57 | /* | 57 | /* |
58 | * System Peripherals | ||
59 | */ | ||
60 | #define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800 | ||
61 | |||
62 | /* | ||
63 | * Base addresses for early serial code (uncompress.h) | 58 | * Base addresses for early serial code (uncompress.h) |
64 | */ | 59 | */ |
65 | #define AT91_DBGU AT91_BASE_DBGU0 | 60 | #define AT91_DBGU AT91_BASE_DBGU0 |
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c index 6c9d5e69ac28..f630250c6b87 100644 --- a/arch/arm/mach-at91/pm.c +++ b/arch/arm/mach-at91/pm.c | |||
@@ -197,19 +197,6 @@ extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0, | |||
197 | extern u32 at91_slow_clock_sz; | 197 | extern u32 at91_slow_clock_sz; |
198 | #endif | 198 | #endif |
199 | 199 | ||
200 | void __iomem *at91_ramc_base[2]; | ||
201 | |||
202 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | ||
203 | { | ||
204 | if (id < 0 || id > 1) { | ||
205 | pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id); | ||
206 | BUG(); | ||
207 | } | ||
208 | at91_ramc_base[id] = ioremap(addr, size); | ||
209 | if (!at91_ramc_base[id]) | ||
210 | panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr); | ||
211 | } | ||
212 | |||
213 | static int at91_pm_enter(suspend_state_t state) | 200 | static int at91_pm_enter(suspend_state_t state) |
214 | { | 201 | { |
215 | at91_gpio_suspend(); | 202 | at91_gpio_suspend(); |
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 3e48b59dfa74..46d0a56ba825 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c | |||
@@ -52,6 +52,19 @@ void __init at91_init_interrupts(unsigned int *priority) | |||
52 | at91_gpio_irq_setup(); | 52 | at91_gpio_irq_setup(); |
53 | } | 53 | } |
54 | 54 | ||
55 | void __iomem *at91_ramc_base[2]; | ||
56 | |||
57 | void __init at91_ioremap_ramc(int id, u32 addr, u32 size) | ||
58 | { | ||
59 | if (id < 0 || id > 1) { | ||
60 | pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id); | ||
61 | BUG(); | ||
62 | } | ||
63 | at91_ramc_base[id] = ioremap(addr, size); | ||
64 | if (!at91_ramc_base[id]) | ||
65 | panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr); | ||
66 | } | ||
67 | |||
55 | static struct map_desc sram_desc[2] __initdata; | 68 | static struct map_desc sram_desc[2] __initdata; |
56 | 69 | ||
57 | void __init at91_init_sram(int bank, unsigned long base, unsigned int length) | 70 | void __init at91_init_sram(int bank, unsigned long base, unsigned int length) |
@@ -315,12 +328,33 @@ static void at91_dt_rstc(void) | |||
315 | of_node_put(np); | 328 | of_node_put(np); |
316 | } | 329 | } |
317 | 330 | ||
331 | static struct of_device_id ramc_ids[] = { | ||
332 | { .compatible = "atmel,at91sam9260-sdramc" }, | ||
333 | { .compatible = "atmel,at91sam9g45-ddramc" }, | ||
334 | { /*sentinel*/ } | ||
335 | }; | ||
336 | |||
337 | static void at91_dt_ramc(void) | ||
338 | { | ||
339 | struct device_node *np; | ||
340 | |||
341 | np = of_find_matching_node(NULL, ramc_ids); | ||
342 | if (!np) | ||
343 | panic("unable to find compatible ram conroller node in dtb\n"); | ||
344 | |||
345 | at91_ramc_base[0] = of_iomap(np, 0); | ||
346 | if (!at91_ramc_base[0]) | ||
347 | panic("unable to map ramc[0] cpu registers\n"); | ||
348 | /* the controller may have 2 banks */ | ||
349 | at91_ramc_base[1] = of_iomap(np, 1); | ||
350 | |||
351 | of_node_put(np); | ||
352 | } | ||
353 | |||
318 | void __init at91_dt_initialize(void) | 354 | void __init at91_dt_initialize(void) |
319 | { | 355 | { |
320 | at91_dt_rstc(); | 356 | at91_dt_rstc(); |
321 | 357 | at91_dt_ramc(); | |
322 | /* temporary until have the ramc binding*/ | ||
323 | at91_boot_soc.ioremap_registers(); | ||
324 | 358 | ||
325 | /* Init clock subsystem */ | 359 | /* Init clock subsystem */ |
326 | at91_dt_clock_init(); | 360 | at91_dt_clock_init(); |