diff options
author | Simon Glass <sjg@chromium.org> | 2018-07-06 10:27:31 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-07-09 09:11:00 -0600 |
commit | 760b7170c5e44c771397eaf57b7197b621373809 (patch) | |
tree | e2d18563610f0059aab03a3c63cceccf468c2407 /tools/dtoc/dtb_platdata.py | |
parent | b9066ffc136afd2e46e8d033c4edce98f5557afc (diff) | |
download | u-boot-760b7170c5e44c771397eaf57b7197b621373809.tar.gz |
dtoc: Fix properties with a single zero-arg phandle
At present a property with a single phandle looks like an integer value
to dtoc. Correct this by adjusting it in the phandle-processing code.
Add a test for this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 2f7302e529..b1323aef19 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -211,15 +211,21 @@ class DtbPlatdata(object): Number of argument cells is this is a phandle, else None """ if prop.name in ['clocks']: + if not isinstance(prop.value, list): + prop.value = [prop.value] val = prop.value - if not isinstance(val, list): - val = [val] i = 0 max_args = 0 args = [] while i < len(val): phandle = fdt_util.fdt32_to_cpu(val[i]) + # If we get to the end of the list, stop. This can happen + # since some nodes have more phandles in the list than others, + # but we allocate enough space for the largest list. So those + # nodes with shorter lists end up with zeroes at the end. + if not phandle: + break target = self._fdt.phandle_to_node.get(phandle) if not target: raise ValueError("Cannot parse '%s' in node '%s'" % @@ -400,8 +406,6 @@ class DtbPlatdata(object): continue info = self.get_phandle_argc(prop, node.name) if info: - if not isinstance(prop.value, list): - prop.value = [prop.value] # Process the list as pairs of (phandle, id) pos = 0 for args in info.args: |