diff mbox series

[U-Boot,01/16] clk: introduce clk_dev_binded

Message ID 20190723033031.12404-1-peng.fan@nxp.com
State Superseded
Delegated to: Lukasz Majewski
Headers show
Series [U-Boot,01/16] clk: introduce clk_dev_binded | expand

Commit Message

Peng Fan July 23, 2019, 3:15 a.m. UTC
When support Clock Common Framework, U-Boot use dev for
clk tree information, there is no clk->parent. When
support composite clk, it contains mux/gate/divider,
but the mux/gate/divider is not binded with device.
So we could not use dev_get_uclass_priv to get the correct
clk_mux/gate/divider. So add clk_dev_binded to let
choose the correct method.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)

Comments

Peng Fan July 29, 2019, 8:31 a.m. UTC | #1
Hi Lukasz,

> Subject: [PATCH 01/16] clk: introduce clk_dev_binded

Do you have time to review the patchset? Patches were delegated to you.

Thanks,
Peng.

> 
> When support Clock Common Framework, U-Boot use dev for clk tree
> information, there is no clk->parent. When support composite clk, it contains
> mux/gate/divider, but the mux/gate/divider is not binded with device.
> So we could not use dev_get_uclass_priv to get the correct
> clk_mux/gate/divider. So add clk_dev_binded to let choose the correct
> method.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/clk/clk.c | 8 ++++++++
>  include/clk.h     | 9 +++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 7d748c9fc7..39b3087067
> 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk *hw)
> {
>  	return hw->dev->name;
>  }
> +
> +bool clk_dev_binded(struct clk *clk)
> +{
> +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> +		return true;
> +
> +	return false;
> +}
> diff --git a/include/clk.h b/include/clk.h index f8f56d9cf0..2ebc905e04
> 100644
> --- a/include/clk.h
> +++ b/include/clk.h
> @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
>   * @return zero on success, or -ENOENT on error
>   */
>  int clk_get_by_id(ulong id, struct clk **clkp);
> +
> +/**
> + * clk_dev_binded() - Check whether the clk has a device binded
> + *
> + * @clk		A pointer to the clk
> + *
> + * @return true on binded, or false on no  */ bool
> +clk_dev_binded(struct clk *clk);
>  #endif
> --
> 2.16.4
Lukasz Majewski July 29, 2019, 8:57 a.m. UTC | #2
Hi Peng,

> Hi Lukasz,
> 
> > Subject: [PATCH 01/16] clk: introduce clk_dev_binded  
> 
> Do you have time to review the patchset? Patches were delegated to
> you.

The i.MX related PR (with base CCF) has been pulled to mainline just
yesteday, so I'm going to rewiew and test your code on top of it (with
buildman) today.

I shall send PR for -clk tomorrow.

Thanks for your patches.

> 
> Thanks,
> Peng.
> 
> > 
> > When support Clock Common Framework, U-Boot use dev for clk tree
> > information, there is no clk->parent. When support composite clk,
> > it contains mux/gate/divider, but the mux/gate/divider is not
> > binded with device. So we could not use dev_get_uclass_priv to get
> > the correct clk_mux/gate/divider. So add clk_dev_binded to let
> > choose the correct method.
> > 
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/clk/clk.c | 8 ++++++++
> >  include/clk.h     | 9 +++++++++
> >  2 files changed, 17 insertions(+)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index
> > 7d748c9fc7..39b3087067 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk *hw)
> > {
> >  	return hw->dev->name;
> >  }
> > +
> > +bool clk_dev_binded(struct clk *clk)
> > +{
> > +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> > +		return true;
> > +
> > +	return false;
> > +}
> > diff --git a/include/clk.h b/include/clk.h index
> > f8f56d9cf0..2ebc905e04 100644
> > --- a/include/clk.h
> > +++ b/include/clk.h
> > @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
> >   * @return zero on success, or -ENOENT on error
> >   */
> >  int clk_get_by_id(ulong id, struct clk **clkp);
> > +
> > +/**
> > + * clk_dev_binded() - Check whether the clk has a device binded
> > + *
> > + * @clk		A pointer to the clk
> > + *
> > + * @return true on binded, or false on no  */ bool
> > +clk_dev_binded(struct clk *clk);
> >  #endif
> > --
> > 2.16.4  
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Peng Fan July 29, 2019, 8:59 a.m. UTC | #3
> Subject: Re: [PATCH 01/16] clk: introduce clk_dev_binded
> 
> Hi Peng,
> 
> > Hi Lukasz,
> >
> > > Subject: [PATCH 01/16] clk: introduce clk_dev_binded
> >
> > Do you have time to review the patchset? Patches were delegated to
> > you.
> 
> The i.MX related PR (with base CCF) has been pulled to mainline just yesteday,
> so I'm going to rewiew and test your code on top of it (with
> buildman) today.

