File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99from m1n1 import adt
1010
1111parser = argparse .ArgumentParser (description = 'Convert ADT PMGR nodes to Device Tree format' )
12+ parser .add_argument ("-m" , "--multidie" , action = "store_true" )
1213parser .add_argument ('input' , type = pathlib .Path )
1314args = parser .parse_args ()
1415
2223blocks = {}
2324maxaddr = {}
2425
26+ def die_node (s ):
27+ if args .multidie :
28+ return f"DIE_NODE({ s } )"
29+ else :
30+ return s
31+
32+ def die_label (s ):
33+ if args .multidie :
34+ return f"DIE_LABEL({ s } )"
35+ else :
36+ return s
37+
2538for i , dev in enumerate (pmgr .devices ):
2639 if dev .flags .no_ps :
2740 continue
6174 assert base <= addr <= (base + size )
6275
6376 print ()
64- print (f"\t ps_ { dev .name .lower ()} : power-controller@{ offset :x} {{" )
77+ print (f"\t { die_node ( 'ps_' + dev .name .lower () )} : power-controller@{ offset :x} {{" )
6578 print (f"\t \t compatible = { ps_compatible } ;" )
6679 print (f"\t \t reg = <{ offset :#x} 4>;" )
6780 print ( "\t \t #power-domain-cells = <0>;" )
6881 print ( "\t \t #reset-cells = <0>;" )
69- print (f'\t \t label = " { dev .name .lower ()} " ;' )
82+ print (f'\t \t label = { die_label ( dev .name .lower ()) } ;' )
7083 if dev .flags .critical :
7184 print ("\t \t apple,always-on;" )
7285
7386 if any (dev .parents ):
74- domains = [f"<&ps_ { dev_by_id [idx ].name .lower ()} >" for idx in dev .parents if idx ]
87+ domains = [f"<&{ die_node ( 'ps_' + dev_by_id [idx ].name .lower () )} >" for idx in dev .parents if idx ]
7588 print (f"\t \t power-domains = { ', ' .join (domains )} ;" )
7689
7790 print ( "\t };" )
You can’t perform that action at this time.
0 commit comments