at91: add arch specific ioremap support
[pandora-kernel.git] / arch / arm / mach-at91 / setup.c
index 9ea4183..aa64294 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/mm.h>
 
 #include <asm/mach/map.h>
 
@@ -45,6 +46,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),
@@ -52,6 +73,24 @@ static struct map_desc at91_io_desc __initdata = {
        .type           = MT_DEVICE,
 };
 
+void __iomem *at91_ioremap(unsigned long p, size_t size, unsigned int type)
+{
+       if (p >= AT91_BASE_SYS && p <= (AT91_BASE_SYS + SZ_16K - 1))
+               return (void __iomem *)AT91_IO_P2V(p);
+
+       return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
+}
+EXPORT_SYMBOL(at91_ioremap);
+
+void at91_iounmap(volatile void __iomem *addr)
+{
+       unsigned long virt = (unsigned long)addr;
+
+       if (virt >= VMALLOC_START && virt < VMALLOC_END)
+               __iounmap(addr);
+}
+EXPORT_SYMBOL(at91_iounmap);
+
 #define AT91_DBGU0     0xfffff200
 #define AT91_DBGU1     0xffffee00
 
@@ -248,5 +287,11 @@ void __init at91_map_io(void)
 
 void __init at91_initialize(unsigned long main_clock)
 {
-       at91_boot_soc.init(main_clock);
+       /* Init clock subsystem */
+       at91_clock_init(main_clock);
+
+       /* Register the processor-specific clocks */
+       at91_boot_soc.register_clocks();
+
+       at91_boot_soc.init();
 }