diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-05-10 03:20:09 +0800 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-07-28 15:07:29 +0000 |
commit | f0051d82a68abcf35418d49db1c82e6f0e514d78 (patch) | |
tree | 5a14645bdefe2a3c4671f456d4eb6595956c68ca /arch/arm/mach-at91/setup.c | |
parent | 51ddec7617bd0d4c73c44a8862faac5d7d97eb03 (diff) |
at91: factorize sram init
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
Diffstat (limited to 'arch/arm/mach-at91/setup.c')
-rw-r--r-- | arch/arm/mach-at91/setup.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c index 43251efd90d..816599fce55 100644 --- a/arch/arm/mach-at91/setup.c +++ b/arch/arm/mach-at91/setup.c @@ -45,6 +45,26 @@ void __init at91_init_interrupts(unsigned int *priority) at91_gpio_irq_setup(); } +static struct map_desc sram_desc[2] __initdata; + +void __init at91_init_sram(int bank, unsigned long base, unsigned int length) +{ + struct map_desc *desc = &sram_desc[bank]; + + desc->virtual = AT91_IO_VIRT_BASE - length; + if (bank > 0) + desc->virtual -= sram_desc[bank - 1].length; + + desc->pfn = __phys_to_pfn(base); + desc->length = length; + desc->type = MT_DEVICE; + + pr_info("AT91: sram at 0x%lx of 0x%x mapped at 0x%lx\n", + base, length, desc->virtual); + + iotable_init(desc, 1); +} + static struct map_desc at91_io_desc __initdata = { .virtual = AT91_VA_BASE_SYS, .pfn = __phys_to_pfn(AT91_BASE_SYS), |