mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 09:44:13 +00:00
tools/pmgr_adt2dt.py: Add multidie support
Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
41aac76fff
commit
3bc3b0131f
1 changed files with 16 additions and 3 deletions
|
@ -9,6 +9,7 @@ import argparse, pathlib
|
|||
from m1n1 import adt
|
||||
|
||||
parser = argparse.ArgumentParser(description='Convert ADT PMGR nodes to Device Tree format')
|
||||
parser.add_argument("-m", "--multidie", action="store_true")
|
||||
parser.add_argument('input', type=pathlib.Path)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -22,6 +23,18 @@ dev_by_id = {dev.id: dev for dev in pmgr.devices}
|
|||
blocks = {}
|
||||
maxaddr = {}
|
||||
|
||||
def die_node(s):
|
||||
if args.multidie:
|
||||
return f"DIE_NODE({s})"
|
||||
else:
|
||||
return s
|
||||
|
||||
def die_label(s):
|
||||
if args.multidie:
|
||||
return f"DIE_LABEL({s})"
|
||||
else:
|
||||
return s
|
||||
|
||||
for i, dev in enumerate(pmgr.devices):
|
||||
if dev.flags.no_ps:
|
||||
continue
|
||||
|
@ -61,17 +74,17 @@ for i, ((base, size), devices) in enumerate(sorted(blocks.items())):
|
|||
assert base <= addr <= (base + size)
|
||||
|
||||
print()
|
||||
print(f"\tps_{dev.name.lower()}: power-controller@{offset:x} {{")
|
||||
print(f"\t{die_node('ps_' + dev.name.lower())}: power-controller@{offset:x} {{")
|
||||
print(f"\t\tcompatible = {ps_compatible};")
|
||||
print(f"\t\treg = <{offset:#x} 4>;")
|
||||
print( "\t\t#power-domain-cells = <0>;")
|
||||
print( "\t\t#reset-cells = <0>;")
|
||||
print(f'\t\tlabel = "{dev.name.lower()}";')
|
||||
print(f'\t\tlabel = {die_label(dev.name.lower())};')
|
||||
if dev.flags.critical:
|
||||
print("\t\tapple,always-on;")
|
||||
|
||||
if any(dev.parents):
|
||||
domains = [f"<&ps_{dev_by_id[idx].name.lower()}>" for idx in dev.parents if idx]
|
||||
domains = [f"<&{die_node('ps_'+dev_by_id[idx].name.lower())}>" for idx in dev.parents if idx]
|
||||
print(f"\t\tpower-domains = {', '.join(domains)};")
|
||||
|
||||
print( "\t};")
|
||||
|
|
Loading…
Reference in a new issue