mbox series

[v1,0/2] display proper CPU frequency on hifive-unleashed

Message ID 1582042404-27356-1-git-send-email-sagar.kadam@sifive.com
Headers show
Series display proper CPU frequency on hifive-unleashed | expand

Message

Sagar Shrikant Kadam Feb. 18, 2020, 4:13 p.m. UTC
U-Boot cmd "cpu detail" shows wrong values, as the current cpu driver is
fetching cpu_freq by reading the dt node property "clock-frequency". There
should be a fallback mechanism to handle a case where this property if not
present in DT it should be read from the prci driver.

This patch series uses the clk_get_rate method to fetch proper core clock
frequency. The series is based on U-Boot commit f2a73d6867ef ("Merge tag
'u-boot-stm32-20200214' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm")

Thanks to Vincent Chen <vincent.chen at sifive.com> for testing this patch.

=>-----------------------Log for reference------------------------
=> cpu detail
  0: cpu at 1      rv64imafdc
        ID = 1, freq = 4.30 GHz		<= Before patch
  1: cpu at 2      rv64imafdc
        ID = 2, freq = 4.30 GHz
  2: cpu at 3      rv64imafdc
        ID = 3, freq = 4.30 GHz
  3: cpu at 4      rv64imafdc
        ID = 4, freq = 4.30 GHz
.................................................................

=> cpu detail
  0: cpu at 1      rv64imafdc
        ID = 1, freq = 999.100 MHz	<= After patch
  1: cpu at 2      rv64imafdc
        ID = 2, freq = 999.100 MHz
  2: cpu at 3      rv64imafdc
        ID = 3, freq = 999.100 MHz
  3: cpu at 4      rv64imafdc
        ID = 4, freq = 999.100 MHz


Sagar Shrikant Kadam (2):
  fu540: prci: add request and free clock handlers
  cpu: clk: riscv: populate proper CPU core clk frequency

 drivers/clk/sifive/fu540-prci.c | 24 ++++++++++++++++++++++++
 drivers/cpu/riscv_cpu.c         | 39 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 1 deletion(-)