diff options
author | Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com> | 2014-07-14 16:22:20 -0400 |
---|---|---|
committer | Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com> | 2014-07-15 19:21:21 -0400 |
commit | 3d0b80671ae0ed19c306c9547dde23447c4ced16 (patch) | |
tree | 8e86ccca8d19c67161592a6b7d1291db77f91d96 | |
parent | 2e44f58e53d8b7382523ecf14c0c2f66ca9822d1 (diff) |
ENGR00322509-2 ARM:imx6sl:busfreq: Fix incorrect clk_set_parent() call.
The code incorrectly attempts to set the parent of periph2_clk to periph2_clk2_sel.
Fix this by calling the clk_set_parent() function with the correct parameters.
Also replace all calls to clk_set_parent() and clk_set_rate() with imx_clk_set_parent()
and imx_clk_set_rate() function that prints out error messages in case of failure.
Signed-off-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@freescale.com>
-rw-r--r-- | arch/arm/mach-imx/busfreq-imx6.c | 177 |
1 files changed, 65 insertions, 112 deletions
diff --git a/arch/arm/mach-imx/busfreq-imx6.c b/arch/arm/mach-imx/busfreq-imx6.c index 12e8f69ee935..8dce0e153121 100644 --- a/arch/arm/mach-imx/busfreq-imx6.c +++ b/arch/arm/mach-imx/busfreq-imx6.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/regulator/consumer.h> | 46 | #include <linux/regulator/consumer.h> |
47 | #include <linux/sched.h> | 47 | #include <linux/sched.h> |
48 | #include <linux/suspend.h> | 48 | #include <linux/suspend.h> |
49 | #include "clk.h" | ||
49 | #include "hardware.h" | 50 | #include "hardware.h" |
50 | #include "common.h" | 51 | #include "common.h" |
51 | 52 | ||
@@ -119,11 +120,11 @@ static struct delayed_work bus_freq_daemon; | |||
119 | static void enter_lpm_imx6sx(void) | 120 | static void enter_lpm_imx6sx(void) |
120 | { | 121 | { |
121 | /* set periph_clk2 to source from OSC for periph */ | 122 | /* set periph_clk2 to source from OSC for periph */ |
122 | clk_set_parent(periph_clk2_sel, osc_clk); | 123 | imx_clk_set_parent(periph_clk2_sel, osc_clk); |
123 | clk_set_parent(periph_clk, periph_clk2); | 124 | imx_clk_set_parent(periph_clk, periph_clk2); |
124 | /* set ahb/ocram to 24MHz */ | 125 | /* set ahb/ocram to 24MHz */ |
125 | clk_set_rate(ahb_clk, LPAPM_CLK); | 126 | imx_clk_set_rate(ahb_clk, LPAPM_CLK); |
126 | clk_set_rate(ocram_clk, LPAPM_CLK); | 127 | imx_clk_set_rate(ocram_clk, LPAPM_CLK); |
127 | 128 | ||
128 | if (audio_bus_count) { | 129 | if (audio_bus_count) { |
129 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ | 130 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ |
@@ -132,9 +133,9 @@ static void enter_lpm_imx6sx(void) | |||
132 | update_ddr_freq_imx6sx(DDR3_AUDIO_CLK); | 133 | update_ddr_freq_imx6sx(DDR3_AUDIO_CLK); |
133 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) | 134 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) |
134 | update_lpddr2_freq(LPDDR2_AUDIO_CLK); | 135 | update_lpddr2_freq(LPDDR2_AUDIO_CLK); |
135 | clk_set_parent(periph2_clk2_sel, pll3); | 136 | imx_clk_set_parent(periph2_clk2_sel, pll3); |
136 | clk_set_parent(periph2_pre_clk, pll2_400); | 137 | imx_clk_set_parent(periph2_pre_clk, pll2_400); |
137 | clk_set_parent(periph2_clk, periph2_pre_clk); | 138 | imx_clk_set_parent(periph2_clk, periph2_pre_clk); |
138 | /* | 139 | /* |
139 | * As periph2_clk's parent is not changed from | 140 | * As periph2_clk's parent is not changed from |
140 | * high mode to audio mode, so clk framework | 141 | * high mode to audio mode, so clk framework |
@@ -146,9 +147,9 @@ static void enter_lpm_imx6sx(void) | |||
146 | */ | 147 | */ |
147 | if (high_bus_freq_mode) { | 148 | if (high_bus_freq_mode) { |
148 | if (ddr_type == MMDC_MDMISC_DDR_TYPE_DDR3) | 149 | if (ddr_type == MMDC_MDMISC_DDR_TYPE_DDR3) |
149 | clk_set_rate(mmdc_clk, DDR3_AUDIO_CLK); | 150 | imx_clk_set_rate(mmdc_clk, DDR3_AUDIO_CLK); |
150 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) | 151 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) |
151 | clk_set_rate(mmdc_clk, LPDDR2_AUDIO_CLK); | 152 | imx_clk_set_rate(mmdc_clk, LPDDR2_AUDIO_CLK); |
152 | } | 153 | } |
153 | audio_bus_freq_mode = 1; | 154 | audio_bus_freq_mode = 1; |
154 | low_bus_freq_mode = 0; | 155 | low_bus_freq_mode = 0; |
@@ -157,8 +158,8 @@ static void enter_lpm_imx6sx(void) | |||
157 | update_ddr_freq_imx6sx(LPAPM_CLK); | 158 | update_ddr_freq_imx6sx(LPAPM_CLK); |
158 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) | 159 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) |
159 | update_lpddr2_freq(LPAPM_CLK); | 160 | update_lpddr2_freq(LPAPM_CLK); |
160 | clk_set_parent(periph2_clk2_sel, osc_clk); | 161 | imx_clk_set_parent(periph2_clk2_sel, osc_clk); |
161 | clk_set_parent(periph2_clk, periph2_clk2); | 162 | imx_clk_set_parent(periph2_clk, periph2_clk2); |
162 | 163 | ||
163 | if (audio_bus_freq_mode) | 164 | if (audio_bus_freq_mode) |
164 | clk_disable_unprepare(pll2_400); | 165 | clk_disable_unprepare(pll2_400); |
@@ -175,22 +176,22 @@ static void exit_lpm_imx6sx(void) | |||
175 | * lower ahb/ocram's freq first to avoid too high | 176 | * lower ahb/ocram's freq first to avoid too high |
176 | * freq during parent switch from OSC to pll3. | 177 | * freq during parent switch from OSC to pll3. |
177 | */ | 178 | */ |
178 | clk_set_rate(ahb_clk, LPAPM_CLK / 3); | 179 | imx_clk_set_rate(ahb_clk, LPAPM_CLK / 3); |
179 | clk_set_rate(ocram_clk, LPAPM_CLK / 2); | 180 | imx_clk_set_rate(ocram_clk, LPAPM_CLK / 2); |
180 | /* set periph_clk2 to pll3 */ | 181 | /* set periph_clk2 to pll3 */ |
181 | clk_set_parent(periph_clk2_sel, pll3); | 182 | imx_clk_set_parent(periph_clk2_sel, pll3); |
182 | /* set periph clk to from pll2_400 */ | 183 | /* set periph clk to from pll2_400 */ |
183 | clk_set_parent(periph_pre_clk, pll2_400); | 184 | imx_clk_set_parent(periph_pre_clk, pll2_400); |
184 | clk_set_parent(periph_clk, periph_pre_clk); | 185 | imx_clk_set_parent(periph_clk, periph_pre_clk); |
185 | 186 | ||
186 | if (ddr_type == MMDC_MDMISC_DDR_TYPE_DDR3) | 187 | if (ddr_type == MMDC_MDMISC_DDR_TYPE_DDR3) |
187 | update_ddr_freq_imx6sx(ddr_normal_rate); | 188 | update_ddr_freq_imx6sx(ddr_normal_rate); |
188 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) | 189 | else if (ddr_type == MMDC_MDMISC_DDR_TYPE_LPDDR2) |
189 | update_lpddr2_freq(ddr_normal_rate); | 190 | update_lpddr2_freq(ddr_normal_rate); |
190 | /* correct parent info after ddr freq change in asm code */ | 191 | /* correct parent info after ddr freq change in asm code */ |
191 | clk_set_parent(periph2_clk2_sel, pll3); | 192 | imx_clk_set_parent(periph2_clk2_sel, pll3); |
192 | clk_set_parent(periph2_pre_clk, pll2_400); | 193 | imx_clk_set_parent(periph2_pre_clk, pll2_400); |
193 | clk_set_parent(periph2_clk, periph2_pre_clk); | 194 | imx_clk_set_parent(periph2_clk, periph2_pre_clk); |
194 | /* | 195 | /* |
195 | * As periph2_clk's parent is not changed from | 196 | * As periph2_clk's parent is not changed from |
196 | * audio mode to high mode, so clk framework | 197 | * audio mode to high mode, so clk framework |
@@ -201,7 +202,7 @@ static void exit_lpm_imx6sx(void) | |||
201 | * change to hardware. | 202 | * change to hardware. |
202 | */ | 203 | */ |
203 | if (audio_bus_freq_mode) | 204 | if (audio_bus_freq_mode) |
204 | clk_set_rate(mmdc_clk, ddr_normal_rate); | 205 | imx_clk_set_rate(mmdc_clk, ddr_normal_rate); |
205 | 206 | ||
206 | clk_disable_unprepare(pll2_400); | 207 | clk_disable_unprepare(pll2_400); |
207 | if (audio_bus_freq_mode) | 208 | if (audio_bus_freq_mode) |
@@ -213,36 +214,36 @@ static void enter_lpm_imx6sl(void) | |||
213 | if (high_bus_freq_mode) { | 214 | if (high_bus_freq_mode) { |
214 | pll2_org_rate = clk_get_rate(pll2); | 215 | pll2_org_rate = clk_get_rate(pll2); |
215 | /* Set periph_clk to be sourced from OSC_CLK */ | 216 | /* Set periph_clk to be sourced from OSC_CLK */ |
216 | clk_set_parent(periph_clk2_sel, osc_clk); | 217 | imx_clk_set_parent(periph_clk2_sel, osc_clk); |
217 | clk_set_parent(periph_clk, periph_clk2); | 218 | imx_clk_set_parent(periph_clk, periph_clk2); |
218 | /* Ensure AHB/AXI clks are at 24MHz. */ | 219 | /* Ensure AHB/AXI clks are at 24MHz. */ |
219 | clk_set_rate(ahb_clk, LPAPM_CLK); | 220 | imx_clk_set_rate(ahb_clk, LPAPM_CLK); |
220 | clk_set_rate(ocram_clk, LPAPM_CLK); | 221 | imx_clk_set_rate(ocram_clk, LPAPM_CLK); |
221 | } | 222 | } |
222 | if (audio_bus_count) { | 223 | if (audio_bus_count) { |
223 | /* Set AHB to 8MHz to lower pwer.*/ | 224 | /* Set AHB to 8MHz to lower pwer.*/ |
224 | clk_set_rate(ahb_clk, LPAPM_CLK / 3); | 225 | imx_clk_set_rate(ahb_clk, LPAPM_CLK / 3); |
225 | 226 | ||
226 | /* Set up DDR to 100MHz. */ | 227 | /* Set up DDR to 100MHz. */ |
227 | update_lpddr2_freq(LPDDR2_AUDIO_CLK); | 228 | update_lpddr2_freq(LPDDR2_AUDIO_CLK); |
228 | 229 | ||
229 | /* Fix the clock tree in kernel */ | 230 | /* Fix the clock tree in kernel */ |
230 | clk_set_rate(pll2, pll2_org_rate); | 231 | imx_clk_set_rate(pll2, pll2_org_rate); |
231 | clk_set_parent(periph2_pre_clk, pll2_200); | 232 | imx_clk_set_parent(periph2_pre_clk, pll2_200); |
232 | clk_set_parent(periph2_clk, periph2_pre_clk); | 233 | imx_clk_set_parent(periph2_clk, periph2_pre_clk); |
233 | 234 | ||
234 | if (low_bus_freq_mode || ultra_low_bus_freq_mode) { | 235 | if (low_bus_freq_mode || ultra_low_bus_freq_mode) { |
235 | /* | 236 | /* |
236 | * Swtich ARM to run off PLL2_PFD2_400MHz | 237 | * Swtich ARM to run off PLL2_PFD2_400MHz |
237 | * since DDR is anyway at 100MHz. | 238 | * since DDR is anyway at 100MHz. |
238 | */ | 239 | */ |
239 | clk_set_parent(step_clk, pll2_400); | 240 | imx_clk_set_parent(step_clk, pll2_400); |
240 | clk_set_parent(pll1_sw_clk, step_clk); | 241 | imx_clk_set_parent(pll1_sw_clk, step_clk); |
241 | /* | 242 | /* |
242 | * Ensure that the clock will be | 243 | * Ensure that the clock will be |
243 | * at original speed. | 244 | * at original speed. |
244 | */ | 245 | */ |
245 | clk_set_rate(cpu_clk, org_arm_rate); | 246 | imx_clk_set_rate(cpu_clk, org_arm_rate); |
246 | } | 247 | } |
247 | low_bus_freq_mode = 0; | 248 | low_bus_freq_mode = 0; |
248 | ultra_low_bus_freq_mode = 0; | 249 | ultra_low_bus_freq_mode = 0; |
@@ -272,7 +273,7 @@ static void enter_lpm_imx6sl(void) | |||
272 | * the CPU freq does not change, so attempt to | 273 | * the CPU freq does not change, so attempt to |
273 | * get a freq as close to 396MHz as possible. | 274 | * get a freq as close to 396MHz as possible. |
274 | */ | 275 | */ |
275 | clk_set_rate(pll1_sys, | 276 | imx_clk_set_rate(pll1_sys, |
276 | clk_round_rate(pll1_sys, (org_arm_rate * 2))); | 277 | clk_round_rate(pll1_sys, (org_arm_rate * 2))); |
277 | pll1_rate = clk_get_rate(pll1_sys); | 278 | pll1_rate = clk_get_rate(pll1_sys); |
278 | arm_div = pll1_rate / org_arm_rate; | 279 | arm_div = pll1_rate / org_arm_rate; |
@@ -282,9 +283,9 @@ static void enter_lpm_imx6sl(void) | |||
282 | * Ensure ARM CLK is lower before | 283 | * Ensure ARM CLK is lower before |
283 | * changing the parent. | 284 | * changing the parent. |
284 | */ | 285 | */ |
285 | clk_set_rate(cpu_clk, org_arm_rate / arm_div); | 286 | imx_clk_set_rate(cpu_clk, org_arm_rate / arm_div); |
286 | /* Now set the ARM clk parent to PLL1_SYS. */ | 287 | /* Now set the ARM clk parent to PLL1_SYS. */ |
287 | clk_set_parent(pll1_sw_clk, pll1_sys); | 288 | imx_clk_set_parent(pll1_sw_clk, pll1_sys); |
288 | 289 | ||
289 | /* | 290 | /* |
290 | * Set STEP_CLK back to OSC to save power and | 291 | * Set STEP_CLK back to OSC to save power and |
@@ -294,7 +295,7 @@ static void enter_lpm_imx6sl(void) | |||
294 | * to change the step_clk parent to pll2_pfd2_400M | 295 | * to change the step_clk parent to pll2_pfd2_400M |
295 | * is requested sometime later, the change is ignored. | 296 | * is requested sometime later, the change is ignored. |
296 | */ | 297 | */ |
297 | clk_set_parent(step_clk, osc_clk); | 298 | imx_clk_set_parent(step_clk, osc_clk); |
298 | /* Now set DDR to 24MHz. */ | 299 | /* Now set DDR to 24MHz. */ |
299 | update_lpddr2_freq(LPAPM_CLK); | 300 | update_lpddr2_freq(LPAPM_CLK); |
300 | 301 | ||
@@ -303,9 +304,9 @@ static void enter_lpm_imx6sl(void) | |||
303 | * Make sure PLL2 rate is updated as it gets | 304 | * Make sure PLL2 rate is updated as it gets |
304 | * bypassed in the DDR freq change code. | 305 | * bypassed in the DDR freq change code. |
305 | */ | 306 | */ |
306 | clk_set_rate(pll2, LPAPM_CLK); | 307 | imx_clk_set_rate(pll2, LPAPM_CLK); |
307 | clk_set_parent(periph2_clk2_sel, pll2); | 308 | imx_clk_set_parent(periph2_clk2_sel, pll2); |
308 | clk_set_parent(periph2_clk, periph2_clk2_sel); | 309 | imx_clk_set_parent(periph2_clk, periph2_clk2); |
309 | 310 | ||
310 | } | 311 | } |
311 | if (low_bus_count == 0) { | 312 | if (low_bus_count == 0) { |
@@ -330,32 +331,31 @@ static void exit_lpm_imx6sl(void) | |||
330 | * Make sure PLL2 rate is updated as it gets | 331 | * Make sure PLL2 rate is updated as it gets |
331 | * un-bypassed in the DDR freq change code. | 332 | * un-bypassed in the DDR freq change code. |
332 | */ | 333 | */ |
333 | clk_set_rate(pll2, pll2_org_rate); | 334 | imx_clk_set_rate(pll2, pll2_org_rate); |
334 | clk_set_parent(periph2_pre_clk, pll2_400); | 335 | imx_clk_set_parent(periph2_pre_clk, pll2_400); |
335 | clk_set_parent(periph2_clk, periph2_pre_clk); | 336 | imx_clk_set_parent(periph2_clk, periph2_pre_clk); |
336 | 337 | ||
337 | /* Ensure that periph_clk is sourced from PLL2_400. */ | 338 | /* Ensure that periph_clk is sourced from PLL2_400. */ |
338 | clk_set_parent(periph_pre_clk, pll2_400); | 339 | imx_clk_set_parent(periph_pre_clk, pll2_400); |
339 | /* | 340 | /* |
340 | * Before switching the perhiph_clk, ensure that the | 341 | * Before switching the perhiph_clk, ensure that the |
341 | * AHB/AXI will not be too fast. | 342 | * AHB/AXI will not be too fast. |
342 | */ | 343 | */ |
343 | clk_set_rate(ahb_clk, LPAPM_CLK / 3); | 344 | imx_clk_set_rate(ahb_clk, LPAPM_CLK / 3); |
344 | clk_set_rate(ocram_clk, LPAPM_CLK / 2); | 345 | imx_clk_set_rate(ocram_clk, LPAPM_CLK / 2); |
345 | clk_set_parent(periph_clk, periph_pre_clk); | 346 | imx_clk_set_parent(periph_clk, periph_pre_clk); |
346 | 347 | ||
347 | if (low_bus_freq_mode || ultra_low_bus_freq_mode) { | 348 | if (low_bus_freq_mode || ultra_low_bus_freq_mode) { |
348 | /* Move ARM from PLL1_SW_CLK to PLL2_400. */ | 349 | /* Move ARM from PLL1_SW_CLK to PLL2_400. */ |
349 | clk_set_parent(step_clk, pll2_400); | 350 | imx_clk_set_parent(step_clk, pll2_400); |
350 | clk_set_parent(pll1_sw_clk, step_clk); | 351 | imx_clk_set_parent(pll1_sw_clk, step_clk); |
351 | clk_set_rate(cpu_clk, org_arm_rate); | 352 | imx_clk_set_rate(cpu_clk, org_arm_rate); |
352 | ultra_low_bus_freq_mode = 0; | 353 | ultra_low_bus_freq_mode = 0; |
353 | } | 354 | } |
354 | } | 355 | } |
355 | 356 | ||
356 | int reduce_bus_freq(void) | 357 | static void reduce_bus_freq(void) |
357 | { | 358 | { |
358 | int ret = 0; | ||
359 | clk_prepare_enable(pll3); | 359 | clk_prepare_enable(pll3); |
360 | if (cpu_is_imx6sl()) | 360 | if (cpu_is_imx6sl()) |
361 | enter_lpm_imx6sl(); | 361 | enter_lpm_imx6sl(); |
@@ -364,44 +364,24 @@ int reduce_bus_freq(void) | |||
364 | else { | 364 | else { |
365 | if (cpu_is_imx6dl()) | 365 | if (cpu_is_imx6dl()) |
366 | /* Set axi to periph_clk */ | 366 | /* Set axi to periph_clk */ |
367 | clk_set_parent(axi_sel_clk, periph_clk); | 367 | imx_clk_set_parent(axi_sel_clk, periph_clk); |
368 | 368 | ||
369 | if (audio_bus_count) { | 369 | if (audio_bus_count) { |
370 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ | 370 | /* Need to ensure that PLL2_PFD_400M is kept ON. */ |
371 | clk_prepare_enable(pll2_400); | 371 | clk_prepare_enable(pll2_400); |
372 | update_ddr_freq_imx6q(DDR3_AUDIO_CLK); | 372 | update_ddr_freq_imx6q(DDR3_AUDIO_CLK); |
373 | /* Make sure periph clk's parent also got updated */ | 373 | /* Make sure periph clk's parent also got updated */ |
374 | ret = clk_set_parent(periph_clk2_sel, pll3); | 374 | imx_clk_set_parent(periph_clk2_sel, pll3); |
375 | if (ret) | 375 | imx_clk_set_parent(periph_pre_clk, pll2_200); |
376 | dev_warn(busfreq_dev, | 376 | imx_clk_set_parent(periph_clk, periph_pre_clk); |
377 | "%s: %d: clk set parent fail!\n", | ||
378 | __func__, __LINE__); | ||
379 | ret = clk_set_parent(periph_pre_clk, pll2_200); | ||
380 | if (ret) | ||
381 | dev_warn(busfreq_dev, | ||
382 | "%s: %d: clk set parent fail!\n", | ||
383 | __func__, __LINE__); | ||
384 | ret = clk_set_parent(periph_clk, periph_pre_clk); | ||
385 | if (ret) | ||
386 | dev_warn(busfreq_dev, | ||
387 | "%s: %d: clk set parent fail!\n", | ||
388 | __func__, __LINE__); | ||
389 | audio_bus_freq_mode = 1; | 377 | audio_bus_freq_mode = 1; |
390 | low_bus_freq_mode = 0; | 378 | low_bus_freq_mode = 0; |
391 | } else { | 379 | } else { |
392 | update_ddr_freq_imx6q(LPAPM_CLK); | 380 | update_ddr_freq_imx6q(LPAPM_CLK); |
393 | /* Make sure periph clk's parent also got updated */ | 381 | /* Make sure periph clk's parent also got updated */ |
394 | ret = clk_set_parent(periph_clk2_sel, osc_clk); | 382 | imx_clk_set_parent(periph_clk2_sel, osc_clk); |
395 | if (ret) | ||
396 | dev_warn(busfreq_dev, | ||
397 | "%s: %d: clk set parent fail!\n", | ||
398 | __func__, __LINE__); | ||
399 | /* Set periph_clk parent to OSC via periph_clk2_sel */ | 383 | /* Set periph_clk parent to OSC via periph_clk2_sel */ |
400 | ret = clk_set_parent(periph_clk, periph_clk2); | 384 | imx_clk_set_parent(periph_clk, periph_clk2); |
401 | if (ret) | ||
402 | dev_warn(busfreq_dev, | ||
403 | "%s: %d: clk set parent fail!\n", | ||
404 | __func__, __LINE__); | ||
405 | if (audio_bus_freq_mode) | 385 | if (audio_bus_freq_mode) |
406 | clk_disable_unprepare(pll2_400); | 386 | clk_disable_unprepare(pll2_400); |
407 | low_bus_freq_mode = 1; | 387 | low_bus_freq_mode = 1; |
@@ -421,8 +401,6 @@ int reduce_bus_freq(void) | |||
421 | dev_dbg(busfreq_dev, "Bus freq set to low mode. Count:\ | 401 | dev_dbg(busfreq_dev, "Bus freq set to low mode. Count:\ |
422 | high %d, med %d, audio %d\n", | 402 | high %d, med %d, audio %d\n", |
423 | high_bus_count, med_bus_count, audio_bus_count); | 403 | high_bus_count, med_bus_count, audio_bus_count); |
424 | |||
425 | return ret; | ||
426 | } | 404 | } |
427 | 405 | ||
428 | static void reduce_bus_freq_handler(struct work_struct *work) | 406 | static void reduce_bus_freq_handler(struct work_struct *work) |
@@ -469,9 +447,8 @@ int set_low_bus_freq(void) | |||
469 | * Set the DDR to either 528MHz or 400MHz for iMX6qd | 447 | * Set the DDR to either 528MHz or 400MHz for iMX6qd |
470 | * or 400MHz for iMX6dl. | 448 | * or 400MHz for iMX6dl. |
471 | */ | 449 | */ |
472 | int set_high_bus_freq(int high_bus_freq) | 450 | static int set_high_bus_freq(int high_bus_freq) |
473 | { | 451 | { |
474 | int ret = 0; | ||
475 | struct clk *periph_clk_parent; | 452 | struct clk *periph_clk_parent; |
476 | 453 | ||
477 | if (bus_freq_scaling_initialized && bus_freq_scaling_is_active) | 454 | if (bus_freq_scaling_initialized && bus_freq_scaling_is_active) |
@@ -505,45 +482,21 @@ int set_high_bus_freq(int high_bus_freq) | |||
505 | clk_prepare_enable(pll2_400); | 482 | clk_prepare_enable(pll2_400); |
506 | update_ddr_freq_imx6q(ddr_normal_rate); | 483 | update_ddr_freq_imx6q(ddr_normal_rate); |
507 | /* Make sure periph clk's parent also got updated */ | 484 | /* Make sure periph clk's parent also got updated */ |
508 | ret = clk_set_parent(periph_clk2_sel, pll3); | 485 | imx_clk_set_parent(periph_clk2_sel, pll3); |
509 | if (ret) | 486 | imx_clk_set_parent(periph_pre_clk, periph_clk_parent); |
510 | dev_warn(busfreq_dev, | 487 | imx_clk_set_parent(periph_clk, periph_pre_clk); |
511 | "%s: %d: clk set parent fail!\n", | ||
512 | __func__, __LINE__); | ||
513 | ret = clk_set_parent(periph_pre_clk, periph_clk_parent); | ||
514 | if (ret) | ||
515 | dev_warn(busfreq_dev, | ||
516 | "%s: %d: clk set parent fail!\n", | ||
517 | __func__, __LINE__); | ||
518 | ret = clk_set_parent(periph_clk, periph_pre_clk); | ||
519 | if (ret) | ||
520 | dev_warn(busfreq_dev, | ||
521 | "%s: %d: clk set parent fail!\n", | ||
522 | __func__, __LINE__); | ||
523 | if (cpu_is_imx6dl()) { | 488 | if (cpu_is_imx6dl()) { |
524 | /* Set axi to pll3_pfd1_540m */ | 489 | /* Set axi to pll3_pfd1_540m */ |
525 | clk_set_parent(axi_alt_sel_clk, pll3_pfd1_540m); | 490 | imx_clk_set_parent(axi_alt_sel_clk, pll3_pfd1_540m); |
526 | clk_set_parent(axi_sel_clk, axi_alt_sel_clk); | 491 | imx_clk_set_parent(axi_sel_clk, axi_alt_sel_clk); |
527 | } | 492 | } |
528 | clk_disable_unprepare(pll2_400); | 493 | clk_disable_unprepare(pll2_400); |
529 | } else { | 494 | } else { |
530 | update_ddr_freq_imx6q(ddr_med_rate); | 495 | update_ddr_freq_imx6q(ddr_med_rate); |
531 | /* Make sure periph clk's parent also got updated */ | 496 | /* Make sure periph clk's parent also got updated */ |
532 | ret = clk_set_parent(periph_clk2_sel, pll3); | 497 | imx_clk_set_parent(periph_clk2_sel, pll3); |
533 | if (ret) | 498 | imx_clk_set_parent(periph_pre_clk, pll2_400); |
534 | dev_warn(busfreq_dev, | 499 | imx_clk_set_parent(periph_clk, periph_pre_clk); |
535 | "%s: %d: clk set parent fail!\n", | ||
536 | __func__, __LINE__); | ||
537 | ret = clk_set_parent(periph_pre_clk, pll2_400); | ||
538 | if (ret) | ||
539 | dev_warn(busfreq_dev, | ||
540 | "%s: %d: clk set parent fail!\n", | ||
541 | __func__, __LINE__); | ||
542 | ret = clk_set_parent(periph_clk, periph_pre_clk); | ||
543 | if (ret) | ||
544 | dev_warn(busfreq_dev, | ||
545 | "%s: %d: clk set parent fail!\n", | ||
546 | __func__, __LINE__); | ||
547 | } | 500 | } |
548 | if (audio_bus_freq_mode) | 501 | if (audio_bus_freq_mode) |
549 | clk_disable_unprepare(pll2_400); | 502 | clk_disable_unprepare(pll2_400); |