Message ID | 20200529181521.22073-10-walter.lozano@collabora.com |
---|---|
State | Changes Requested |
Delegated to: | Simon Glass |
Headers | show |
Series | improve OF_PLATDATA support | expand |
On Fri, 29 May 2020 at 12:15, Walter Lozano <walter.lozano@collabora.com> wrote: > > Currently dtoc does not support the property cd-gpios used to declare > the gpios for card detect in mmc. > > This patch adds support to cd-gpios property. > > Signed-off-by: Walter Lozano <walter.lozano@collabora.com> > --- > tools/dtoc/dtb_platdata.py | 13 ++++++++----- > tools/dtoc/test_dtoc.py | 2 +- > 2 files changed, 9 insertions(+), 6 deletions(-) Reviewed-by: Simon Glass <sjg@chromium.org> But I think you should mention GPIOs, rather than just cd-gpios, as it seems this will add support for any GPIO.
Hi Simon On 4/6/20 12:59, Simon Glass wrote: > On Fri, 29 May 2020 at 12:15, Walter Lozano <walter.lozano@collabora.com> wrote: >> Currently dtoc does not support the property cd-gpios used to declare >> the gpios for card detect in mmc. >> >> This patch adds support to cd-gpios property. >> >> Signed-off-by: Walter Lozano <walter.lozano@collabora.com> >> --- >> tools/dtoc/dtb_platdata.py | 13 ++++++++----- >> tools/dtoc/test_dtoc.py | 2 +- >> 2 files changed, 9 insertions(+), 6 deletions(-) > Reviewed-by: Simon Glass <sjg@chromium.org> > > But I think you should mention GPIOs, rather than just cd-gpios, as it > seems this will add support for any GPIO. Sorry, probably I am missing something, but in order to support GPIOs in general we need to support a set of properties such as "cs-gpios", "rb-gpios", "gpios" among others. Do you agree? Regards, Walter
Hi Walter, On Mon, 8 Jun 2020 at 10:01, Walter Lozano <walter.lozano@collabora.com> wrote: > > Hi Simon > > On 4/6/20 12:59, Simon Glass wrote: > > On Fri, 29 May 2020 at 12:15, Walter Lozano <walter.lozano@collabora.com> wrote: > >> Currently dtoc does not support the property cd-gpios used to declare > >> the gpios for card detect in mmc. > >> > >> This patch adds support to cd-gpios property. > >> > >> Signed-off-by: Walter Lozano <walter.lozano@collabora.com> > >> --- > >> tools/dtoc/dtb_platdata.py | 13 ++++++++----- > >> tools/dtoc/test_dtoc.py | 2 +- > >> 2 files changed, 9 insertions(+), 6 deletions(-) > > Reviewed-by: Simon Glass <sjg@chromium.org> > > > > But I think you should mention GPIOs, rather than just cd-gpios, as it > > seems this will add support for any GPIO. > > Sorry, probably I am missing something, but in order to support GPIOs in > general we need to support a set of properties such as "cs-gpios", > "rb-gpios", "gpios" among others. > > Do you agree? OK yes I see. I was thinking of supporting any *-gpios but I think what you have here is better for now. Regards, Simon
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 59b720703c..3f7defb26e 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -250,7 +250,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 @@ -270,11 +270,14 @@ 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)) + raise ValueError("Node '%s' has no cells property" % + (target.name)) num_args = fdt_util.fdt32_to_cpu(cells.value) max_args = max(max_args, num_args) args.append(num_args) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index f2155528f8..4bfbab7d37 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -414,7 +414,7 @@ void populate_phandle_data(void) { output = tools.GetOutputFilename('output') with self.assertRaises(ValueError) as e: dtb_platdata.run_steps(['struct'], dtb_file, False, output, True) - self.assertIn("Node 'phandle-target' has no '#clock-cells' property", + self.assertIn("Node 'phandle-target' has no cells property", str(e.exception)) def test_aliases(self):
Currently dtoc does not support the property cd-gpios used to declare the gpios for card detect in mmc. This patch adds support to cd-gpios property. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> --- tools/dtoc/dtb_platdata.py | 13 ++++++++----- tools/dtoc/test_dtoc.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-)