aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/plat-axs10x/axs10x.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arc/plat-axs10x/axs10x.c')
-rw-r--r--arch/arc/plat-axs10x/axs10x.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c
index 1b0f0f458a2b..86548701023c 100644
--- a/arch/arc/plat-axs10x/axs10x.c
+++ b/arch/arc/plat-axs10x/axs10x.c
@@ -14,10 +14,11 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/of_fdt.h>
17#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/libfdt.h>
18 20
19#include <asm/asm-offsets.h> 21#include <asm/asm-offsets.h>
20#include <asm/clk.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/mach_desc.h> 23#include <asm/mach_desc.h>
23#include <asm/mcip.h> 24#include <asm/mcip.h>
@@ -389,6 +390,13 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od)
389 390
390static void __init axs103_early_init(void) 391static void __init axs103_early_init(void)
391{ 392{
393 int offset = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk");
394 const struct fdt_property *prop = fdt_get_property(initial_boot_params,
395 offset,
396 "clock-frequency",
397 NULL);
398 u32 freq = be32_to_cpu(*(u32*)(prop->data)) / 1000000, orig = freq;
399
392 /* 400 /*
393 * AXS103 configurations for SMP/QUAD configurations share device tree 401 * AXS103 configurations for SMP/QUAD configurations share device tree
394 * which defaults to 90 MHz. However recent failures of Quad config 402 * which defaults to 90 MHz. However recent failures of Quad config
@@ -401,12 +409,10 @@ static void __init axs103_early_init(void)
401#ifdef CONFIG_ARC_MCIP 409#ifdef CONFIG_ARC_MCIP
402 unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; 410 unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F;
403 if (num_cores > 2) 411 if (num_cores > 2)
404 arc_set_core_freq(50 * 1000000); 412 freq = 50;
405 else if (num_cores == 2)
406 arc_set_core_freq(75 * 1000000);
407#endif 413#endif
408 414
409 switch (arc_get_core_freq()/1000000) { 415 switch (freq) {
410 case 33: 416 case 33:
411 axs103_set_freq(1, 1, 1); 417 axs103_set_freq(1, 1, 1);
412 break; 418 break;
@@ -431,11 +437,18 @@ static void __init axs103_early_init(void)
431 * DT "clock-frequency" might not match with board value. 437 * DT "clock-frequency" might not match with board value.
432 * Hence update it to match the board value. 438 * Hence update it to match the board value.
433 */ 439 */
434 arc_set_core_freq(axs103_get_freq() * 1000000); 440 freq = axs103_get_freq();
435 break; 441 break;
436 } 442 }
437 443
438 pr_info("Freq is %dMHz\n", axs103_get_freq()); 444 pr_info("Freq is %dMHz\n", freq);
445
446 /* Patching .dtb in-place with new core clock value */
447 if (freq != orig ) {
448 freq = cpu_to_be32(freq * 1000000);
449 fdt_setprop_inplace(initial_boot_params, offset,
450 "clock-frequency", &freq, sizeof(freq));
451 }
439 452
440 /* Memory maps already config in pre-bootloader */ 453 /* Memory maps already config in pre-bootloader */
441 454