Commit 8fb76a07 authored by Shawn Guo's avatar Shawn Guo

ARM: imx6: set initial power mode in pm function

Rather than setting initial low-power mode in every single i.MX6 clock
initialization function, we should really do that in pm code.  Let's
move imx6q_set_lpm(WAIT_CLOCKED) call into imx6_pm_common_init().

While at it, let's rename the function to imx6_set_lpm() since it's
actually common for all i.MX6 SoCs.
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
parent f3a9249d
...@@ -527,8 +527,5 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) ...@@ -527,8 +527,5 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
/* All existing boards with PCIe use LVDS1 */ /* All existing boards with PCIe use LVDS1 */
if (IS_ENABLED(CONFIG_PCI_IMX6)) if (IS_ENABLED(CONFIG_PCI_IMX6))
clk_set_parent(clk[IMX6QDL_CLK_LVDS1_SEL], clk[IMX6QDL_CLK_SATA_REF_100M]); clk_set_parent(clk[IMX6QDL_CLK_LVDS1_SEL], clk[IMX6QDL_CLK_SATA_REF_100M]);
/* Set initial power mode */
imx6q_set_lpm(WAIT_CLOCKED);
} }
CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init); CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
...@@ -443,8 +443,5 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node) ...@@ -443,8 +443,5 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL], clk_set_parent(clks[IMX6SL_CLK_LCDIF_AXI_SEL],
clks[IMX6SL_CLK_PLL2_PFD2]); clks[IMX6SL_CLK_PLL2_PFD2]);
/* Set initial power mode */
imx6q_set_lpm(WAIT_CLOCKED);
} }
CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init); CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
...@@ -560,8 +560,5 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node) ...@@ -560,8 +560,5 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]); clk_set_parent(clks[IMX6SX_CLK_QSPI1_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]); clk_set_parent(clks[IMX6SX_CLK_QSPI2_SEL], clks[IMX6SX_CLK_PLL2_BUS]);
/* Set initial power mode */
imx6q_set_lpm(WAIT_CLOCKED);
} }
CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init); CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
...@@ -107,7 +107,7 @@ void imx_gpc_hwirq_unmask(unsigned int hwirq); ...@@ -107,7 +107,7 @@ void imx_gpc_hwirq_unmask(unsigned int hwirq);
void imx_anatop_init(void); void imx_anatop_init(void);
void imx_anatop_pre_suspend(void); void imx_anatop_pre_suspend(void);
void imx_anatop_post_resume(void); void imx_anatop_post_resume(void);
int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode); int imx6_set_lpm(enum mxc_cpu_pwr_mode mode);
void imx6q_set_int_mem_clk_lpm(bool enable); void imx6q_set_int_mem_clk_lpm(bool enable);
void imx6sl_set_wait_clk(bool enter); void imx6sl_set_wait_clk(bool enter);
int imx_mmdc_get_ddr_type(void); int imx_mmdc_get_ddr_type(void);
......
...@@ -27,9 +27,9 @@ static int imx6q_enter_wait(struct cpuidle_device *dev, ...@@ -27,9 +27,9 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
*/ */
if (!spin_trylock(&master_lock)) if (!spin_trylock(&master_lock))
goto idle; goto idle;
imx6q_set_lpm(WAIT_UNCLOCKED); imx6_set_lpm(WAIT_UNCLOCKED);
cpu_do_idle(); cpu_do_idle();
imx6q_set_lpm(WAIT_CLOCKED); imx6_set_lpm(WAIT_CLOCKED);
spin_unlock(&master_lock); spin_unlock(&master_lock);
goto done; goto done;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
static int imx6sl_enter_wait(struct cpuidle_device *dev, static int imx6sl_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index) struct cpuidle_driver *drv, int index)
{ {
imx6q_set_lpm(WAIT_UNCLOCKED); imx6_set_lpm(WAIT_UNCLOCKED);
/* /*
* Software workaround for ERR005311, see function * Software workaround for ERR005311, see function
* description for details. * description for details.
...@@ -24,7 +24,7 @@ static int imx6sl_enter_wait(struct cpuidle_device *dev, ...@@ -24,7 +24,7 @@ static int imx6sl_enter_wait(struct cpuidle_device *dev,
imx6sl_set_wait_clk(true); imx6sl_set_wait_clk(true);
cpu_do_idle(); cpu_do_idle();
imx6sl_set_wait_clk(false); imx6sl_set_wait_clk(false);
imx6q_set_lpm(WAIT_CLOCKED); imx6_set_lpm(WAIT_CLOCKED);
return index; return index;
} }
......
...@@ -25,7 +25,7 @@ static int imx6sx_idle_finish(unsigned long val) ...@@ -25,7 +25,7 @@ static int imx6sx_idle_finish(unsigned long val)
static int imx6sx_enter_wait(struct cpuidle_device *dev, static int imx6sx_enter_wait(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index) struct cpuidle_driver *drv, int index)
{ {
imx6q_set_lpm(WAIT_UNCLOCKED); imx6_set_lpm(WAIT_UNCLOCKED);
switch (index) { switch (index) {
case 1: case 1:
...@@ -50,7 +50,7 @@ static int imx6sx_enter_wait(struct cpuidle_device *dev, ...@@ -50,7 +50,7 @@ static int imx6sx_enter_wait(struct cpuidle_device *dev,
break; break;
} }
imx6q_set_lpm(WAIT_CLOCKED); imx6_set_lpm(WAIT_CLOCKED);
return index; return index;
} }
......
...@@ -255,7 +255,7 @@ static void imx6q_enable_wb(bool enable) ...@@ -255,7 +255,7 @@ static void imx6q_enable_wb(bool enable)
writel_relaxed(val, ccm_base + CCR); writel_relaxed(val, ccm_base + CCR);
} }
int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode) int imx6_set_lpm(enum mxc_cpu_pwr_mode mode)
{ {
u32 val = readl_relaxed(ccm_base + CLPCR); u32 val = readl_relaxed(ccm_base + CLPCR);
...@@ -340,7 +340,7 @@ static int imx6q_pm_enter(suspend_state_t state) ...@@ -340,7 +340,7 @@ static int imx6q_pm_enter(suspend_state_t state)
{ {
switch (state) { switch (state) {
case PM_SUSPEND_STANDBY: case PM_SUSPEND_STANDBY:
imx6q_set_lpm(STOP_POWER_ON); imx6_set_lpm(STOP_POWER_ON);
imx6q_set_int_mem_clk_lpm(true); imx6q_set_int_mem_clk_lpm(true);
imx_gpc_pre_suspend(false); imx_gpc_pre_suspend(false);
if (cpu_is_imx6sl()) if (cpu_is_imx6sl())
...@@ -350,10 +350,10 @@ static int imx6q_pm_enter(suspend_state_t state) ...@@ -350,10 +350,10 @@ static int imx6q_pm_enter(suspend_state_t state)
if (cpu_is_imx6sl()) if (cpu_is_imx6sl())
imx6sl_set_wait_clk(false); imx6sl_set_wait_clk(false);
imx_gpc_post_resume(); imx_gpc_post_resume();
imx6q_set_lpm(WAIT_CLOCKED); imx6_set_lpm(WAIT_CLOCKED);
break; break;
case PM_SUSPEND_MEM: case PM_SUSPEND_MEM:
imx6q_set_lpm(STOP_POWER_OFF); imx6_set_lpm(STOP_POWER_OFF);
imx6q_set_int_mem_clk_lpm(false); imx6q_set_int_mem_clk_lpm(false);
imx6q_enable_wb(true); imx6q_enable_wb(true);
/* /*
...@@ -373,7 +373,7 @@ static int imx6q_pm_enter(suspend_state_t state) ...@@ -373,7 +373,7 @@ static int imx6q_pm_enter(suspend_state_t state)
imx6_enable_rbc(false); imx6_enable_rbc(false);
imx6q_enable_wb(false); imx6q_enable_wb(false);
imx6q_set_int_mem_clk_lpm(true); imx6q_set_int_mem_clk_lpm(true);
imx6q_set_lpm(WAIT_CLOCKED); imx6_set_lpm(WAIT_CLOCKED);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -559,6 +559,8 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata ...@@ -559,6 +559,8 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata
WARN_ON(!ccm_base); WARN_ON(!ccm_base);
imx6_set_lpm(WAIT_CLOCKED);
if (IS_ENABLED(CONFIG_SUSPEND)) { if (IS_ENABLED(CONFIG_SUSPEND)) {
ret = imx6q_suspend_init(socdata); ret = imx6q_suspend_init(socdata);
if (ret) if (ret)
...@@ -568,7 +570,7 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata ...@@ -568,7 +570,7 @@ static void __init imx6_pm_common_init(const struct imx6_pm_socdata
/* /*
* This is for SW workaround step #1 of ERR007265, see comments * This is for SW workaround step #1 of ERR007265, see comments
* in imx6q_set_lpm for details of this errata. * in imx6_set_lpm for details of this errata.
* Force IOMUXC irq pending, so that the interrupt to GPC can be * Force IOMUXC irq pending, so that the interrupt to GPC can be
* used to deassert dsm_request signal when the signal gets * used to deassert dsm_request signal when the signal gets
* asserted unexpectedly. * asserted unexpectedly.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment