diff options
author | Walter Lozano <walter.lozano@collabora.com> | 2020-06-25 01:10:16 -0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-07-09 22:00:29 -0600 |
commit | ad34017c8ceaf0c7c60df075d27e2c943984fe62 (patch) | |
tree | 7c57562436af1d56932d295fef8e0ecbbc0de05b /tools | |
parent | 407009a426f2f31d3af81d02e0109437b1155995 (diff) | |
download | u-boot-ad34017c8ceaf0c7c60df075d27e2c943984fe62.zip u-boot-ad34017c8ceaf0c7c60df075d27e2c943984fe62.tar.gz u-boot-ad34017c8ceaf0c7c60df075d27e2c943984fe62.tar.bz2 |
dtoc: update dtb_platdata to support cd-gpios
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 16 | ||||
-rwxr-xr-x | tools/dtoc/test_dtoc.py | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index c4d3265..c148c49 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -258,7 +258,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 @@ -278,11 +278,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) @@ -657,7 +660,8 @@ class DtbPlatdata(object): # dtv_dmc_at_xxx.clocks[0].node = DM_GET_DEVICE(clock_controller_at_xxx) self.buf('void dm_populate_phandle_data(void) {\n') for l in self._links: - self.buf('\t%s = DM_GET_DEVICE(%s);\n' % (l['var_node'], l['dev_name'])) + self.buf('\t%s = DM_GET_DEVICE(%s);\n' % + (l['var_node'], l['dev_name'])) self.buf('}\n') self.out(''.join(self.get_buf())) diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 209542c..67ca9a8 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -485,7 +485,7 @@ void dm_populate_phandle_data(void) { output = tools.GetOutputFilename('output') with self.assertRaises(ValueError) as e: self.run_test(['struct'], dtb_file, output) - 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): |