ARM: OMAP2+: Move most of plat/io.h into local iomap.h
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-omap2 / pm24xx.c
index cf0c216132ab2a4f9aa67dd86a904ea954cb27ed..423a9a957b8472e90e862af1720e7b3c2d1ede6e 100644 (file)
 #include <linux/irq.h>
 #include <linux/time.h>
 #include <linux/gpio.h>
-#include <linux/console.h>
 
 #include <asm/mach/time.h>
 #include <asm/mach/irq.h>
 #include <asm/mach-types.h>
 
-#include <mach/irqs.h>
 #include <plat/clock.h>
 #include <plat/sram.h>
 #include <plat/dma.h>
 #include <plat/board.h>
 
+#include <mach/irqs.h>
+
+#include "iomap.h"
+#include "common.h"
 #include "prm2xxx_3xxx.h"
 #include "prm-regbits-24xx.h"
 #include "cm2xxx_3xxx.h"
@@ -49,7 +51,6 @@
 #include "sdrc.h"
 #include "pm.h"
 #include "control.h"
-
 #include "powerdomain.h"
 #include "clockdomain.h"
 
@@ -126,27 +127,11 @@ static void omap2_enter_full_retention(void)
        if (omap_irq_pending())
                goto no_sleep;
 
-       /* Block console output in case it is on one of the OMAP UARTs */
-       if (!is_suspending())
-               if (!console_trylock())
-                       goto no_sleep;
-
-       omap_uart_prepare_idle(0);
-       omap_uart_prepare_idle(1);
-       omap_uart_prepare_idle(2);
-
        /* Jump to SRAM suspend code */
        omap2_sram_suspend(sdrc_read_reg(SDRC_DLLA_CTRL),
                           OMAP_SDRC_REGADDR(SDRC_DLLA_CTRL),
                           OMAP_SDRC_REGADDR(SDRC_POWER));
 
-       omap_uart_resume_idle(2);
-       omap_uart_resume_idle(1);
-       omap_uart_resume_idle(0);
-
-       if (!is_suspending())
-               console_unlock();
-
 no_sleep:
        omap2_gpio_resume_after_idle();
 
@@ -238,8 +223,6 @@ static int omap2_can_sleep(void)
 {
        if (omap2_fclks_active())
                return 0;
-       if (!omap_uart_can_sleep())
-               return 0;
        if (osc_ck->usecount > 1)
                return 0;
        if (omap_dma_running())
@@ -278,27 +261,6 @@ static int omap2_pm_begin(suspend_state_t state)
        return 0;
 }
 
-static int omap2_pm_suspend(void)
-{
-       u32 wken_wkup, mir1;
-
-       wken_wkup = omap2_prm_read_mod_reg(WKUP_MOD, PM_WKEN);
-       wken_wkup &= ~OMAP24XX_EN_GPT1_MASK;
-       omap2_prm_write_mod_reg(wken_wkup, WKUP_MOD, PM_WKEN);
-
-       /* Mask GPT1 */
-       mir1 = omap_readl(0x480fe0a4);
-       omap_writel(1 << 5, 0x480fe0ac);
-
-       omap_uart_prepare_suspend();
-       omap2_enter_full_retention();
-
-       omap_writel(mir1, 0x480fe0a4);
-       omap2_prm_write_mod_reg(wken_wkup, WKUP_MOD, PM_WKEN);
-
-       return 0;
-}
-
 static int omap2_pm_enter(suspend_state_t state)
 {
        int ret = 0;
@@ -306,7 +268,7 @@ static int omap2_pm_enter(suspend_state_t state)
        switch (state) {
        case PM_SUSPEND_STANDBY:
        case PM_SUSPEND_MEM:
-               ret = omap2_pm_suspend();
+               omap2_enter_full_retention();
                break;
        default:
                ret = -EINVAL;