public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] imx8qxp: Fix the reported CPU frequency
@ 2019-02-05 12:43 Fabio Estevam
  2019-02-21 10:35 ` Fabio Estevam
  2019-03-06 15:37 ` [U-Boot] " Andrejs Cainikovs
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2019-02-05 12:43 UTC (permalink / raw)
  To: u-boot

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>
---
 arch/arm/mach-imx/imx8/cpu.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 7539e45652..4bbc956f9d 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;
 }
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] imx8qxp: Fix the reported CPU frequency
  2019-02-05 12:43 [U-Boot] [PATCH] imx8qxp: Fix the reported CPU frequency Fabio Estevam
@ 2019-02-21 10:35 ` Fabio Estevam
  2019-03-06 15:37 ` [U-Boot] " Andrejs Cainikovs
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2019-02-21 10:35 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On Tue, Feb 5, 2019 at 10:43 AM Fabio Estevam <festevam@gmail.com> wrote:
>
> 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>

Could you please consider this one for 2019.04?

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] imx8qxp: Fix the reported CPU frequency
  2019-02-05 12:43 [U-Boot] [PATCH] imx8qxp: Fix the reported CPU frequency Fabio Estevam
  2019-02-21 10:35 ` Fabio Estevam
@ 2019-03-06 15:37 ` Andrejs Cainikovs
  1 sibling, 0 replies; 3+ messages in thread
From: Andrejs Cainikovs @ 2019-03-06 15:37 UTC (permalink / raw)
  To: u-boot

Tested-by: Andrejs Cainikovs <andrejs.cainikovs@netmodule.com>

 > Could you please consider this one for 2019.04?

Ditto, I would like to have this in upcoming release as well. Thanks,

Best regards,
Andresjs Cainikovs.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-06 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-05 12:43 [U-Boot] [PATCH] imx8qxp: Fix the reported CPU frequency Fabio Estevam
2019-02-21 10:35 ` Fabio Estevam
2019-03-06 15:37 ` [U-Boot] " Andrejs Cainikovs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox