All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
@ 2018-03-01  6:08 Andy Yan
  2018-03-08 21:03 ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Yan @ 2018-03-01  6:08 UTC (permalink / raw)
  To: u-boot

dm_scan_fdt_node can't work when live dt is active,
we should use dm_scan_fdt_live instead.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 drivers/core/root.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 36336b6..b437892 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 
 int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
 {
-	int node, ret;
+	int ret;
+	ofnode node;
 
 	ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
 	if (ret) {
@@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
 	}
 
 	/* bind fixed-clock */
-	node = ofnode_to_offset(ofnode_path("/clocks"));
+	node = ofnode_path("/clocks");
 	/* if no DT "clocks" node, no need to go further */
-	if (node < 0)
+	if (!ofnode_valid(node))
 		return ret;
 
-	ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
-			       pre_reloc_only);
+#if CONFIG_IS_ENABLED(OF_LIVE)
+	if (of_live_active())
+		ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
+	else
+#endif
+		ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
+				       pre_reloc_only);
 	if (ret)
 		debug("dm_scan_fdt_node() failed: %d\n", ret);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
  2018-03-01  6:08 [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible Andy Yan
@ 2018-03-08 21:03 ` Simon Glass
  2018-03-11  6:58   ` Andy Yan
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2018-03-08 21:03 UTC (permalink / raw)
  To: u-boot

Hi Andy.

On 28 February 2018 at 23:08, Andy Yan <andy.yan@rock-chips.com> wrote:
> dm_scan_fdt_node can't work when live dt is active,
> we should use dm_scan_fdt_live instead.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
>
>  drivers/core/root.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

with change below

> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index 36336b6..b437892 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>
>  int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>  {
> -       int node, ret;
> +       int ret;
> +       ofnode node;
>
>         ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>         if (ret) {
> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>         }
>
>         /* bind fixed-clock */
> -       node = ofnode_to_offset(ofnode_path("/clocks"));
> +       node = ofnode_path("/clocks");
>         /* if no DT "clocks" node, no need to go further */
> -       if (node < 0)
> +       if (!ofnode_valid(node))
>                 return ret;
>
> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
> -                              pre_reloc_only);
> +#if CONFIG_IS_ENABLED(OF_LIVE)

You should be able to drop this #if since of_live_active() takes care of it.

> +       if (of_live_active())
> +               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
> +       else
> +#endif
> +               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
> +                                      pre_reloc_only);
>         if (ret)
>                 debug("dm_scan_fdt_node() failed: %d\n", ret);
>
> --
> 2.7.4
>
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
  2018-03-08 21:03 ` Simon Glass
@ 2018-03-11  6:58   ` Andy Yan
  2018-03-19 17:58     ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Yan @ 2018-03-11  6:58 UTC (permalink / raw)
  To: u-boot

Hi Simon:


On 2018年03月09日 05:03, Simon Glass wrote:
> Hi Andy.
>
> On 28 February 2018 at 23:08, Andy Yan <andy.yan@rock-chips.com> wrote:
>> dm_scan_fdt_node can't work when live dt is active,
>> we should use dm_scan_fdt_live instead.
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>> ---
>>
>>   drivers/core/root.c | 16 +++++++++++-----
>>   1 file changed, 11 insertions(+), 5 deletions(-)
>>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> with change below
>
>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>> index 36336b6..b437892 100644
>> --- a/drivers/core/root.c
>> +++ b/drivers/core/root.c
>> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>>
>>   int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>   {
>> -       int node, ret;
>> +       int ret;
>> +       ofnode node;
>>
>>          ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>>          if (ret) {
>> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>          }
>>
>>          /* bind fixed-clock */
>> -       node = ofnode_to_offset(ofnode_path("/clocks"));
>> +       node = ofnode_path("/clocks");
>>          /* if no DT "clocks" node, no need to go further */
>> -       if (node < 0)
>> +       if (!ofnode_valid(node))
>>                  return ret;
>>
>> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>> -                              pre_reloc_only);
>> +#if CONFIG_IS_ENABLED(OF_LIVE)
> You should be able to drop this #if since of_live_active() takes care of it.

     But I found function dm_scan_fdt_live is depends on #if 
