]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-omap2/pm34xx.c
OMAP3: PM: UART: disable clocks when idle
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / pm34xx.c
index 8e3c257f1235b422f770cb567cf360be50232028..da112b8b08a1ff79cfe79977c382b0ac765f1ec7 100644 (file)
@@ -29,6 +29,7 @@
 #include <mach/pm.h>
 #include <mach/clockdomain.h>
 #include <mach/powerdomain.h>
+#include <mach/serial.h>
 
 #include "cm.h"
 #include "cm-regbits-34xx.h"
@@ -171,9 +172,15 @@ static void omap_sram_idle(void)
        disable_smartreflex(SR2);
 
        omap2_gpio_prepare_for_retention();
+       omap_uart_prepare_idle(0);
+       omap_uart_prepare_idle(1);
+       omap_uart_prepare_idle(2);
 
        _omap_sram_idle(NULL, save_state);
 
+       omap_uart_resume_idle(2);
+       omap_uart_resume_idle(1);
+       omap_uart_resume_idle(0);
        omap2_gpio_resume_after_retention();
 
        /* Enable smartreflex after WFI */
@@ -210,6 +217,11 @@ static int omap3_fclks_active(void)
                                  CM_FCLKEN);
        fck_per = cm_read_mod_reg(OMAP3430_PER_MOD,
                                  CM_FCLKEN);
+
+       /* Ignore UART clocks.  These are handled by UART core (serial.c) */
+       fck_core1 &= ~(OMAP3430_EN_UART1 | OMAP3430_EN_UART2);
+       fck_per &= ~OMAP3430_EN_UART3;
+
        if (fck_core1 | fck_core3 | fck_sgx | fck_dss |
            fck_cam | fck_per | fck_usbhost)
                return 1;
@@ -220,6 +232,8 @@ static int omap3_can_sleep(void)
 {
        if (!enable_dyn_sleep)
                return 0;
+       if (!omap_uart_can_sleep())
+               return 0;
        if (omap3_fclks_active())
                return 0;
        if (atomic_read(&sleep_block) > 0)
@@ -312,6 +326,7 @@ static int omap3_pm_suspend(void)
                        goto restore;
        }
 
+       omap_uart_prepare_suspend();
        omap_sram_idle();
 
 restore: