Skip to content
Permalink
Browse files

scripts/dts: allow node to be child on one bus and parent on another

Allow a device tree node to be child on one bus and parent on another
bus (e.g. an I2C slave device with multiple sub-devices).

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
  • Loading branch information...
henrikbrixandersen authored and nashif committed Mar 24, 2019
1 parent ac9356a commit f9dd53624c578be51fbb91ddf2938df55a0c6966
Showing with 11 additions and 15 deletions.
  1. +9 −13 scripts/dts/extract/globals.py
  2. +2 −2 scripts/dts/extract_dts_includes.py
@@ -287,21 +287,17 @@ def add_prop_aliases(node_path,
def get_binding(node_path):
compat = get_compat(node_path)

# For just look for the binding in the main dict
# if we find it here, return it, otherwise it best
# be in the bus specific dict
if compat in bindings:
return bindings[compat]

# First look for a bus-specific binding
parent_path = get_parent_path(node_path)
parent_compat = get_compat(parent_path)

parent_binding = bindings[parent_compat]

bus = parent_binding['child']['bus']
binding = bus_bindings[bus][compat]

return binding
if parent_compat in bindings:
parent_binding = bindings[parent_compat]
if 'child' in parent_binding and 'bus' in parent_binding['child']:
bus = parent_binding['child']['bus']
return bus_bindings[bus][compat]

# No bus-specific binding found, look in the main dict.
return bindings[compat]

def get_binding_compats():
return binding_compats
@@ -370,8 +370,8 @@ def load_bindings(root, binding_dirs):

if 'parent' in binding:
bus_to_binding[binding['parent']['bus']][compat] = binding
else:
compat_to_binding[compat] = binding

compat_to_binding[compat] = binding

if not compat_to_binding:
raise Exception("No bindings found in '{}'".format(binding_dirs))

0 comments on commit f9dd536

Please sign in to comment.
You can’t perform that action at this time.