Re: [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan

2017-08-08 Thread Patrice CHOTARD
Hi Simon

On 08/06/2017 07:16 AM, Simon Glass wrote:
> Hi Patrice,
> 
> On 31 July 2017 at 09:12,   wrote:
>> From: Patrice Chotard 
>>
>> Currently, all fixed-clock declared in "clocks" node in device tree
>> can be binded by clk_fixed_rate.c driver only if the "simple-bus"
>> compatible string is set inside "clocks" node.
>> This constraint has been invoked here [1].
>>
>> This patch offers a solution to avoid adding "simple-bus" compatible
>> string to "clocks" node.
>>
>> [1] https://patchwork.ozlabs.org/patch/558837/
>>
>> Signed-off-by: Patrice Chotard 
>> ---
>>   drivers/core/root.c | 13 +
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>> index d691d6f..f285df8 100644
>> --- a/drivers/core/root.c
>> +++ b/drivers/core/root.c
>> @@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
>>   #endif
>>  return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
>>   }
>> +#else
>> +static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>> +   int offset, bool pre_reloc_only)
>> +{
>> +   return 0;
>> +}
>>   #endif
>>
>>   __weak int dm_scan_other(bool pre_reloc_only)
>> @@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
>>   int dm_init_and_scan(bool pre_reloc_only)
>>   {
>>  int ret;
>> +   int node;
>>
>>  ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
>>  if (ret) {
>> @@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
>>  debug("dm_scan_fdt() failed: %d\n", ret);
>>  return ret;
>>  }
>> +
>> +   /* bind fixed-clock */
>> +   node = fdt_path_offset(gd->fdt_blob, "/clocks");
> 
> This needs to support livetree, so I think you want ofnode_path() here.

Yes, i will update it

> 
>> +   if (node >= 0)
>> +   dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>> +pre_reloc_only);
> 
> See dm_scan_fdt() for what you need to do here.

I have no choice, i need to use dm_scan_fdt_node() with clocks node's 
offset to force dt scan of clocks node to ensure that all its sub-node 
will be binded.

> 
>>  }
>>
>>  ret = dm_scan_other(pre_reloc_only);
>> --
>> 1.9.1
>>
> 
> Also please can you make sandbox have a clock in this node, and add a
> test for it to test/dm/clk.c ?

yes, sure

> 
> Regards,
> Simon

Thanks

Patrice

> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 1/1] dm: core: add clocks node scan

2017-08-05 Thread Simon Glass
Hi Patrice,

On 31 July 2017 at 09:12,   wrote:
> From: Patrice Chotard 
>
> Currently, all fixed-clock declared in "clocks" node in device tree
> can be binded by clk_fixed_rate.c driver only if the "simple-bus"
> compatible string is set inside "clocks" node.
> This constraint has been invoked here [1].
>
> This patch offers a solution to avoid adding "simple-bus" compatible
> string to "clocks" node.
>
> [1] https://patchwork.ozlabs.org/patch/558837/
>
> Signed-off-by: Patrice Chotard 
> ---
>  drivers/core/root.c | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index d691d6f..f285df8 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -312,6 +312,12 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
>  #endif
> return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
>  }
> +#else
> +static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
> +   int offset, bool pre_reloc_only)
> +{
> +   return 0;
> +}
>  #endif
>
>  __weak int dm_scan_other(bool pre_reloc_only)
> @@ -322,6 +328,7 @@ __weak int dm_scan_other(bool pre_reloc_only)
>  int dm_init_and_scan(bool pre_reloc_only)
>  {
> int ret;
> +   int node;
>
> ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE));
> if (ret) {
> @@ -340,6 +347,12 @@ int dm_init_and_scan(bool pre_reloc_only)
> debug("dm_scan_fdt() failed: %d\n", ret);
> return ret;
> }
> +
> +   /* bind fixed-clock */
> +   node = fdt_path_offset(gd->fdt_blob, "/clocks");

This needs to support livetree, so I think you want ofnode_path() here.

> +   if (node >= 0)
> +   dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
> +pre_reloc_only);

See dm_scan_fdt() for what you need to do here.

> }
>
> ret = dm_scan_other(pre_reloc_only);
> --
> 1.9.1
>

Also please can you make sandbox have a clock in this node, and add a
test for it to test/dm/clk.c ?

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot