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/mach-at91/setup.c | |
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/mach-at91/setup.c')
-rw-r--r-- | arch/arm/mach-at91/setup.c | 40 |
1 files changed, 37 insertions, 3 deletions
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(); |