diff options
author | Anson Huang <b20788@freescale.com> | 2013-11-07 15:38:20 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:47:09 -0400 |
commit | bec47fba08fea380a353b93bd277019bdc5d3815 (patch) | |
tree | 4b3195f0e57e0b25511241993e6f2dbe735be99f | |
parent | 015d9a20d94c373352eac15e0af396f1a60bc290 (diff) |
ENGR00286744-3 arm: imx: optimize power number for busfreq
i.MX6DL's axi clock is sourcing from pfd540 by default,
need to switch axi clock from pfd540 to periph when system
enters low bus mode, this is to allow pfd540 to be disabled,
and it also keeps clk tree correct.
Signed-off-by: Anson Huang <b20788@freescale.com>
-rw-r--r-- | arch/arm/mach-imx/busfreq-imx6.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/busfreq-imx6.c b/arch/arm/mach-imx/busfreq-imx6.c index bc9265293477..142a0cc0228a 100644 --- a/arch/arm/mach-imx/busfreq-imx6.c +++ b/arch/arm/mach-imx/busfreq-imx6.c | |||
@@ -94,6 +94,8 @@ static struct clk *periph2_pre_clk; | |||
94 | static struct clk *periph2_clk2_sel; | 94 | static struct clk *periph2_clk2_sel; |
95 | static struct clk *periph2_clk2; | 95 | static struct clk *periph2_clk2; |
96 | static struct clk *step_clk; | 96 | static struct clk *step_clk; |
97 | static struct clk *axi_sel_clk; | ||
98 | static struct clk *pll3_pfd1_540m; | ||
97 | 99 | ||
98 | static u32 pll2_org_rate; | 100 | static u32 pll2_org_rate; |
99 | static struct delayed_work low_bus_freq_handler; | 101 | static struct delayed_work low_bus_freq_handler; |
@@ -243,6 +245,11 @@ int reduce_bus_freq(void) | |||
243 | if (cpu_is_imx6sl()) | 245 | if (cpu_is_imx6sl()) |
244 | enter_lpm_imx6sl(); | 246 | enter_lpm_imx6sl(); |
245 | else { | 247 | else { |
248 | if (cpu_is_imx6dl() && (clk_get_parent(axi_sel_clk) | ||
249 | != periph_clk)) | ||
250 | /* Set axi to periph_clk */ | ||
251 | clk_set_parent(axi_sel_clk, periph_clk); | ||
252 | |||
246 | if (audio_bus_count) { | 253 | if (audio_bus_count) { |
247 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ | 254 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ |
248 | clk_prepare_enable(pll2_400); | 255 | clk_prepare_enable(pll2_400); |
@@ -394,6 +401,10 @@ int set_high_bus_freq(int high_bus_freq) | |||
394 | dev_WARN(busfreq_dev, | 401 | dev_WARN(busfreq_dev, |
395 | "%s: %d: clk set parent fail!\n", | 402 | "%s: %d: clk set parent fail!\n", |
396 | __func__, __LINE__); | 403 | __func__, __LINE__); |
404 | if (cpu_is_imx6dl() && (clk_get_parent(axi_sel_clk) | ||
405 | != pll3_pfd1_540m)) | ||
406 | /* Set axi to pll3_pfd1_540m */ | ||
407 | clk_set_parent(axi_sel_clk, pll3_pfd1_540m); | ||
397 | } else { | 408 | } else { |
398 | update_ddr_freq(ddr_med_rate); | 409 | update_ddr_freq(ddr_med_rate); |
399 | /* Make sure periph clk's parent also got updated */ | 410 | /* Make sure periph clk's parent also got updated */ |
@@ -734,6 +745,22 @@ static int busfreq_probe(struct platform_device *pdev) | |||
734 | return PTR_ERR(osc_clk); | 745 | return PTR_ERR(osc_clk); |
735 | } | 746 | } |
736 | 747 | ||
748 | if (cpu_is_imx6dl()) { | ||
749 | axi_sel_clk = devm_clk_get(&pdev->dev, "axi_sel"); | ||
750 | if (IS_ERR(axi_sel_clk)) { | ||
751 | dev_err(busfreq_dev, "%s: failed to get axi_sel_clk\n", | ||
752 | __func__); | ||
753 | return PTR_ERR(axi_sel_clk); | ||
754 | } | ||
755 | |||
756 | pll3_pfd1_540m = devm_clk_get(&pdev->dev, "pll3_pfd1_540m"); | ||
757 | if (IS_ERR(pll3_pfd1_540m)) { | ||
758 | dev_err(busfreq_dev, | ||
759 | "%s: failed to get pll3_pfd1_540m\n", __func__); | ||
760 | return PTR_ERR(pll3_pfd1_540m); | ||
761 | } | ||
762 | } | ||
763 | |||
737 | if (cpu_is_imx6sl()) { | 764 | if (cpu_is_imx6sl()) { |
738 | pll1_sys = devm_clk_get(&pdev->dev, "pll1_sys"); | 765 | pll1_sys = devm_clk_get(&pdev->dev, "pll1_sys"); |
739 | if (IS_ERR(pll1_sys)) { | 766 | if (IS_ERR(pll1_sys)) { |