aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-03-02 07:54:37 -0500
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-03-15 11:37:56 -0400
commita7776ec625c8ca90d050953946a5b72eaf41c21c (patch)
treecc2717698bc80e5511b06fa83936f0fd9617aa9c
parentc8082d344ac4c05932fec1766e5e9ce72cf286ed (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>
-rw-r--r--Documentation/devicetree/bindings/arm/atmel-at91.txt19
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi5
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi6
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi5
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c6
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5.h5
-rw-r--r--arch/arm/mach-at91/pm.c13
-rw-r--r--arch/arm/mach-at91/setup.c40
8 files changed, 72 insertions, 27 deletions
diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
index a64f86717b5d..1f8782077433 100644
--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
+++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
@@ -42,3 +42,22 @@ Example:
42 compatible = "atmel,at91sam9260-rstc"; 42 compatible = "atmel,at91sam9260-rstc";
43 reg = <0xfffffd00 0x10>; 43 reg = <0xfffffd00 0x10>;
44 }; 44 };
45
46RAMC SDRAM/DDR Controller required properties:
47- compatible: Should be "atmel,at91sam9260-sdramc",
48 "atmel,at91sam9g45-ddramc",
49- reg: Should contain registers location and length
50 For at91sam9263 and at91sam9g45 you must specify 2 entries.
51
52Examples:
53
54 ramc0: ramc@ffffe800 {
55 compatible = "atmel,at91sam9g45-ddramc";
56 reg = <0xffffe800 0x200>;
57 };
58
59 ramc0: ramc@ffffe400 {
60 compatible = "atmel,at91sam9g45-ddramc";
61 reg = <0xffffe400 0x200
62 0xffffe600 0x200>;
63 };
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
302static void __init at91sam9x5_ioremap_registers(void)
303{
304 at91_ioremap_ramc(0, AT91SAM9X5_BASE_DDRSDRC0, 512);
305}
306
307void __init at91sam9x5_initialize(void) 302void __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 = {
356struct at91_init_soc __initdata at91sam9x5_soc = { 351struct 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,
197extern u32 at91_slow_clock_sz; 197extern u32 at91_slow_clock_sz;
198#endif 198#endif
199 199
200void __iomem *at91_ramc_base[2];
201
202void __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
213static int at91_pm_enter(suspend_state_t state) 200static 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
55void __iomem *at91_ramc_base[2];
56
57void __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
55static struct map_desc sram_desc[2] __initdata; 68static struct map_desc sram_desc[2] __initdata;
56 69
57void __init at91_init_sram(int bank, unsigned long base, unsigned int length) 70void __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
331static struct of_device_id ramc_ids[] = {
332 { .compatible = "atmel,at91sam9260-sdramc" },
333 { .compatible = "atmel,at91sam9g45-ddramc" },
334 { /*sentinel*/ }
335};
336
337static 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
318void __init at91_dt_initialize(void) 354void __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();