CONFIG_IS_ENABLE(OF_LIVE)
>
>> +       if (of_live_active())
>> +               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
>> +       else
>> +#endif
>> +               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
>> +                                      pre_reloc_only);
>>          if (ret)
>>                  debug("dm_scan_fdt_node() failed: %d\n", ret);
>>
>> --
>> 2.7.4
>>
>>
> Regards,
> Simon
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
  2018-03-11  6:58   ` Andy Yan
@ 2018-03-19 17:58     ` Simon Glass
  2018-03-20  0:56       ` Andy Yan
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2018-03-19 17:58 UTC (permalink / raw)
  To: u-boot

Hi Andy,

On 10 March 2018 at 23:58, Andy Yan <andy.yan@rock-chips.com> wrote:
>
> Hi Simon:
>
>
>
> On 2018年03月09日 05:03, Simon Glass wrote:
>>
>> Hi Andy.
>>
>> On 28 February 2018 at 23:08, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>
>>> dm_scan_fdt_node can't work when live dt is active,
>>> we should use dm_scan_fdt_live instead.
>>>
>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>> ---
>>>
>>>   drivers/core/root.c | 16 +++++++++++-----
>>>   1 file changed, 11 insertions(+), 5 deletions(-)
>>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> with change below
>>
>>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>>> index 36336b6..b437892 100644
>>> --- a/drivers/core/root.c
>>> +++ b/drivers/core/root.c
>>> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>>>
>>>   int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>>   {
>>> -       int node, ret;
>>> +       int ret;
>>> +       ofnode node;
>>>
>>>          ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>>>          if (ret) {
>>> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>>          }
>>>
>>>          /* bind fixed-clock */
>>> -       node = ofnode_to_offset(ofnode_path("/clocks"));
>>> +       node = ofnode_path("/clocks");
>>>          /* if no DT "clocks" node, no need to go further */
>>> -       if (node < 0)
>>> +       if (!ofnode_valid(node))
>>>                  return ret;
>>>
>>> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>>> -                              pre_reloc_only);
>>> +#if CONFIG_IS_ENABLED(OF_LIVE)
>>
>> You should be able to drop this #if since of_live_active() takes care of it.
>
>
>     But I found function dm_scan_fdt_live is depends on #if CONFIG_IS_ENABLE(OF_LIVE)

Yes, I wonder if that can be removed, if the above becomes an if() ?

If not, then what you have now is OK.

>
>>
>>> +       if (of_live_active())
>>> +               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
>>> +       else
>>> +#endif
>>> +               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
>>> +                                      pre_reloc_only);
>>>          if (ret)
>>>                  debug("dm_scan_fdt_node() failed: %d\n", ret);
>>>
>>> --
>>> 2.7.4

Regards,
Simon

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
  2018-03-19 17:58     ` Simon Glass
@ 2018-03-20  0:56       ` Andy Yan
  2018-04-01 14:28         ` Simon Glass
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Yan @ 2018-03-20  0:56 UTC (permalink / raw)
  To: u-boot

Hi Simon:


On 2018年03月20日 01:58, Simon Glass wrote:
> Hi Andy,
>
> On 10 March 2018 at 23:58, Andy Yan <andy.yan@rock-chips.com> wrote:
>> Hi Simon:
>>
>>
>>
>> On 2018年03月09日 05:03, Simon Glass wrote:
>>> Hi Andy.
>>>
>>> On 28 February 2018 at 23:08, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>> dm_scan_fdt_node can't work when live dt is active,
>>>> we should use dm_scan_fdt_live instead.
>>>>
>>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>>> ---
>>>>
>>>>    drivers/core/root.c | 16 +++++++++++-----
>>>>    1 file changed, 11 insertions(+), 5 deletions(-)
>>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> with change below
>>>
>>>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>>>> index 36336b6..b437892 100644
>>>> --- a/drivers/core/root.c
>>>> +++ b/drivers/core/root.c
>>>> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
>>>>
>>>>    int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>>>    {
>>>> -       int node, ret;
>>>> +       int ret;
>>>> +       ofnode node;
>>>>
>>>>           ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>>>>           if (ret) {
>>>> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>>>           }
>>>>
>>>>           /* bind fixed-clock */
>>>> -       node = ofnode_to_offset(ofnode_path("/clocks"));
>>>> +       node = ofnode_path("/clocks");
>>>>           /* if no DT "clocks" node, no need to go further */
>>>> -       if (node < 0)
>>>> +       if (!ofnode_valid(node))
>>>>                   return ret;
>>>>
>>>> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>>>> -                              pre_reloc_only);
>>>> +#if CONFIG_IS_ENABLED(OF_LIVE)
>>> You should be able to drop this #if since of_live_active() takes care of it.
>>
>>      But I found function dm_scan_fdt_live is depends on #if CONFIG_IS_ENABLE(OF_LIVE)
> Yes, I wonder if that can be removed, if the above becomes an if() ?

