Commit 0eeb3dfe authored by Vineet Gupta's avatar Vineet Gupta

ARC: [plat-axs] Refactor core freq get/set

Reduces diff in future patches !
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 56957940
...@@ -389,6 +389,8 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) ...@@ -389,6 +389,8 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od)
static void __init axs103_early_init(void) static void __init axs103_early_init(void)
{ {
u32 freq = arc_get_core_freq(), orig = freq;
/* /*
* AXS103 configurations for SMP/QUAD configurations share device tree * AXS103 configurations for SMP/QUAD configurations share device tree
* which defaults to 90 MHz. However recent failures of Quad config * which defaults to 90 MHz. However recent failures of Quad config
...@@ -401,12 +403,12 @@ static void __init axs103_early_init(void) ...@@ -401,12 +403,12 @@ static void __init axs103_early_init(void)
#ifdef CONFIG_ARC_MCIP #ifdef CONFIG_ARC_MCIP
unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;
if (num_cores > 2) if (num_cores > 2)
arc_set_core_freq(50 * 1000000); freq = 50;
else if (num_cores == 2) else if (num_cores == 2)
arc_set_core_freq(75 * 1000000); freq = 75;
#endif #endif
switch (arc_get_core_freq()/1000000) { switch (freq) {
case 33: case 33:
axs103_set_freq(1, 1, 1); axs103_set_freq(1, 1, 1);
break; break;
...@@ -431,11 +433,14 @@ static void __init axs103_early_init(void) ...@@ -431,11 +433,14 @@ static void __init axs103_early_init(void)
* DT "clock-frequency" might not match with board value. * DT "clock-frequency" might not match with board value.
* Hence update it to match the board value. * Hence update it to match the board value.
*/ */
arc_set_core_freq(axs103_get_freq() * 1000000); freq = axs103_get_freq();
break; break;
} }
pr_info("Freq is %dMHz\n", axs103_get_freq()); pr_info("Freq is %dMHz\n", freq);
if (freq != orig ) {
arc_set_core_freq(freq * 1000000);
}
/* Memory maps already config in pre-bootloader */ /* Memory maps already config in pre-bootloader */
......
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