Skip to content
Merged
Show file tree
Hide file tree
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
53 changes: 53 additions & 0 deletions lopper/assists/zephyr_domain_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,59 @@ def xlnx_remove_unsupported_nodes(tgt_node, sdt, machine, options=None):
node['power-delay-ms'] = 10
node.add(new_node)
node["compatible"] = "xlnx,versal-8.9a"
# SYSMON
if "xlnx,versal-sysmon" in node["compatible"].value:
supply_count = sum(
1 for child in node.child_nodes.values()
if not child.props("xlnx,aie-temp")
)
try:
node.delete("xlnx,numchannels")
except KeyError:
pass
num_prop = LopperProp("xlnx,numchannels")
num_prop.value = [supply_count]
node + num_prop
used_names = set()
for child in list(node.child_nodes.values()):
# Drop AIE temp pseudo-node (not part of SysMon supply child-binding)
if child.props("xlnx,aie-temp"):
try:
node.delete(child)
except KeyError:
pass
continue
reg_val = child.propval("reg", list)
if not reg_val or reg_val == ['']:
try:
node.delete(child)
except KeyError:
pass
continue
try:
reg_val = int(reg_val[0])
except (TypeError, ValueError):
try:
node.delete(child)
except KeyError:
pass
continue
child.delete("reg")
new_prop = LopperProp("xlnx,register")
new_prop.value = [reg_val]
child + new_prop
rail_name = child.propval("xlnx,name", list)
if rail_name and rail_name != ['']:
rail_name = re.sub(r'[^A-Za-z0-9,._+-]', '_', str(rail_name[0]))
if rail_name in used_names:
rail_name = f"{rail_name}_{reg_val}"
child.name = rail_name
child["xlnx,name"] = rail_name
else:
child.name = f"supply_{reg_val}"
child["xlnx,name"] = f"supply_{reg_val}"
used_names.add(child.name)
delete_unused_props(child, ["xlnx,register", "xlnx,name"], False)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs for every non-AIE child, including ones that took the continue on line 780 or never entered the if reg_val block at all. Those children never had xlnx,register created, so the keep-list strips them down to xlnx,name alone.

A supply child with nothing but a name is unlikely to be useful to the Zephyr driver, and it's silent ... the node stays in the output looking plausible. Either the reg-less case is worth skipping outright, or it's worth a warning, since reaching it means the SDT wasn't what this code expects.

# TTCPS
if "cdns,ttc" in node["compatible"].value:
if 'psv_cortexr5' in machine or 'psu_cortexr5' in machine:
Expand Down
8 changes: 8 additions & 0 deletions lopper/assists/zephyr_supported_comp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -520,3 +520,11 @@ xlnx,zynqmp-ipi-dest-mailbox:
- reg
- reg-names
- remote-ipi-id

xlnx,versal-sysmon:
required:
- compatible
- reg
- status
- interrupts
- xlnx,numchannels