dm_scan_fdt_live only called in root.c, and the caller use 
if(of_live_active) as a check, so I think we can remove the #if
>
> If not, then what you have now is OK.
>
>>>> +       if (of_live_active())
>>>> +               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
>>>> +       else
>>>> +#endif
>>>> +               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
>>>> +                                      pre_reloc_only);
>>>>           if (ret)
>>>>                   debug("dm_scan_fdt_node() failed: %d\n", ret);
>>>>
>>>> --
>>>> 2.7.4
> Regards,
> Simon
>
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible
  2018-03-20  0:56       ` Andy Yan
@ 2018-04-01 14:28         ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2018-04-01 14:28 UTC (permalink / raw)
  To: u-boot

On 20 March 2018 at 08:56, Andy Yan <andy.yan@rock-chips.com> wrote:
> Hi Simon:
>
>
>
> On 2018年03月20日 01:58, Simon Glass wrote:
>>
>> Hi Andy,
>>
>> On 10 March 2018 at 23:58, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>
>>> Hi Simon:
>>>
>>>
>>>
>>> On 2018年03月09日 05:03, Simon Glass wrote:
>>>>
>>>> Hi Andy.
>>>>
>>>> On 28 February 2018 at 23:08, Andy Yan <andy.yan@rock-chips.com> wrote:
>>>>>
>>>>> dm_scan_fdt_node can't work when live dt is active,
>>>>> we should use dm_scan_fdt_live instead.
>>>>>
>>>>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>>>> ---
>>>>>
>>>>>    drivers/core/root.c | 16 +++++++++++-----
>>>>>    1 file changed, 11 insertions(+), 5 deletions(-)
>>>>>
>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> with change below
>>>>
>>>>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>>>>> index 36336b6..b437892 100644
>>>>> --- a/drivers/core/root.c
>>>>> +++ b/drivers/core/root.c
>>>>> @@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent,
>>>>> const void *blob,
>>>>>
>>>>>    int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
>>>>>    {
>>>>> -       int node, ret;
>>>>> +       int ret;
>>>>> +       ofnode node;
>>>>>
>>>>>           ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
>>>>>           if (ret) {
>>>>> @@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool
>>>>> pre_reloc_only)
>>>>>           }
>>>>>
>>>>>           /* bind fixed-clock */
>>>>> -       node = ofnode_to_offset(ofnode_path("/clocks"));
>>>>> +       node = ofnode_path("/clocks");
>>>>>           /* if no DT "clocks" node, no need to go further */
>>>>> -       if (node < 0)
>>>>> +       if (!ofnode_valid(node))
>>>>>                   return ret;
>>>>>
>>>>> -       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
>>>>> -                              pre_reloc_only);
>>>>> +#if CONFIG_IS_ENABLED(OF_LIVE)
>>>>
>>>> You should be able to drop this #if since of_live_active() takes care of
>>>> it.
>>>
>>>
>>>      But I found function dm_scan_fdt_live is depends on #if
>>> CONFIG_IS_ENABLE(OF_LIVE)
>>
>> Yes, I wonder if that can be removed, if the above becomes an if() ?
>
>
> dm_scan_fdt_live only called in root.c, and the caller use
> if(of_live_active) as a check, so I think we can remove the #if
>
>>
>> If not, then what you have now is OK.
>>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-04-01 14:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01  6:08 [U-Boot] [PATCH] dm: core: make fixed-clock dt scan live dt compatible Andy Yan
2018-03-08 21:03 ` Simon Glass
2018-03-11  6:58   ` Andy Yan
2018-03-19 17:58     ` Simon Glass
2018-03-20  0:56       ` Andy Yan
2018-04-01 14:28         ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.