]> err.no Git - linux-2.6/blobdiff - arch/arm/mach-pxa/pxa27x.c
[ARM] 5075/1: i2c-pxa: move i2c pin setup and PCFR_PI2CEN handling into arch/arm...
[linux-2.6] / arch / arm / mach-pxa / pxa27x.c
index 87ade40865f149ecfedc1e7e5b898f90b7fc2100..48cbdc771a808b246305997babac8abe71981ee5 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/arch/irqs.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/pxa2xx-regs.h>
+#include <asm/arch/mfp-pxa27x.h>
 #include <asm/arch/ohci.h>
 #include <asm/arch/pm.h>
 #include <asm/arch/dma.h>
@@ -151,7 +152,7 @@ static struct clk pxa27x_clks[] = {
 
        INIT_CKEN("USBCLK", USBHOST, 48000000, 0, &pxa27x_device_ohci.dev),
        INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
-       INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
+       INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
 
        INIT_CKEN("SSPCLK", SSP1, 13000000, 0, &pxa27x_device_ssp1.dev),
        INIT_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev),
@@ -180,9 +181,7 @@ static struct clk pxa27x_clks[] = {
  * 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_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3,
+enum { SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3,
 
        SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U,
        SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U,
@@ -197,7 +196,7 @@ enum {      SLEEP_SAVE_START = 0,
        SLEEP_SAVE_PWER, SLEEP_SAVE_PCFR, SLEEP_SAVE_PRER,
        SLEEP_SAVE_PFER, SLEEP_SAVE_PKWR,
 
-       SLEEP_SAVE_SIZE
+       SLEEP_SAVE_COUNT
 };
 
 void pxa27x_cpu_pm_save(unsigned long *sleep_save)
@@ -250,6 +249,9 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
        /* Clear edge-detect status register. */
        PEDR = 0xDF12FE1B;
 
+       /* Clear reset status */
+       RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
+
        switch (state) {
        case PM_SUSPEND_STANDBY:
                pxa_cpu_standby();
@@ -268,7 +270,7 @@ static int pxa27x_cpu_pm_valid(suspend_state_t state)
 }
 
 static struct pxa_cpu_pm_fns pxa27x_cpu_pm_fns = {
-       .save_size      = SLEEP_SAVE_SIZE,
+       .save_count     = SLEEP_SAVE_COUNT,
        .save           = pxa27x_cpu_pm_save,
        .restore        = pxa27x_cpu_pm_restore,
        .valid          = pxa27x_cpu_pm_valid,
@@ -286,37 +288,16 @@ static inline void pxa27x_init_pm(void) {}
 /* PXA27x:  Various gpios can issue wakeup events.  This logic only
  * handles the simple cases, not the WEMUX2 and WEMUX3 options
  */
-#define PXA27x_GPIO_NOWAKE_MASK \
-        ((1 << 8) | (1 << 7) | (1 << 6) | (1 << 5) | (1 << 2))
-#define WAKEMASK(gpio) \
-        (((gpio) <= 15) \
-                 ? ((1 << (gpio)) & ~PXA27x_GPIO_NOWAKE_MASK) \
-                 : ((gpio == 35) ? (1 << 24) : 0))
-
 static int pxa27x_set_wake(unsigned int irq, unsigned int on)
 {
        int gpio = IRQ_TO_GPIO(irq);
        uint32_t mask;
 
-       if ((gpio >= 0 && gpio <= 15) || (gpio == 35)) {
-               if (WAKEMASK(gpio) == 0)
-                       return -EINVAL;
-
-               mask = WAKEMASK(gpio);
+       if (gpio >= 0 && gpio < 128)
+               return gpio_set_wake(gpio, on);
 
-               if (on) {
-                       if (GRER(gpio) | GPIO_bit(gpio))
-                               PRER |= mask;
-                       else
-                               PRER &= ~mask;
-
-                       if (GFER(gpio) | GPIO_bit(gpio))
-                               PFER |= mask;
-                       else
-                               PFER &= ~mask;
-               }
-               goto set_pwer;
-       }
+       if (irq == IRQ_KEYPAD)
+               return keypad_set_wake(on);
 
        switch (irq) {
        case IRQ_RTCAlrm:
@@ -329,7 +310,6 @@ static int pxa27x_set_wake(unsigned int irq, unsigned int on)
                return -EINVAL;
        }
 
-set_pwer:
        if (on)
                PWER |= mask;
        else
@@ -369,11 +349,14 @@ struct platform_device pxa27x_device_i2c_power = {
 
 void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
 {
+       local_irq_disable();
+       PCFR |= PCFR_PI2CEN;
+       local_irq_enable();
        pxa27x_device_i2c_power.dev.platform_data = info;
 }
 
 static struct platform_device *devices[] __initdata = {
-       &pxa_device_udc,
+/*     &pxa_device_udc,        The UDC driver is PXA25x only */
        &pxa_device_ffuart,
        &pxa_device_btuart,
        &pxa_device_stuart,
@@ -417,4 +400,4 @@ static int __init pxa27x_init(void)
        return ret;
 }
 
-subsys_initcall(pxa27x_init);
+postcore_initcall(pxa27x_init);