diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2016-04-05 10:02:32 -0400 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-05-09 00:02:28 -0400 |
commit | 0eeb3dfe4b85aa7367e5e4efc365abbe4e50bbfa (patch) | |
tree | 0c26f9b2788325aa8d1f9987b957d83d7a41b5a3 | |
parent | 569579401ae1c9b9f317f38261e32135b153e9b3 (diff) |
ARC: [plat-axs] Refactor core freq get/set
Reduces diff in future patches !
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r-- | arch/arc/plat-axs10x/axs10x.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c index 1b0f0f458a2b..8e7f50a8b857 100644 --- a/arch/arc/plat-axs10x/axs10x.c +++ b/arch/arc/plat-axs10x/axs10x.c | |||
@@ -389,6 +389,8 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) | |||
389 | 389 | ||
390 | static void __init axs103_early_init(void) | 390 | static void __init axs103_early_init(void) |
391 | { | 391 | { |
392 | u32 freq = arc_get_core_freq(), orig = freq; | ||
393 | |||
392 | /* | 394 | /* |
393 | * AXS103 configurations for SMP/QUAD configurations share device tree | 395 | * AXS103 configurations for SMP/QUAD configurations share device tree |
394 | * which defaults to 90 MHz. However recent failures of Quad config | 396 | * which defaults to 90 MHz. However recent failures of Quad config |
@@ -401,12 +403,12 @@ static void __init axs103_early_init(void) | |||
401 | #ifdef CONFIG_ARC_MCIP | 403 | #ifdef CONFIG_ARC_MCIP |
402 | unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; | 404 | unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; |
403 | if (num_cores > 2) | 405 | if (num_cores > 2) |
404 | arc_set_core_freq(50 * 1000000); | 406 | freq = 50; |
405 | else if (num_cores == 2) | 407 | else if (num_cores == 2) |
406 | arc_set_core_freq(75 * 1000000); | 408 | freq = 75; |
407 | #endif | 409 | #endif |
408 | 410 | ||
409 | switch (arc_get_core_freq()/1000000) { | 411 | switch (freq) { |
410 | case 33: | 412 | case 33: |
411 | axs103_set_freq(1, 1, 1); | 413 | axs103_set_freq(1, 1, 1); |
412 | break; | 414 | break; |
@@ -431,11 +433,14 @@ static void __init axs103_early_init(void) | |||
431 | * DT "clock-frequency" might not match with board value. | 433 | * DT "clock-frequency" might not match with board value. |
432 | * Hence update it to match the board value. | 434 | * Hence update it to match the board value. |
433 | */ | 435 | */ |
434 | arc_set_core_freq(axs103_get_freq() * 1000000); | 436 | freq = axs103_get_freq(); |
435 | break; | 437 | break; |
436 | } | 438 | } |
437 | 439 | ||
438 | pr_info("Freq is %dMHz\n", axs103_get_freq()); | 440 | pr_info("Freq is %dMHz\n", freq); |
441 | if (freq != orig ) { | ||
442 | arc_set_core_freq(freq * 1000000); | ||
443 | } | ||
439 | 444 | ||
440 | /* Memory maps already config in pre-bootloader */ | 445 | /* Memory maps already config in pre-bootloader */ |
441 | 446 | ||