aboutsummaryrefslogtreecommitdiff
path: root/board/synopsys
diff options
context:
space:
mode:
authorAlexey Brodkin <abrodkin@synopsys.com>2018-10-10 16:15:20 +0300
committerAlexey Brodkin <abrodkin@synopsys.com>2018-10-12 15:14:41 +0300
commit8a8f32d8ff9db59fc3dccbc4da83dd78e13d9c3e (patch)
treea44860181a661dbe0620b5787d9da965bda156fa /board/synopsys
parent031154fe8f2b1b6b2a6e2d1449676a8c6dc42ebf (diff)
downloadu-boot-8a8f32d8ff9db59fc3dccbc4da83dd78e13d9c3e.zip
u-boot-8a8f32d8ff9db59fc3dccbc4da83dd78e13d9c3e.tar.gz
u-boot-8a8f32d8ff9db59fc3dccbc4da83dd78e13d9c3e.tar.bz2
iot_dk: Save CPU clock value to gd->cpu_clk
Since gd->cpu_clk is a global item we may once populate it from .dtb ans use it then in other places like for printing CPU info etc. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Diffstat (limited to 'board/synopsys')
-rw-r--r--board/synopsys/iot_devkit/iot_devkit.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/board/synopsys/iot_devkit/iot_devkit.c b/board/synopsys/iot_devkit/iot_devkit.c
index 04e003c..40c29e7 100644
--- a/board/synopsys/iot_devkit/iot_devkit.c
+++ b/board/synopsys/iot_devkit/iot_devkit.c
@@ -108,7 +108,7 @@ extern u8 __ram_end[];
*/
int mach_cpu_init(void)
{
- int offset, freq;
+ int offset;
/* Don't relocate U-Boot */
gd->flags |= GD_FLG_SKIP_RELOC;
@@ -129,12 +129,12 @@ int mach_cpu_init(void)
if (offset < 0)
return offset;
- freq = fdtdec_get_int(gd->fdt_blob, offset, "clock-frequency", 0);
- if (!freq)
+ gd->cpu_clk = fdtdec_get_int(gd->fdt_blob, offset, "clock-frequency", 0);
+ if (!gd->cpu_clk)
return -EINVAL;
/* If CPU freq > 100 MHz, divide eFLASH clock by 2 */
- if (freq > 100000000) {
+ if (gd->cpu_clk > 100000000) {
u32 reg = readl(AHBCKDIV);
reg &= ~(0xF << 8);
@@ -142,7 +142,7 @@ int mach_cpu_init(void)
writel(reg, AHBCKDIV);
}
- return set_cpu_freq(freq);
+ return set_cpu_freq(gd->cpu_clk);
}
#define ARC_PERIPHERAL_BASE 0xF0000000
@@ -186,7 +186,9 @@ int checkboard(void)
#ifdef CONFIG_DISPLAY_CPUINFO
int print_cpuinfo(void)
{
- printf("CPU: ARC EM9D\n");
+ char mhz[8];
+
+ printf("CPU: ARC EM9D at %s MHz\n", strmhz(mhz, gd->cpu_clk));
return 0;
}
#endif /* CONFIG_DISPLAY_CPUINFO */