diff options
author | Fabio Estevam <festevam@gmail.com> | 2019-02-05 10:43:26 -0200 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2019-03-13 09:14:35 +0100 |
commit | 75cd09cb18592896abf91bc7530ea28f6b17ec77 (patch) | |
tree | bab2d959d00a71f7c7defc7a4d3a2c7d0cd37e9f /arch/arm | |
parent | f6c3a9136b094ce659897bd024aca6178bfc4955 (diff) | |
download | u-boot-75cd09cb18592896abf91bc7530ea28f6b17ec77.zip u-boot-75cd09cb18592896abf91bc7530ea28f6b17ec77.tar.gz u-boot-75cd09cb18592896abf91bc7530ea28f6b17ec77.tar.bz2 |
imx8qxp: Fix the reported CPU frequency
Currently the CPU frequency is incorrectly reported:
CPU: NXP i.MX8QXP RevB A35 at 147228 MHz
Fix this problem by using a direct call to the SCU firmware to
retrieve the Cortex A35 CPU frequency.
With this change applied the CPU frequency is displayed correctly:
CPU: NXP i.MX8QXP RevB A35 at 1200 MHz
Tested-by: Marcelo Macedo <marcelo.macedo@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Andrejs Cainikovs <andrejs.cainikovs@netmodule.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/imx8/cpu.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c index 7539e45..4bbc956 100644 --- a/arch/arm/mach-imx/imx8/cpu.c +++ b/arch/arm/mach-imx/imx8/cpu.c @@ -616,26 +616,32 @@ static const struct udevice_id cpu_imx8_ids[] = { { } }; +static ulong imx8_get_cpu_rate(void) +{ + ulong rate; + int ret; + + ret = sc_pm_get_clock_rate(-1, SC_R_A35, SC_PM_CLK_CPU, + (sc_pm_clock_rate_t *)&rate); + if (ret) { + printf("Could not read CPU frequency: %d\n", ret); + return 0; + } + + return rate; +} + static int imx8_cpu_probe(struct udevice *dev) { struct cpu_imx_platdata *plat = dev_get_platdata(dev); - struct clk cpu_clk; u32 cpurev; - int ret; cpurev = get_cpu_rev(); plat->cpurev = cpurev; plat->name = get_core_name(); plat->rev = get_imx8_rev(cpurev & 0xFFF); plat->type = get_imx8_type((cpurev & 0xFF000) >> 12); - - ret = clk_get_by_index(dev, 0, &cpu_clk); - if (ret) { - debug("%s: Failed to get CPU clk: %d\n", __func__, ret); - return 0; - } - - plat->freq_mhz = clk_get_rate(&cpu_clk) / 1000000; + plat->freq_mhz = imx8_get_cpu_rate() / 1000000; return 0; } |