Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion scripts/dts/python-devicetree/src/devicetree/edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ def __init__(self, path: Optional[str], fname2path: Dict[str, str],
else:
self.child_binding = None

self.child_nodes: Dict[str, 'Binding'] = {}
if "child-nodes" in raw:
#breakpoint()
if not (isinstance(raw["child-nodes"], list) and \
all(isinstance(child_node, dict) for child_node in raw["child-nodes"])):
_err(f"malformed 'child-nodes:' in {self.path}, "
"expected a sequence of bindings (list of dictionaries)")
for child_node in raw["child-nodes"]:
self.child_nodes[child_node["name"]]: Optional['Binding'] = Binding(
path, fname2path, child_node,
require_compatible=False, require_description=False)


# Make sure this is a well defined object.
self._check(require_compatible, require_description)

Expand Down Expand Up @@ -479,7 +492,7 @@ def _check(self, require_compatible: bool, require_description: bool):
# Allowed top-level keys. The 'include' key should have been
# removed by _load_raw() already.
ok_top = {"description", "compatible", "bus", "on-bus",
"properties", "child-binding"}
"properties", "child-binding", "child-nodes", "name"}

# Descriptive errors for legacy bindings.
legacy_errors = {
Expand Down Expand Up @@ -1443,6 +1456,9 @@ def _binding_from_parent(self) -> Optional[Binding]:
if not pbinding:
return None

if pbinding.child_nodes and self.name in pbinding.child_nodes:
return pbinding.child_nodes[self.name]

if pbinding.child_binding:
return pbinding.child_binding

Expand Down
Loading