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'" %
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:
\t.platdata_size\t= sizeof(dtv_phandle_source),
};
+static struct dtd_source dtv_phandle_source2 = {
+\t.clocks\t\t\t= {
+\t\t\t{&dtv_phandle_target, {}},},
+};
+U_BOOT_DEVICE(phandle_source2) = {
+\t.name\t\t= "source",
+\t.platdata\t= &dtv_phandle_source2,
+\t.platdata_size\t= sizeof(dtv_phandle_source2),
+};
+
''', data)
def test_aliases(self):
def testPhandle(self):
dtb = fdt.FdtScan('tools/dtoc/dtoc_test_phandle.dts')
- node = dtb.GetNode('/phandle-source')
+ node = dtb.GetNode('/phandle-source2')
+ prop = node.props['clocks']
+ self.assertTrue(fdt32_to_cpu(prop.value) > 0)
def _ConvertProp(self, prop_name):
"""Helper function to look up a property in self.node and return it