diff mbox series

[U-Boot,v5,12/18] dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE flag

Message ID 20190624135052.2699-13-lukma@denx.de
State Accepted
Commit 1a961c9b32adf9915f7735758e9d9b5a68258ba5
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
If the CLK_GET_RATE_NOCACHE flag is set - the clk_get_parent_rate()
provides recalculated clock value without considering the cache setting.

This may be necessary for some clocks tightly coupled with power domains
(i.e. imx8), and prevents from reading invalid cached values.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None

 drivers/clk/clk-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefano Babic July 20, 2019, 8:46 a.m. UTC | #1
> If the CLK_GET_RATE_NOCACHE flag is set - the clk_get_parent_rate()
> provides recalculated clock value without considering the cache setting.
> This may be necessary for some clocks tightly coupled with power domains
> (i.e. imx8), and prevents from reading invalid cached values.
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 506ba6014c..5acf186b01 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -410,8 +410,8 @@  long long clk_get_parent_rate(struct clk *clk)
 	if (!ops->get_rate)
 		return -ENOSYS;
 
-	/* Read the 'rate' if not already set */
-	if (!pclk->rate)
+	/* Read the 'rate' if not already set or if proper flag set*/
+	if (!pclk->rate || pclk->flags & CLK_GET_RATE_NOCACHE)
 		pclk->rate = clk_get_rate(pclk);
 
 	return pclk->rate;