]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap1/pm.c
Merge with /home/tmlind/src/kernel/linux-2.6
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap1 / pm.c
index bbc3452fb7b58e3fd686fb52c8f2310f4df81e4a..8ff232034871161d7073db531a04fae63a81081b 100644 (file)
@@ -1,3 +1,4 @@
+//kernel/linux-omap-fsample/arch/arm/mach-omap1/pm.c#3 - integrate change 4545 (text)
 /*
  * linux/arch/arm/mach-omap1/pm.c
  *
@@ -50,6 +51,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
+#include <asm/arch/cpu.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sram.h>
@@ -165,7 +167,7 @@ void omap_pm_idle(void)
        if ((use_idlect1 != ~0) || !do_sleep) {
 
                __u32 saved_idlect1 = omap_readl(ARM_IDLECT1);
-               if (cpu_is_omap1510())
+               if (cpu_is_omap15xx())
                        use_idlect1 &= OMAP1510_BIG_SLEEP_REQUEST;
                else
                        use_idlect1 &= OMAP1610_IDLECT1_SLEEP_VAL;
@@ -204,7 +206,7 @@ static void omap_pm_wakeup_setup(void)
        if (cpu_is_omap730())
                level1_wake = OMAP_IRQ_BIT(INT_730_GPIO_BANK1) |
                        OMAP_IRQ_BIT(INT_730_IH2_IRQ);
-       else if (cpu_is_omap1510())
+       else if (cpu_is_omap15xx())
                level1_wake = OMAP_IRQ_BIT(INT_GPIO_BANK1) |
                        OMAP_IRQ_BIT(INT_1510_IH2_IRQ);
        else if (cpu_is_omap16xx())
@@ -218,7 +220,7 @@ static void omap_pm_wakeup_setup(void)
                omap_writel(~(OMAP_IRQ_BIT(INT_730_WAKE_UP_REQ) |
                                OMAP_IRQ_BIT(INT_730_MPUIO_KEYPAD)),
                                OMAP_IH2_1_MIR);
-       } else if (cpu_is_omap1510()) {
+       } else if (cpu_is_omap15xx()) {
                level2_wake |= OMAP_IRQ_BIT(INT_KEYBOARD);
                omap_writel(~level2_wake,  OMAP_IH2_MIR);
        } else if (cpu_is_omap16xx()) {
@@ -234,11 +236,12 @@ static void omap_pm_wakeup_setup(void)
 
        /*  New IRQ agreement, recalculate in cascade order */
        omap_writel(1, OMAP_IH2_CONTROL);
-       omap_writel(1, OMAP_IH1_CONTROL);
+       omap_writel(1, OMAP_IH1_CONTROL);
 }
 
 #define EN_DSPCK       13      /* ARM_CKCTL */
 #define EN_APICK       6       /* ARM_IDLECT2 */
+#define DSP_EN         1       /* ARM_RSTCT1 */
 
 void omap_pm_suspend(void)
 {
@@ -253,7 +256,8 @@ void omap_pm_suspend(void)
                tps65010_set_led(LED1, OFF);
        }
 
