summaryrefslogtreecommitdiffstats
path: root/arch/arc/plat-axs10x
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-01-01 18:48:40 +0530
committerVineet Gupta <vgupta@synopsys.com>2016-05-09 09:32:29 +0530
commitb3d6aba8bd92c20b7748ccd82b6fab8ea5081066 (patch)
treea57a0638e523f00058fcee800b755c44a74b3ec9 /arch/arc/plat-axs10x
parent9ba7648cc9b363dd5597caf68968502493996ce5 (diff)
downloadlinux-b3d6aba8bd92c20b7748ccd82b6fab8ea5081066.tar.bz2
ARC: [dts] Add clk feeding into timers to DTs
This allows us to introduce timers in DT in next commit The core clk frequency hack in AXS103 platform is also extended, where the core clk feeding into timers is updated in-place in FDT. Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/plat-axs10x')
-rw-r--r--arch/arc/plat-axs10x/axs10x.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/arc/plat-axs10x/axs10x.c b/arch/arc/plat-axs10x/axs10x.c
index 8e7f50a8b857..f90fac271d16 100644
--- a/arch/arc/plat-axs10x/axs10x.c
+++ b/arch/arc/plat-axs10x/axs10x.c
@@ -14,7 +14,9 @@
*
*/
+#include <linux/of_fdt.h>
#include <linux/of_platform.h>
+#include <linux/libfdt.h>
#include <asm/asm-offsets.h>
#include <asm/clk.h>
@@ -389,7 +391,12 @@ axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od)
static void __init axs103_early_init(void)
{
- u32 freq = arc_get_core_freq(), orig = freq;
+ int offset = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk");
+ const struct fdt_property *prop = fdt_get_property(initial_boot_params,
+ offset,
+ "clock-frequency",
+ NULL);
+ u32 freq = be32_to_cpu(*(u32*)(prop->data)) / 1000000, orig = freq;
/*
* AXS103 configurations for SMP/QUAD configurations share device tree
@@ -438,8 +445,13 @@ static void __init axs103_early_init(void)
}
pr_info("Freq is %dMHz\n", freq);
+
+ /* Patching .dtb in-place with new core clock value */
if (freq != orig ) {
arc_set_core_freq(freq * 1000000);
+ freq = cpu_to_be32(freq * 1000000);
+ fdt_setprop_inplace(initial_boot_params, offset,
+ "clock-frequency", &freq, sizeof(freq));
}
/* Memory maps already config in pre-bootloader */