Message ID | 20190821135056.27052-1-peng.fan@nxp.com |
---|---|
State | Accepted |
Commit | e6849e2fd88f16d9592059422173f7f6ab790e07 |
Delegated to: | Lukasz Majewski |
Headers | show |
Series | [U-Boot,V3,1/4] clk: introduce enable_count | expand |
Hi Peng, On Wed, 21 Aug 2019 at 07:35, Peng Fan <peng.fan@nxp.com> wrote: > > As what Linux Kernel 5.3.0 provides when enable/disable clk, > there is an enable_count in clk_core_disable/enable. Introduce > enable_count to track the clk enable/disable count when > clk_enable/disable for CCF. And Initialize enable_count to 0 when > register the clk. > > And clk tree dump with enable_count will be supported, it will > be easy for us to check the clk status with enable_count > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > > V3: > None > CI: https://travis-ci.org/MrVan/u-boot/builds/574753709 > V2: > Improve commit log > Rename enable_cnt to enable_count following Linux Kernel > > drivers/clk/clk.c | 1 + > drivers/clk/clk_fixed_rate.c | 1 + > include/clk.h | 1 + > 3 files changed, 3 insertions(+) Reviewed-by: Simon Glass <sjg@chromium.org> Do you think it would be worth making this a u8 to save space? Or perhaps this feature could be optional? Regards, Simon
Hi Simon, > Subject: Re: [PATCH V3 1/4] clk: introduce enable_count > > Hi Peng, > > On Wed, 21 Aug 2019 at 07:35, Peng Fan <peng.fan@nxp.com> wrote: > > > > As what Linux Kernel 5.3.0 provides when enable/disable clk, there is > > an enable_count in clk_core_disable/enable. Introduce enable_count to > > track the clk enable/disable count when clk_enable/disable for CCF. > > And Initialize enable_count to 0 when register the clk. > > > > And clk tree dump with enable_count will be supported, it will be easy > > for us to check the clk status with enable_count > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > > > V3: > > None > > CI: > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftrav > > > is-ci.org%2FMrVan%2Fu-boot%2Fbuilds%2F574753709&data=02%7C01 > %7Cpen > > > g.fan%40nxp.com%7C626abf64d2f8431f2bcc08d72813bbb2%7C686ea1d3bc > 2b4c6fa > > > 92cd99c5c301635%7C0%7C0%7C637021937522749993&sdata=PQs59S > 1gAK8P%2B > > HGOfXKweJlVHqKGJDZ11jM%2F45%2BCz7E%3D&reserved=0 > > V2: > > Improve commit log > > Rename enable_cnt to enable_count following Linux Kernel > > > > drivers/clk/clk.c | 1 + > > drivers/clk/clk_fixed_rate.c | 1 + > > include/clk.h | 1 + > > 3 files changed, 3 insertions(+) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > Do you think it would be worth making this a u8 to save space? The structured is not marked __packed, so u8 would not save space. > > Or perhaps this feature could be optional? I'll try. Thanks, Peng. > > Regards, > Simon
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 39b3087067..1cf9987f6c 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_count = 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..f51126793e 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_count = 0; return 0; } diff --git a/include/clk.h b/include/clk.h index 3ca2796b57..18b2e3ca54 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_count; /* * Written by of_xlate. In the future, we might add more fields here. */
As what Linux Kernel 5.3.0 provides when enable/disable clk, there is an enable_count in clk_core_disable/enable. Introduce enable_count to track the clk enable/disable count when clk_enable/disable for CCF. And Initialize enable_count to 0 when register the clk. And clk tree dump with enable_count will be supported, it will be easy for us to check the clk status with enable_count Signed-off-by: Peng Fan <peng.fan@nxp.com> --- V3: None CI: https://travis-ci.org/MrVan/u-boot/builds/574753709 V2: Improve commit log Rename enable_cnt to enable_count following Linux Kernel drivers/clk/clk.c | 1 + drivers/clk/clk_fixed_rate.c | 1 + include/clk.h | 1 + 3 files changed, 3 insertions(+)