Thanks very much.

Thanks,
Peng.

> 
> I shall send PR for -clk tomorrow.
> 
> Thanks for your patches.
> 
> >
> > Thanks,
> > Peng.
> >
> > >
> > > When support Clock Common Framework, U-Boot use dev for clk tree
> > > information, there is no clk->parent. When support composite clk, it
> > > contains mux/gate/divider, but the mux/gate/divider is not binded
> > > with device. So we could not use dev_get_uclass_priv to get the
> > > correct clk_mux/gate/divider. So add clk_dev_binded to let choose
> > > the correct method.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/clk/clk.c | 8 ++++++++
> > >  include/clk.h     | 9 +++++++++
> > >  2 files changed, 17 insertions(+)
> > >
> > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index
> > > 7d748c9fc7..39b3087067 100644
> > > --- a/drivers/clk/clk.c
> > > +++ b/drivers/clk/clk.c
> > > @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk
> *hw)
> > > {
> > >  	return hw->dev->name;
> > >  }
> > > +
> > > +bool clk_dev_binded(struct clk *clk) {
> > > +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> > > +		return true;
> > > +
> > > +	return false;
> > > +}
> > > diff --git a/include/clk.h b/include/clk.h index
> > > f8f56d9cf0..2ebc905e04 100644
> > > --- a/include/clk.h
> > > +++ b/include/clk.h
> > > @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
> > >   * @return zero on success, or -ENOENT on error
> > >   */
> > >  int clk_get_by_id(ulong id, struct clk **clkp);
> > > +
> > > +/**
> > > + * clk_dev_binded() - Check whether the clk has a device binded
> > > + *
> > > + * @clk		A pointer to the clk
> > > + *
> > > + * @return true on binded, or false on no  */ bool
> > > +clk_dev_binded(struct clk *clk);
> > >  #endif
> > > --
> > > 2.16.4
> >
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Lukasz Majewski July 30, 2019, 6:58 a.m. UTC | #4
Hi Peng,

> Hi Peng,
> 
> > Hi Lukasz,
> >   
> > > Subject: [PATCH 01/16] clk: introduce clk_dev_binded    
> > 
> > Do you have time to review the patchset? Patches were delegated to
> > you.  
> 
> The i.MX related PR (with base CCF) has been pulled to mainline just
> yesteday, so I'm going to rewiew and test your code on top of it (with
> buildman) today.
> 
> I shall send PR for -clk tomorrow.
> 

The patches from this series causes the sandbox travis-ci to break:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/565204559

Please fix those errors.

You can also reproduce this issue with:

./tools/buildman/buildman.py --branch=HEAD sandbox  --show_errors
--force-build --count=16 --output-dir=../BUILD/

run on this series.

> Thanks for your patches.
> 
> > 
> > Thanks,
> > Peng.
> >   
> > > 
> > > When support Clock Common Framework, U-Boot use dev for clk tree
> > > information, there is no clk->parent. When support composite clk,
> > > it contains mux/gate/divider, but the mux/gate/divider is not
> > > binded with device. So we could not use dev_get_uclass_priv to get
> > > the correct clk_mux/gate/divider. So add clk_dev_binded to let
> > > choose the correct method.
> > > 
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  drivers/clk/clk.c | 8 ++++++++
> > >  include/clk.h     | 9 +++++++++
> > >  2 files changed, 17 insertions(+)
> > > 
> > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index
> > > 7d748c9fc7..39b3087067 100644
> > > --- a/drivers/clk/clk.c
> > > +++ b/drivers/clk/clk.c
> > > @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk
> > > *hw) {
> > >  	return hw->dev->name;
> > >  }
> > > +
> > > +bool clk_dev_binded(struct clk *clk)
> > > +{
> > > +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> > > +		return true;
> > > +
> > > +	return false;
> > > +}
> > > diff --git a/include/clk.h b/include/clk.h index
> > > f8f56d9cf0..2ebc905e04 100644
> > > --- a/include/clk.h
> > > +++ b/include/clk.h
> > > @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
> > >   * @return zero on success, or -ENOENT on error
> > >   */
> > >  int clk_get_by_id(ulong id, struct clk **clkp);
> > > +
> > > +/**
> > > + * clk_dev_binded() - Check whether the clk has a device binded
> > > + *
> > > + * @clk		A pointer to the clk
> > > + *
> > > + * @return true on binded, or false on no  */ bool
> > > +clk_dev_binded(struct clk *clk);
> > >  #endif
> > > --
> > > 2.16.4    
> >   
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Peng Fan July 30, 2019, 7:01 a.m. UTC | #5
Hi Lukasz,
> Subject: Re: [PATCH 01/16] clk: introduce clk_dev_binded
> 
> Hi Peng,
> 
> > Hi Peng,
> >
> > > Hi Lukasz,
> > >
> > > > Subject: [PATCH 01/16] clk: introduce clk_dev_binded
> > >
> > > Do you have time to review the patchset? Patches were delegated to
> > > you.
> >
> > The i.MX related PR (with base CCF) has been pulled to mainline just
> > yesteday, so I'm going to rewiew and test your code on top of it (with
> > buildman) today.
> >
> > I shall send PR for -clk tomorrow.
> >
> 
> The patches from this series causes the sandbox travis-ci to break:
> https://travis-ci.org/lmajewski/u-boot-dfu/builds/565204559

I ran qcheck before posting patches.

> 
> Please fix those errors.
> 
> You can also reproduce this issue with:
> 
> ./tools/buildman/buildman.py --branch=HEAD sandbox  --show_errors
> --force-build --count=16 --output-dir=../BUILD/

I'll fix soon.

Thanks,
Peng.

> 
> run on this series.
> 
> > Thanks for your patches.
> >
> > >
> > > Thanks,
> > > Peng.
> > >
> > > >
> > > > When support Clock Common Framework, U-Boot use dev for clk tree
> > > > information, there is no clk->parent. When support composite clk,
> > > > it contains mux/gate/divider, but the mux/gate/divider is not
> > > > binded with device. So we could not use dev_get_uclass_priv to get
> > > > the correct clk_mux/gate/divider. So add clk_dev_binded to let
> > > > choose the correct method.
> > > >
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > >  drivers/clk/clk.c | 8 ++++++++
> > > >  include/clk.h     | 9 +++++++++
> > > >  2 files changed, 17 insertions(+)
> > > >
> > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index
> > > > 7d748c9fc7..39b3087067 100644
> > > > --- a/drivers/clk/clk.c
> > > > +++ b/drivers/clk/clk.c
> > > > @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk
> > > > *hw) {
> > > >  	return hw->dev->name;
> > > >  }
> > > > +
> > > > +bool clk_dev_binded(struct clk *clk) {
> > > > +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> > > > +		return true;
> > > > +
> > > > +	return false;
> > > > +}
> > > > diff --git a/include/clk.h b/include/clk.h index
> > > > f8f56d9cf0..2ebc905e04 100644
> > > > --- a/include/clk.h
> > > > +++ b/include/clk.h
> > > > @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
> > > >   * @return zero on success, or -ENOENT on error
> > > >   */
> > > >  int clk_get_by_id(ulong id, struct clk **clkp);
> > > > +
> > > > +/**
> > > > + * clk_dev_binded() - Check whether the clk has a device binded
> > > > + *
> > > > + * @clk		A pointer to the clk
> > > > + *
> > > > + * @return true on binded, or false on no  */ bool
> > > > +clk_dev_binded(struct clk *clk);
> > > >  #endif
> > > > --
> > > > 2.16.4
> > >
> >
> >
> >
> >
> > Best regards,
> >
> > Lukasz Majewski
> >
> > --
> >
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de
Peng Fan July 30, 2019, 7:54 a.m. UTC | #6
Hi Lukasz,

