Skip to content

Commit f1c8ecc

Browse files
openamp: xlnx: clean up timer trimming
in linux case - keep UIO if present. thats it. else (non linux cases) just make sure all extent timers have the correct compatible Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
1 parent 6dd5ad3 commit f1c8ecc

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

lopper/assists/openamp_xlnx.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -121,34 +121,32 @@ def xlnx_openamp_trim_timers(sdt, target_os, machine):
121121
match_cpunode = get_cpu_node(sdt, {'args':[machine]})
122122
domains = [ n for n in tree["/domains"].subnodes(children_only=True) if match_cpunode.parent == sdt.tree.pnode(n.parent.parent.propval("cpus")[0]) ]
123123

124-
if not domains:
125-
return False
126-
127124
timer_pvals = [ n.propval("timer") for n in domains[0].subnodes(children_only=True) if n.propval("timer") != [''] ]
128125

129126
# only do trim if timer prop is provided
130-
if not timer_pvals:
127+
if timer_pvals == []:
131128
return False
132129

133-
flattend_timer_pvals = [item for sublist in timer_pvals for item in sublist]
134-
relevant_timer_nodes = [ tree.pnode(phandle) for phandle in flattend_timer_pvals ]
135-
136-
# enable UIO timers
137-
for i in relevant_timer_nodes:
138-
if "uio" in i.propval("compatible"):
139-
i['status'] = 'okay'
140-
141-
all_timer_nodes = [ n for n in tree["/axi"].subnodes(children_only=True, name="timer@*") if n.propval("compatible") == ["cdns,ttc"] ]
142-
143130
# remove UIO timers from stripping
144131
if target_os == "linux_dt":
145-
all_timer_nodes = [
146-
timer_node for timer_node in all_timer_nodes
147-
if "uio" not in timer_node.propval("compatible")
148-
]
132+
flattend_timer_pvals = [item for sublist in timer_pvals for item in sublist]
133+
relevant_timer_nodes = [ tree.pnode(phandle) for phandle in flattend_timer_pvals ]
134+
135+
for node in tree["/axi"].subnodes(children_only=True, name="timer@*"):
136+
if node not in relevant_timer_nodes:
137+
tree.delete(node)
138+
if "uio" in node.propval("compatible"):
139+
node["status"] = "okay"
140+
141+
return True
149142

150-
# delete irrelevant timer nodes
151-
[ tree.delete(timer_node) for timer_node in all_timer_nodes if timer_node not in relevant_timer_nodes ]
143+
# baremetal / freertos / zephyr case
144+
# in freertos and baremetal case - dont mess with UIO
145+
# NOTE once sigils and conditional property usge is beefed up
146+
# this whole routine can go away. Until then this is a holdover
147+
# to ensure that UIO / linux is there if needed.
148+
for n in tree["/axi"].subnodes(children_only=True, name="timer@*"):
149+
n["compatible"] = "cdns,ttc"
152150

153151
return True
154152

0 commit comments

Comments
 (0)