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

Patrice CHOTARD patrice.chotard at st.com
Tue Aug 8 09:13:45 UTC 2017


Hi Simon

On 08/06/2017 07:16 AM, Simon Glass wrote:
> Hi Patrice,
> 
> On 31 July 2017 at 09:12,  <patrice.chotard at st.com> wrote:
>> From: Patrice Chotard <patrice.chotard at st.com>
>>
>> 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 <patrice.chotard at st.com>
>> ---
>>   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

> 


More information about the U-Boot mailing list