> Subject: RE: [PATCH 01/16] clk: introduce clk_dev_binded
> 
> 
> Hi Lukasz,
> > Subject: Re: [PATCH 01/16] clk: introduce clk_dev_binded
> >
> > Hi Peng,
> >
> > > Hi Peng,
> > >
> > > > Hi Lukasz,
> > > >
> > > > > Subject: [PATCH 01/16] clk: introduce clk_dev_binded
> > > >
> > > > Do you have time to review the patchset? Patches were delegated to
> > > > you.
> > >
> > > The i.MX related PR (with base CCF) has been pulled to mainline just
> > > yesteday, so I'm going to rewiew and test your code on top of it
> > > (with
> > > buildman) today.
> > >
> > > I shall send PR for -clk tomorrow.
> > >
> >
> > The patches from this series causes the sandbox travis-ci to break:
> > https://travis-ci.org/lmajewski/u-boot-dfu/builds/565204559
> 
> I ran qcheck before posting patches.

Missed a build warning when ran qcheck.

It was divider_recalc_rate missed add to clk-provider.h.
Just posted out v2.

Thanks,
Peng.

> 
> >
> > Please fix those errors.
> >
> > You can also reproduce this issue with:
> >
> > ./tools/buildman/buildman.py --branch=HEAD sandbox  --show_errors
> > --force-build --count=16 --output-dir=../BUILD/
> 
> I'll fix soon.
> 
> Thanks,
> Peng.
> 
> >
> > run on this series.
> >
> > > Thanks for your patches.
> > >
> > > >
> > > > Thanks,
> > > > Peng.
> > > >
> > > > >
> > > > > When support Clock Common Framework, U-Boot use dev for clk tree
> > > > > information, there is no clk->parent. When support composite
> > > > > clk, it contains mux/gate/divider, but the mux/gate/divider is
> > > > > not binded with device. So we could not use dev_get_uclass_priv
> > > > > to get the correct clk_mux/gate/divider. So add clk_dev_binded
> > > > > to let choose the correct method.
> > > > >
> > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > > ---
> > > > >  drivers/clk/clk.c | 8 ++++++++
> > > > >  include/clk.h     | 9 +++++++++
> > > > >  2 files changed, 17 insertions(+)
> > > > >
> > > > > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index
> > > > > 7d748c9fc7..39b3087067 100644
> > > > > --- a/drivers/clk/clk.c
> > > > > +++ b/drivers/clk/clk.c
> > > > > @@ -55,3 +55,11 @@ const char *clk_hw_get_name(const struct clk
> > > > > *hw) {
> > > > >  	return hw->dev->name;
> > > > >  }
> > > > > +
> > > > > +bool clk_dev_binded(struct clk *clk) {
> > > > > +	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
> > > > > +		return true;
> > > > > +
> > > > > +	return false;
> > > > > +}
> > > > > diff --git a/include/clk.h b/include/clk.h index
> > > > > f8f56d9cf0..2ebc905e04 100644
> > > > > --- a/include/clk.h
> > > > > +++ b/include/clk.h
> > > > > @@ -356,4 +356,13 @@ static inline bool clk_valid(struct clk *clk)
> > > > >   * @return zero on success, or -ENOENT on error
> > > > >   */
> > > > >  int clk_get_by_id(ulong id, struct clk **clkp);
> > > > > +
> > > > > +/**
> > > > > + * clk_dev_binded() - Check whether the clk has a device binded
> > > > > + *
> > > > > + * @clk		A pointer to the clk
> > > > > + *
> > > > > + * @return true on binded, or false on no  */ bool
> > > > > +clk_dev_binded(struct clk *clk);
> > > > >  #endif
> > > > > --
> > > > > 2.16.4
> > > >
> > >
> > >
> > >
> > >
> > > Best regards,
> > >
> > > Lukasz Majewski
> > >
> > > --
> > >
> > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk
> > > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > > Germany
> > > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > > lukma@denx.de
> >
> >
> >
> >
> > Best regards,
> >
> > Lukasz Majewski
> >
> > --
> >
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma@denx.de
diff mbox series

Patch

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 7d748c9fc7..39b3087067 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -55,3 +55,11 @@  const char *clk_hw_get_name(const struct clk *hw)
 {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk)
+{
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
diff --git a/include/clk.h b/include/clk.h
index f8f56d9cf0..2ebc905e04 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -356,4 +356,13 @@  static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no
+ */
+bool clk_dev_binded(struct clk *clk);
 #endif