diff options
author | Ranjani Vaidyanathan <ra5478@freescale.com> | 2012-08-30 15:02:32 -0500 |
---|---|---|
committer | Ranjani Vaidyanathan <ra5478@freescale.com> | 2012-08-31 00:02:00 -0500 |
commit | 1be7ed5bf221da9e795354675092d7d148f5008a (patch) | |
tree | dad1c7792221d5f8d68d36560963c79b8d9e9236 /arch/arm/mach-mx6/clock_mx6sl.c | |
parent | 6d2fdb00b1ff23ecf139aaad3dc2263f1cc971fb (diff) |
ENGR00222134 MX6x - Fix race-conditions in low power code.
Fix couple of race-conditions associated with low power IDLE code:
1. Ensure that bus freq mutex is used in the suspend/resume function
2. Ensure that the usecount of pll2 is incremented/decremented when
ARM is switched to run from PLL2_PFD_400. And PLL2 is enabled/disabled
when necessary.
Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
Diffstat (limited to 'arch/arm/mach-mx6/clock_mx6sl.c')
-rwxr-xr-x | arch/arm/mach-mx6/clock_mx6sl.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/arch/arm/mach-mx6/clock_mx6sl.c b/arch/arm/mach-mx6/clock_mx6sl.c index 43b2bd1baac2..6bd818ae7139 100755 --- a/arch/arm/mach-mx6/clock_mx6sl.c +++ b/arch/arm/mach-mx6/clock_mx6sl.c @@ -1167,7 +1167,16 @@ static int _clk_arm_set_rate(struct clk *clk, unsigned long rate) * PLL2_PFD2_400M. */ if (pll1_sw_clk.parent != &pll2_pfd2_400M) { - pll2_pfd2_400M.enable(&pll2_pfd2_400M); + if (pll2_pfd2_400M.usecount == 0) { + /* Check if PLL2 needs to be enabled also. */ + if (pll2_528_bus_main_clk.usecount == 0) + pll2_528_bus_main_clk.enable(&pll2_528_bus_main_clk); + /* Ensure parent usecount is + * also incremented. + */ + pll2_528_bus_main_clk.usecount++; + pll2_pfd2_400M.enable(&pll2_pfd2_400M); + } arm_needs_pll2_400 = true; pll2_pfd2_400M.usecount++; pll1_sw_clk.set_parent(&pll1_sw_clk, &pll2_pfd2_400M); @@ -1192,11 +1201,19 @@ static int _clk_arm_set_rate(struct clk *clk, unsigned long rate) pll1_sw_clk.set_parent(&pll1_sw_clk, &pll1_sys_main_clk); pll1_sw_clk.parent = &pll1_sys_main_clk; - if (arm_needs_pll2_400) + if (arm_needs_pll2_400) { pll2_pfd2_400M.usecount--; + if (pll2_pfd2_400M.usecount == 0) { + pll2_pfd2_400M.disable(&pll2_pfd2_400M); + /* Ensure parent usecount is + * also decremented. + */ + pll2_528_bus_main_clk.usecount--; + if (pll2_528_bus_main_clk.usecount == 0) + pll2_528_bus_main_clk.disable(&pll2_528_bus_main_clk); + } + } arm_needs_pll2_400 = false; - if (pll2_pfd2_400M.usecount == 0) - pll2_pfd2_400M.disable(&pll2_pfd2_400M); } parent_rate = clk_get_rate(clk->parent); div = parent_rate / rate; |