-       omap_writew(0xffff, ULPD_SOFT_DISABLE_REQ_REG);
+       if (!cpu_is_omap15xx())
+               omap_writew(0xffff, ULPD_SOFT_DISABLE_REQ_REG);
 
        /*
         * Step 1: turn off interrupts (FIXME: NOTE: already disabled)
@@ -270,7 +274,7 @@ void omap_pm_suspend(void)
         * We have to save and restore very little register state to
         * idle the omap.
          *
-        * Save interrupt, MPUI, ARM and UPLD control registers.
+        * Save interrupt, MPUI, ARM and UPLD control registers.
         */
 
        if (cpu_is_omap730()) {
@@ -283,7 +287,7 @@ void omap_pm_suspend(void)
                MPUI730_SAVE(EMIFS_CONFIG);
                MPUI730_SAVE(EMIFF_SDRAM_CONFIG);
 
-       } else if (cpu_is_omap1510()) {
+       } else if (cpu_is_omap15xx()) {
                MPUI1510_SAVE(OMAP_IH1_MIR);
                MPUI1510_SAVE(OMAP_IH2_MIR);
                MPUI1510_SAVE(MPUI_CTRL);
@@ -307,7 +311,7 @@ void omap_pm_suspend(void)
        ARM_SAVE(ARM_CKCTL);
        ARM_SAVE(ARM_IDLECT1);
        ARM_SAVE(ARM_IDLECT2);
-       if (!(cpu_is_omap1510()))
+       if (!(cpu_is_omap15xx()))
                ARM_SAVE(ARM_IDLECT3);
        ARM_SAVE(ARM_EWUPCT);
        ARM_SAVE(ARM_RSTCT1);
@@ -323,10 +327,11 @@ void omap_pm_suspend(void)
         */
 
        /* stop DSP */
-       omap_dsp_pm_suspend();
+       omap_writew(omap_readw(ARM_RSTCT1) & ~(1 << DSP_EN), ARM_RSTCT1);
 
-       /* shut down dsp_ck */
-       omap_writew(omap_readw(ARM_CKCTL) & ~(1 << EN_DSPCK), ARM_CKCTL);
+               /* shut down dsp_ck */
+       if (!cpu_is_omap730())
+               omap_writew(omap_readw(ARM_CKCTL) & ~(1 << EN_DSPCK), ARM_CKCTL);
 
        /* temporarily enabling api_ck to access DSP registers */
        omap_writew(omap_readw(ARM_IDLECT2) | 1 << EN_APICK, ARM_IDLECT2);
@@ -370,7 +375,7 @@ void omap_pm_suspend(void)
         * Step 6c: ARM and Traffic controller shutdown
         *
         * Jump to assembly code. The processor will stay there
-        * until wake up.
+        * until wake up.
         */
         omap_sram_suspend(arg0, arg1);
 
@@ -388,14 +393,11 @@ void omap_pm_suspend(void)
        /* Restore DSP domain clocks */
        DSP_RESTORE(DSP_IDLECT2);
 
-       /* resume DSP */
-       omap_dsp_pm_resume();
-
        /*
         * Restore ARM state, except ARM_IDLECT1/2 which omap_cpu_suspend did
         */
 
-       if (!(cpu_is_omap1510()))
+       if (!(cpu_is_omap15xx()))
                ARM_RESTORE(ARM_IDLECT3);
        ARM_RESTORE(ARM_CKCTL);
        ARM_RESTORE(ARM_EWUPCT);
@@ -411,7 +413,7 @@ void omap_pm_suspend(void)
                MPUI730_RESTORE(OMAP_IH1_MIR);
                MPUI730_RESTORE(OMAP_IH2_0_MIR);
                MPUI730_RESTORE(OMAP_IH2_1_MIR);
-       } else if (cpu_is_omap1510()) {
+       } else if (cpu_is_omap15xx()) {
                MPUI1510_RESTORE(MPUI_CTRL);
                MPUI1510_RESTORE(MPUI_DSP_BOOT_CONFIG);
                MPUI1510_RESTORE(MPUI_DSP_API_CONFIG);
@@ -433,7 +435,8 @@ void omap_pm_suspend(void)
                MPUI1610_RESTORE(OMAP_IH2_3_MIR);
        }
 
