[U-Boot] [PATCH 1/3] clk: introduce enable_cnt

Peng Fan peng.fan at nxp.com
Fri Aug 16 08:10:07 UTC 2019


Introduce enable_cnt to track the clk enable/disable count when
clk_enable/disable for CCF.
And Initialize enable_cnt to 0 when register the clk.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/clk/clk.c            | 1 +
 drivers/clk/clk_fixed_rate.c | 1 +
 include/clk.h                | 1 +
 3 files changed, 3 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 39b3087067..7effd410ee 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -40,6 +40,7 @@ int clk_register(struct clk *clk, const char *drv_name,
 		return ret;
 	}
 
+	clk->enable_cnt = 0;
 	/* Store back pointer to clk from udevice */
 	clk->dev->uclass_priv = clk;
 
diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 08cce0d79b..6b89fad46b 100644
--- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c
@@ -27,6 +27,7 @@ static int clk_fixed_rate_ofdata_to_platdata(struct udevice *dev)
 	/* Make fixed rate clock accessible from higher level struct clk */
 	dev->uclass_priv = clk;
 	clk->dev = dev;
+	clk->enable_cnt = 0;
 
 	return 0;
 }
diff --git a/include/clk.h b/include/clk.h
index 2ebc905e04..58e456898f 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -61,6 +61,7 @@ struct clk {
 	struct udevice *dev;
 	long long rate;	/* in HZ */
 	u32 flags;
+	int enable_cnt;
 	/*
 	 * Written by of_xlate. In the future, we might add more fields here.
 	 */
-- 
2.16.4



More information about the U-Boot mailing list