diff mbox series

[U-Boot,v5,04/18] clk: Extend struct clk to provide information regarding clock rate

Message ID 20190624135052.2699-5-lukma@denx.de
State Accepted
Commit 105db9593eb53ab85a48bcc2187ff8770b7958ec
Delegated to: Stefano Babic
Headers show
Series clk: Port Linux common clock framework [CCF] to U-boot (tag: v5.1.12) | expand

Commit Message

Lukasz Majewski June 24, 2019, 1:50 p.m. UTC
This commit extends the struct clk to provide information regarding the
clock rate.
As a result the clock tree traversal is performed at most once, and further
reads are using the cached value.

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

Changes in v6: None
Changes in v5:
- Use long long to store rate value (to avoid int overflow and also return
  errors correctly)

Changes in v4: None
Changes in v3: None

 include/clk.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stefano Babic July 20, 2019, 8:51 a.m. UTC | #1
> This commit extends the struct clk to provide information regarding the
> clock rate.
> As a result the clock tree traversal is performed at most once, and further
> reads are using the cached value.
> Signed-off-by: Lukasz Majewski <lukma@denx.de>

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/include/clk.h b/include/clk.h
index a909b71f1a..d7b937ca7b 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -40,6 +40,7 @@  struct udevice;
  * other clock APIs to identify which clock signal to operate upon.
  *
  * @dev: The device which implements the clock signal.
+ * @rate: The clock rate (in HZ).
  * @id: The clock signal ID within the provider.
  * @data: An optional data field for scenarios where a single integer ID is not
  *	  sufficient. If used, it can be populated through an .of_xlate op and
@@ -55,6 +56,7 @@  struct udevice;
  */
 struct clk {
 	struct udevice *dev;
+	long long rate;	/* in HZ */
 	/*
 	 * Written by of_xlate. In the future, we might add more fields here.
 	 */