-       omap_writew(0, ULPD_SOFT_DISABLE_REQ_REG);
+       if (!cpu_is_omap15xx())
+               omap_writew(0, ULPD_SOFT_DISABLE_REQ_REG);
 
        /*
         * Reenable interrupts
@@ -472,7 +475,7 @@ static int omap_pm_read_proc(
        ARM_SAVE(ARM_CKCTL);
        ARM_SAVE(ARM_IDLECT1);
        ARM_SAVE(ARM_IDLECT2);
-       if (!(cpu_is_omap1510()))
+       if (!(cpu_is_omap15xx()))
                ARM_SAVE(ARM_IDLECT3);
        ARM_SAVE(ARM_EWUPCT);
        ARM_SAVE(ARM_RSTCT1);
@@ -493,7 +496,7 @@ static int omap_pm_read_proc(
                MPUI730_SAVE(MPUI_DSP_API_CONFIG);
                MPUI730_SAVE(EMIFF_SDRAM_CONFIG);
                MPUI730_SAVE(EMIFS_CONFIG);
-       } else if (cpu_is_omap1510()) {
+       } else if (cpu_is_omap15xx()) {
                MPUI1510_SAVE(MPUI_CTRL);
                MPUI1510_SAVE(MPUI_DSP_STATUS);
                MPUI1510_SAVE(MPUI_DSP_BOOT_CONFIG);
@@ -556,34 +559,34 @@ static int omap_pm_read_proc(
                           MPUI730_SHOW(MPUI_DSP_API_CONFIG),
                           MPUI730_SHOW(EMIFF_SDRAM_CONFIG),
                           MPUI730_SHOW(EMIFS_CONFIG));
-               } else if (cpu_is_omap1510()) {
+               } else if (cpu_is_omap15xx()) {
                        my_buffer_offset += sprintf(my_base + my_buffer_offset,
                           "MPUI1510_CTRL_REG             0x%-8x \n"
                           "MPUI1510_DSP_STATUS_REG:      0x%-8x \n"
                           "MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
-                          "MPUI1510_DSP_API_CONFIG_REG:  0x%-8x \n"
-                          "MPUI1510_SDRAM_CONFIG_REG:    0x%-8x \n"
-                          "MPUI1510_EMIFS_CONFIG_REG:    0x%-8x \n",
-                          MPUI1510_SHOW(MPUI_CTRL),
-                          MPUI1510_SHOW(MPUI_DSP_STATUS),
-                          MPUI1510_SHOW(MPUI_DSP_BOOT_CONFIG),
-                          MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
-                          MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
-                          MPUI1510_SHOW(EMIFS_CONFIG));
+                          "MPUI1510_DSP_API_CONFIG_REG:  0x%-8x \n"
+                          "MPUI1510_SDRAM_CONFIG_REG:    0x%-8x \n"
+                          "MPUI1510_EMIFS_CONFIG_REG:    0x%-8x \n",
+                          MPUI1510_SHOW(MPUI_CTRL),
+                          MPUI1510_SHOW(MPUI_DSP_STATUS),
+                          MPUI1510_SHOW(MPUI_DSP_BOOT_CONFIG),
+                          MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
+                          MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
+                          MPUI1510_SHOW(EMIFS_CONFIG));
                } else if (cpu_is_omap16xx()) {
                        my_buffer_offset += sprintf(my_base + my_buffer_offset,
                           "MPUI1610_CTRL_REG             0x%-8x \n"
                           "MPUI1610_DSP_STATUS_REG:      0x%-8x \n"
                           "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
-                          "MPUI1610_DSP_API_CONFIG_REG:  0x%-8x \n"
-                          "MPUI1610_SDRAM_CONFIG_REG:    0x%-8x \n"
-                          "MPUI1610_EMIFS_CONFIG_REG:    0x%-8x \n",
-                          MPUI1610_SHOW(MPUI_CTRL),
-                          MPUI1610_SHOW(MPUI_DSP_STATUS),
-                          MPUI1610_SHOW(MPUI_DSP_BOOT_CONFIG),
-                          MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
-                          MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
-                          MPUI1610_SHOW(EMIFS_CONFIG));
+                          "MPUI1610_DSP_API_CONFIG_REG:  0x%-8x \n"
+                          "MPUI1610_SDRAM_CONFIG_REG:    0x%-8x \n"
+                          "MPUI1610_EMIFS_CONFIG_REG:    0x%-8x \n",
+                          MPUI1610_SHOW(MPUI_CTRL),
+                          MPUI1610_SHOW(MPUI_DSP_STATUS),
+                          MPUI1610_SHOW(MPUI_DSP_BOOT_CONFIG),
+                          MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
+                          MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
+                          MPUI1610_SHOW(EMIFS_CONFIG));
                }
 
                g_read_completed++;
@@ -681,25 +684,24 @@ static int omap_pm_finish(suspend_state_t state)
 }
 
 
-static irqreturn_t  omap_wakeup_interrupt(int  irq, void *  dev,
-                                    struct pt_regs *  regs)
+static irqreturn_t  omap_wakeup_interrupt(int irq, void *dev)
 {
        return IRQ_HANDLED;
 }
 
 static struct irqaction omap_wakeup_irq = {
        .name           = "peripheral wakeup",
-       .flags          = SA_INTERRUPT,
+       .flags          = IRQF_DISABLED,
        .handler        = omap_wakeup_interrupt
 };
 
 
 
 static struct pm_ops omap_pm_ops ={
-       .pm_disk_mode = 0,
-        .prepare        = omap_pm_prepare,
-        .enter          = omap_pm_enter,
-        .finish         = omap_pm_finish,
+       .pm_disk_mode   = 0,
+       .prepare        = omap_pm_prepare,
+       .enter          = omap_pm_enter,
+       .finish         = omap_pm_finish,
 };
 
 static int __init omap_pm_init(void)
@@ -716,7 +718,7 @@ static int __init omap_pm_init(void)
                                                omap730_idle_loop_suspend_sz);
                omap_sram_suspend = omap_sram_push(omap730_cpu_suspend,
                                                   omap730_cpu_suspend_sz);
-       } else if (cpu_is_omap1510()) {
+       } else if (cpu_is_omap15xx()) {
                omap_sram_idle = omap_sram_push(omap1510_idle_loop_suspend,
                                                omap1510_idle_loop_suspend_sz);
                omap_sram_suspend = omap_sram_push(omap1510_cpu_suspend,
@@ -740,15 +742,6 @@ static int __init omap_pm_init(void)
        else if (cpu_is_omap16xx())
                setup_irq(INT_1610_WAKE_UP_REQ, &omap_wakeup_irq);
 
-#if 0
-       /* --- BEGIN BOARD-DEPENDENT CODE --- */
-       /* Sleepx mask direction */
-       omap_writew((omap_readw(0xfffb5008) & ~2), 0xfffb5008);
-       /* Unmask sleepx signal */
-       omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
-       /* --- END BOARD-DEPENDENT CODE --- */
-#endif
-
        /* Program new power ramp-up time
         * (0 for most boards since we don't lower voltage when in deep sleep)
         */