diff mbox series

[RFC,3/7] dtoc: update dtb_platdata to support cd-gpio

Message ID 20200330033158.26751-4-walter.lozano@collabora.com
State RFC
Delegated to: Stefano Babic
Headers show
Series mx6cuboxi: enable OF_PLATDATA with MMC support | expand

Commit Message

Walter Lozano March 30, 2020, 3:31 a.m. UTC
Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 tools/dtoc/dtb_platdata.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Simon Glass April 6, 2020, 3:42 a.m. UTC | #1
On Sun, 29 Mar 2020 at 21:32, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>  tools/dtoc/dtb_platdata.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

This looks OK, but please add a test.


>
> diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
> index 037e82c8bb..c52da7925e 100644
> --- a/tools/dtoc/dtb_platdata.py
> +++ b/tools/dtoc/dtb_platdata.py
> @@ -211,7 +211,7 @@ class DtbPlatdata(object):
>          Return:
>              Number of argument cells is this is a phandle, else None
>          """
> -        if prop.name in ['clocks']:
> +        if prop.name in ['clocks', 'cd-gpios']:
>              if not isinstance(prop.value, list):
>                  prop.value = [prop.value]
>              val = prop.value
> @@ -231,8 +231,11 @@ class DtbPlatdata(object):
>                  if not target:
>                      raise ValueError("Cannot parse '%s' in node '%s'" %
>                                       (prop.name, node_name))
> -                prop_name = '#clock-cells'
> -                cells = target.props.get(prop_name)
> +                cells = None
> +                for prop_name in ['#clock-cells', '#gpio-cells']:
> +                    cells = target.props.get(prop_name)
> +                    if cells:
> +                        break
>                  if not cells:
>                      raise ValueError("Node '%s' has no '%s' property" %
>                              (target.name, prop_name))
> --
> 2.20.1
>
Walter Lozano April 7, 2020, 8:05 p.m. UTC | #2
Hi Simon,

On 6/4/20 00:42, Simon Glass wrote:
> On Sun, 29 Mar 2020 at 21:32, Walter Lozano<walter.lozano@collabora.com>  wrote:
>> Signed-off-by: Walter Lozano<walter.lozano@collabora.com>
>> ---
>>   tools/dtoc/dtb_platdata.py | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
> This looks OK, but please add a test.


Noted. Thank you.


>> diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
>> index 037e82c8bb..c52da7925e 100644
>> --- a/tools/dtoc/dtb_platdata.py
>> +++ b/tools/dtoc/dtb_platdata.py
>> @@ -211,7 +211,7 @@ class DtbPlatdata(object):
>>           Return:
>>               Number of argument cells is this is a phandle, else None
>>           """
>> -        if prop.name in ['clocks']:
>> +        if prop.name in ['clocks', 'cd-gpios']:
>>               if not isinstance(prop.value, list):
>>                   prop.value = [prop.value]
>>               val = prop.value
>> @@ -231,8 +231,11 @@ class DtbPlatdata(object):
>>                   if not target:
>>                       raise ValueError("Cannot parse '%s' in node '%s'" %
>>                                        (prop.name, node_name))
>> -                prop_name = '#clock-cells'
>> -                cells = target.props.get(prop_name)
>> +                cells = None
>> +                for prop_name in ['#clock-cells', '#gpio-cells']:
>> +                    cells = target.props.get(prop_name)
>> +                    if cells:
>> +                        break
>>                   if not cells:
>>                       raise ValueError("Node '%s' has no '%s' property" %
>>                               (target.name, prop_name))
>> --
>> 2.20.1
>>
diff mbox series

Patch

diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 037e82c8bb..c52da7925e 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -211,7 +211,7 @@  class DtbPlatdata(object):
         Return:
             Number of argument cells is this is a phandle, else None
         """
-        if prop.name in ['clocks']:
+        if prop.name in ['clocks', 'cd-gpios']:
             if not isinstance(prop.value, list):
                 prop.value = [prop.value]
             val = prop.value
@@ -231,8 +231,11 @@  class DtbPlatdata(object):
                 if not target:
                     raise ValueError("Cannot parse '%s' in node '%s'" %
                                      (prop.name, node_name))
-                prop_name = '#clock-cells'
-                cells = target.props.get(prop_name)
+                cells = None
+                for prop_name in ['#clock-cells', '#gpio-cells']:
+                    cells = target.props.get(prop_name)
+                    if cells:
+                        break
                 if not cells:
                     raise ValueError("Node '%s' has no '%s' property" %
                             (target.name, prop_name))