Re: [PATCH 04/22] clk: bind clk to new parent device

2020-08-04 Thread Claudiu.Beznea


On 04.08.2020 05:00, Simon Glass wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> content is safe
> 
> On Wed, 29 Jul 2020 at 08:51, Claudiu Beznea
>  wrote:
>>
>> Clock re-parenting is not binding the clock's device to its new
>> parent device, it only calls the clock's ops->set_parent() API. The
>> changes in this commit re-parent the clock device to its new parent
>> so that subsequent operations like clk_get_parent() to point to the
>> proper parent.
>>
>> Signed-off-by: Claudiu Beznea 
>> ---
>>  drivers/clk/clk-uclass.c | 11 ++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> Reviewed-by: Simon Glass 
> 
> But please add a sandbox test.

Sure!

> 
> 
>>
>> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
>> index aa1f11a27c41..b390a6b01c06 100644
>> --- a/drivers/clk/clk-uclass.c
>> +++ b/drivers/clk/clk-uclass.c
>> @@ -14,6 +14,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> @@ -511,6 +512,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate)
>>  int clk_set_parent(struct clk *clk, struct clk *parent)
>>  {
>> const struct clk_ops *ops;
>> +   int ret;
>>
>> debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);
>> if (!clk_valid(clk))
>> @@ -520,7 +522,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
>> if (!ops->set_parent)
>> return -ENOSYS;
>>
>> -   return ops->set_parent(clk, parent);
>> +   ret = ops->set_parent(clk, parent);
>> +   if (ret)
>> +   return ret;
>> +
>> +   if (CONFIG_IS_ENABLED(CLK_CCF))
>> +   ret = device_reparent(clk->dev, parent->dev);
>> +
>> +   return ret;
>>  }
>>
>>  int clk_enable(struct clk *clk)
>> --
>> 2.7.4
>>

Re: [PATCH 04/22] clk: bind clk to new parent device

2020-08-03 Thread Simon Glass
On Wed, 29 Jul 2020 at 08:51, Claudiu Beznea
 wrote:
>
> Clock re-parenting is not binding the clock's device to its new
> parent device, it only calls the clock's ops->set_parent() API. The
> changes in this commit re-parent the clock device to its new parent
> so that subsequent operations like clk_get_parent() to point to the
> proper parent.
>
> Signed-off-by: Claudiu Beznea 
> ---
>  drivers/clk/clk-uclass.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass 

But please add a sandbox test.


>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index aa1f11a27c41..b390a6b01c06 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -511,6 +512,7 @@ ulong clk_set_rate(struct clk *clk, ulong rate)
>  int clk_set_parent(struct clk *clk, struct clk *parent)
>  {
> const struct clk_ops *ops;
> +   int ret;
>
> debug("%s(clk=%p, parent=%p)\n", __func__, clk, parent);
> if (!clk_valid(clk))
> @@ -520,7 +522,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
> if (!ops->set_parent)
> return -ENOSYS;
>
> -   return ops->set_parent(clk, parent);
> +   ret = ops->set_parent(clk, parent);
> +   if (ret)
> +   return ret;
> +
> +   if (CONFIG_IS_ENABLED(CLK_CCF))
> +   ret = device_reparent(clk->dev, parent->dev);
> +
> +   return ret;
>  }
>
>  int clk_enable(struct clk *clk)
> --
> 2.7.4
>