Merge git://github.com/davem330/sparc
[pandora-kernel.git] / arch / arm / mach-at91 / at91sam9261.c
index c148316..6c8e3b5 100644 (file)
 #include <mach/at91_rstc.h>
 #include <mach/at91_shdwc.h>
 
+#include "soc.h"
 #include "generic.h"
 #include "clock.h"
 
-static struct map_desc at91sam9261_io_desc[] __initdata = {
-       {
-               .virtual        = AT91_VA_BASE_SYS,
-               .pfn            = __phys_to_pfn(AT91_BASE_SYS),
-               .length         = SZ_16K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc at91sam9261_sram_desc[] __initdata = {
-       {
-               .virtual        = AT91_IO_VIRT_BASE - AT91SAM9261_SRAM_SIZE,
-               .pfn            = __phys_to_pfn(AT91SAM9261_SRAM_BASE),
-               .length         = AT91SAM9261_SRAM_SIZE,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc at91sam9g10_sram_desc[] __initdata = {
-       {
-               .virtual        = AT91_IO_VIRT_BASE - AT91SAM9G10_SRAM_SIZE,
-               .pfn            = __phys_to_pfn(AT91SAM9G10_SRAM_BASE),
-               .length         = AT91SAM9G10_SRAM_SIZE,
-               .type           = MT_DEVICE,
-       },
-};
-
 /* --------------------------------------------------------------------
  *  Clocks
  * -------------------------------------------------------------------- */
@@ -183,7 +157,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tc0_clk),
        CLKDEV_CON_DEV_ID("t1_clk", "atmel_tcb.0", &tc1_clk),
-       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc1_clk),
+       CLKDEV_CON_DEV_ID("t2_clk", "atmel_tcb.0", &tc2_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
@@ -302,30 +276,21 @@ static void at91sam9261_poweroff(void)
  *  AT91SAM9261 processor initialization
  * -------------------------------------------------------------------- */
 
-void __init at91sam9261_map_io(void)
+static void __init at91sam9261_map_io(void)
 {
-       /* Map peripherals */
-       iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc));
-
        if (cpu_is_at91sam9g10())
-               iotable_init(at91sam9g10_sram_desc, ARRAY_SIZE(at91sam9g10_sram_desc));
+               at91_init_sram(0, AT91SAM9G10_SRAM_BASE, AT91SAM9G10_SRAM_SIZE);
        else
-               iotable_init(at91sam9261_sram_desc, ARRAY_SIZE(at91sam9261_sram_desc));
+               at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE);
 }
 
-void __init at91sam9261_initialize(unsigned long main_clock)
+static void __init at91sam9261_initialize(void)
 {
        at91_arch_reset = at91sam9_alt_reset;
        pm_power_off = at91sam9261_poweroff;
        at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
                        | (1 << AT91SAM9261_ID_IRQ2);
 
-       /* Init clock subsystem */
-       at91_clock_init(main_clock);
-
-       /* Register the processor-specific clocks */
-       at91sam9261_register_clocks();
-
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9261_gpio, 3);
 }
@@ -372,14 +337,9 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
        0,      /* Advanced Interrupt Controller */
 };
 
-void __init at91sam9261_init_interrupts(unsigned int priority[NR_AIC_IRQS])
-{
-       if (!priority)
-               priority = at91sam9261_default_irq_priority;
-
-       /* Initialize the AIC interrupt controller */
-       at91_aic_init(priority);
-
-       /* Enable GPIO interrupts */
-       at91_gpio_irq_setup();
-}
+struct at91_init_soc __initdata at91sam9261_soc = {
+       .map_io = at91sam9261_map_io,
+       .default_irq_priority = at91sam9261_default_irq_priority,
+       .register_clocks = at91sam9261_register_clocks,
+       .init = at91sam9261_initialize,
+};