ARM: imx: enable suspend for imx6sl
authorShawn Guo <shawn.guo@linaro.org>
Thu, 17 Oct 2013 02:07:09 +0000 (10:07 +0800)
committerShawn Guo <shawn.guo@linaro.org>
Mon, 21 Oct 2013 01:39:27 +0000 (09:39 +0800)
The imx6sl low power mode implementation inherits imx6q/dl one,
and pm-imx6q.c can just work for imx6sl with some minor updates.
Let's enable imx6sl suspend support by reusing pm-imx6q.c and use
cpu_is_imxXX() to handle the those minor differences between imx6sl
and imx6q/dl.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/clk-imx6sl.c
arch/arm/mach-imx/mach-imx6sl.c
arch/arm/mach-imx/mxc.h
arch/arm/mach-imx/pm-imx6q.c

index 5383c589ad719105d104c077bac14ff73e1933eb..bbe1f5bb799c1a0db3cd403f01767b2a7af4471b 100644 (file)
@@ -102,6 +102,8 @@ obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o mach-imx6sl.o
 
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_SOC_IMX6Q) += pm-imx6q.o headsmp.o
+# i.MX6SL reuses pm-imx6q.c
+obj-$(CONFIG_SOC_IMX6SL) += pm-imx6q.o
 endif
 
 # i.MX5 based machines
index a5c3c5d21aeedbcb324bca659730948f3e8d1a36..c0c4ef55e35bd7e522b4f83d038d50f752265db4 100644 (file)
@@ -127,6 +127,9 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
        base = of_iomap(np, 0);
        WARN_ON(!base);
 
+       /* Reuse imx6q pm code */
+       imx6q_pm_set_ccm_base(base);
+
        /*                                              name                reg       shift width parent_names     num_parents */
        clks[IMX6SL_CLK_STEP]             = imx_clk_mux("step",             base + 0xc,  8,  1, step_sels,         ARRAY_SIZE(step_sels));
        clks[IMX6SL_CLK_PLL1_SW]          = imx_clk_mux("pll1_sw",          base + 0xc,  2,  1, pll1_sw_sels,      ARRAY_SIZE(pll1_sw_sels));
index f01aaabd325464c0995465f6c281d2c1a1ba33cd..2f952e3fcf899172b40ffc7e1cfff7aa94718bc2 100644 (file)
@@ -47,6 +47,9 @@ static void __init imx6sl_init_machine(void)
        of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
 
        imx6sl_fec_init();
+       imx_anatop_init();
+       /* Reuse imx6q pm code */
+       imx6q_pm_init();
 }
 
 static void __init imx6sl_init_irq(void)
index 99e03ea9bf79f9e516522522bd87f4268718aaf9..b08ab3ad4a6db2d09d4344ef0e319b8bc8a64cf1 100644 (file)
@@ -153,6 +153,11 @@ extern unsigned int __mxc_cpu_type;
 #endif
 
 #ifndef __ASSEMBLY__
+static inline bool cpu_is_imx6sl(void)
+{
+       return __mxc_cpu_type == MXC_CPU_IMX6SL;
+}
+
 static inline bool cpu_is_imx6dl(void)
 {
        return __mxc_cpu_type == MXC_CPU_IMX6DL;
index f303b56f087ca61ff735c3edc24e9ad7443c8a42..aecd9f8037e0aab65e44482ffe817314b6bbd1be 100644 (file)
@@ -144,6 +144,12 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
                val |= 0x3 << BP_CLPCR_STBY_COUNT;
                val |= BM_CLPCR_VSTBY;
                val |= BM_CLPCR_SBYOS;
+               if (cpu_is_imx6sl()) {
+                       val |= BM_CLPCR_BYPASS_PMIC_READY;
+                       val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS;
+               } else {
+                       val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS;
+               }
                break;
        default:
                return -EINVAL;
@@ -181,7 +187,8 @@ static int imx6q_pm_enter(suspend_state_t state)
                imx_set_cpu_jump(0, v7_cpu_resume);
                /* Zzz ... */
                cpu_suspend(0, imx6q_suspend_finish);
-               imx_smp_prepare();
+               if (cpu_is_imx6q() || cpu_is_imx6dl())
+                       imx_smp_prepare();
                imx_anatop_post_resume();
                imx_gpc_post_resume();
                imx6q_enable_rbc(false);