# phandles is len(args). This is a list of integers.
PhandleInfo = collections.namedtuple('PhandleInfo', ['max_args', 'args'])
+# Holds a single phandle link, allowing a C struct value to be assigned to point
+# to a device
+#
+# var_node: C variable to assign (e.g. 'dtv_mmc.clocks[0].node')
+# dev_name: Name of device to assign to (e.g. 'clock')
+PhandleLink = collections.namedtuple('PhandleLink', ['var_node', 'dev_name'])
+
def conv_name_to_c(name):
"""Convert a device-tree name to a C identifier
key: Driver alias declared with
U_BOOT_DRIVER_ALIAS(driver_alias, driver_name)
value: Driver name declared with U_BOOT_DRIVER(driver_name)
- _links: List of links to be included in dm_populate_phandle_data()
+ _links: List of links to be included in dm_populate_phandle_data(),
+ each a PhandleLink
_drivers_additional: List of additional drivers to use during scanning
"""
def __init__(self, dtb_fname, include_disabled, warning_disabled,
(VAL_PREFIX, var_name, member_name, item)
# Save the the link information to be use to define
# dm_populate_phandle_data()
- self._links.append({'var_node': var_node, 'dev_name': name})
+ self._links.append(PhandleLink(var_node, name))
item += 1
for val in vals:
self.buf('\n\t\t%s,' % val)
# nodes using DM_GET_DEVICE
# 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:
+ for link in self._links:
self.buf('\t%s = DM_GET_DEVICE(%s);\n' %
- (l['var_node'], l['dev_name']))
+ (link.var_node, link.dev_name))
self.buf('}\n')
self.out(''.join(self.get_buf()))