]> err.no Git - linux-2.6/blobdiff - arch/arm/mach-pxa/pxa25x.c
[ARM] 5065/2: CM-X270: Fix DM9000 IRQ flags initialisation
[linux-2.6] / arch / arm / mach-pxa / pxa25x.c
index ddd05bf78e022b0952ca06fafc30a2293d770fdf..e5b417d14bb04b772689b431631994c7985899d5 100644 (file)
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/suspend.h>
+#include <linux/sysdev.h>
 
 #include <asm/hardware.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/pxa-regs.h>
+#include <asm/arch/mfp-pxa25x.h>
 #include <asm/arch/pm.h>
 #include <asm/arch/dma.h>
 
@@ -128,6 +130,8 @@ static struct clk pxa25x_clks[] = {
        INIT_CKEN("SSPCLK", NSSP, 3686400, 0, &pxa25x_device_nssp.dev),
        INIT_CKEN("SSPCLK", ASSP, 3686400, 0, &pxa25x_device_assp.dev),
 
+       INIT_CKEN("AC97CLK",     AC97,     24576000, 0, NULL),
+
        /*
        INIT_CKEN("PWMCLK",  PWM0, 3686400,  0, NULL),
        INIT_CKEN("PWMCLK",  PWM0, 3686400,  0, NULL),
@@ -141,23 +145,12 @@ static struct clk pxa25x_clks[] = {
 #define SAVE(x)                sleep_save[SLEEP_SAVE_##x] = x
 #define RESTORE(x)     x = sleep_save[SLEEP_SAVE_##x]
 
-#define RESTORE_GPLEVEL(n) do { \
-       GPSR##n = sleep_save[SLEEP_SAVE_GPLR##n]; \
-       GPCR##n = ~sleep_save[SLEEP_SAVE_GPLR##n]; \
-} while (0)
-
 /*
  * List of global PXA peripheral registers to preserve.
  * More ones like CP and general purpose register values are preserved
  * with the stack pointer in sleep.S.
  */
-enum { SLEEP_SAVE_START = 0,
-
-       SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2,
-       SLEEP_SAVE_GPDR0, SLEEP_SAVE_GPDR1, SLEEP_SAVE_GPDR2,
-       SLEEP_SAVE_GRER0, SLEEP_SAVE_GRER1, SLEEP_SAVE_GRER2,
-       SLEEP_SAVE_GFER0, SLEEP_SAVE_GFER1, SLEEP_SAVE_GFER2,
-       SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2,
+enum { SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2,
 
        SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U,
        SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U,
@@ -165,26 +158,20 @@ enum {    SLEEP_SAVE_START = 0,
 
        SLEEP_SAVE_PSTR,
 
-       SLEEP_SAVE_ICMR,
        SLEEP_SAVE_CKEN,
 
-       SLEEP_SAVE_SIZE
+       SLEEP_SAVE_COUNT
 };
 
 
 static void pxa25x_cpu_pm_save(unsigned long *sleep_save)
 {
-       SAVE(GPLR0); SAVE(GPLR1); SAVE(GPLR2);
-       SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2);
-       SAVE(GRER0); SAVE(GRER1); SAVE(GRER2);
-       SAVE(GFER0); SAVE(GFER1); SAVE(GFER2);
        SAVE(PGSR0); SAVE(PGSR1); SAVE(PGSR2);
 
        SAVE(GAFR0_L); SAVE(GAFR0_U);
        SAVE(GAFR1_L); SAVE(GAFR1_U);
        SAVE(GAFR2_L); SAVE(GAFR2_U);
 
-       SAVE(ICMR); ICMR = 0;
        SAVE(CKEN);
        SAVE(PSTR);
 
@@ -198,27 +185,22 @@ static void pxa25x_cpu_pm_restore(unsigned long *sleep_save)
        PSPR = 0;
 
        /* restore registers */
-       RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
-       RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
        RESTORE(GAFR0_L); RESTORE(GAFR0_U);
        RESTORE(GAFR1_L); RESTORE(GAFR1_U);
        RESTORE(GAFR2_L); RESTORE(GAFR2_U);
-       RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
-       RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
        RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
 
        PSSR = PSSR_RDH | PSSR_PH;
 
        RESTORE(CKEN);
-
-       ICLR = 0;
-       ICCR = 1;
-       RESTORE(ICMR);
        RESTORE(PSTR);
 }
 
 static void pxa25x_cpu_pm_enter(suspend_state_t state)
 {
+       /* Clear reset status */
+       RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
+
        switch (state) {
        case PM_SUSPEND_MEM:
                /* set resume return address */
@@ -229,7 +211,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
 }
 
 static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = {
-       .save_size      = SLEEP_SAVE_SIZE,
+       .save_count     = SLEEP_SAVE_COUNT,
        .valid          = suspend_valid_only_mem,
        .save           = pxa25x_cpu_pm_save,
        .restore        = pxa25x_cpu_pm_restore,
@@ -250,24 +232,10 @@ static inline void pxa25x_init_pm(void) {}
 static int pxa25x_set_wake(unsigned int irq, unsigned int on)
 {
        int gpio = IRQ_TO_GPIO(irq);
-       uint32_t gpio_bit, mask = 0;
-
-       if (gpio >= 0 && gpio <= 15) {
-               gpio_bit = GPIO_bit(gpio);
-               mask = gpio_bit;
-               if (on) {
-                       if (GRER(gpio) | gpio_bit)
-                               PRER |= gpio_bit;
-                       else
-                               PRER &= ~gpio_bit;
-
-                       if (GFER(gpio) | gpio_bit)
-                               PFER |= gpio_bit;
-                       else
-                               PFER &= ~gpio_bit;
-               }
-               goto set_pwer;
-       }
+       uint32_t mask = 0;
+
+       if (gpio >= 0 && gpio < 85)
+               return gpio_set_wake(gpio, on);
 
        if (irq == IRQ_RTCAlrm) {
                mask = PWER_RTC;
@@ -287,9 +255,8 @@ set_pwer:
 
 void __init pxa25x_init_irq(void)
 {
-       pxa_init_irq_low();
-       pxa_init_irq_gpio(85);
-       pxa_init_irq_set_wake(pxa25x_set_wake);
+       pxa_init_irq(32, pxa25x_set_wake);
+       pxa_init_gpio(85, pxa25x_set_wake);
 }
 
 static struct platform_device *pxa25x_devices[] __initdata = {
@@ -304,9 +271,17 @@ static struct platform_device *pxa25x_devices[] __initdata = {
        &pxa25x_device_assp,
 };
 
+static struct sys_device pxa25x_sysdev[] = {
+       {
+               .cls    = &pxa_irq_sysclass,
+       }, {
+               .cls    = &pxa_gpio_sysclass,
+       },
+};
+
 static int __init pxa25x_init(void)
 {
-       int ret = 0;
+       int i, ret = 0;
 
        /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
        if (cpu_is_pxa25x())
@@ -320,9 +295,18 @@ static int __init pxa25x_init(void)
 
                pxa25x_init_pm();
 
+               for (i = 0; i < ARRAY_SIZE(pxa25x_sysdev); i++) {
+                       ret = sysdev_register(&pxa25x_sysdev[i]);
+                       if (ret)
+                               pr_err("failed to register sysdev[%d]\n", i);
+               }
+
                ret = platform_add_devices(pxa25x_devices,
                                           ARRAY_SIZE(pxa25x_devices));
+               if (ret)
+                       return ret;
        }
+
        /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
        if (cpu_is_pxa25x())
                ret = platform_device_register(&pxa_device_hwuart);
@@ -330,4 +314,4 @@ static int __init pxa25x_init(void)
        return ret;
 }
 
-subsys_initcall(pxa25x_init);
+postcore_initcall(pxa25x_init);