summaryrefslogtreecommitdiff
path: root/tools/dtoc/dtb_platdata.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-06-18 22:09:03 -0600
committerSimon Glass <sjg@chromium.org>2017-07-11 10:08:20 -0600
commitfa0ea5b09ead2b0fa17754c0bf99249533fd36a3 (patch)
tree0a3bafde44f729bc0f7443baf131ea28c5561ecf /tools/dtoc/dtb_platdata.py
parent56e0bbe0577f33d5bb2486a60267ba759e2ea643 (diff)
downloadu-boot-fa0ea5b09ead2b0fa17754c0bf99249533fd36a3.tar.gz
dtoc: Move the main logic into the dtb_platdata file
Collect the main logic of dtoc into a function and put it into dtb_platdata. This will allow tests to use this function instead of duplicating the code themselves. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r--tools/dtoc/dtb_platdata.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index a1f32e164a..9923892dc3 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -422,3 +422,32 @@ class DtbPlatdata(object):
nodes_to_output.remove(req_node)
self.output_node(node)
nodes_to_output.remove(node)
+
+
+def run_steps(args, dtb_file, include_disabled, output):
+ """Run all the steps of the dtoc tool
+
+ Args:
+ args: List of non-option arguments provided to the problem
+ dtb_file: Filename of dtb file to process
+ include_disabled: True to include disabled nodes
+ output: Name of output file
+ """
+ if not args:
+ raise ValueError('Please specify a command: struct, platdata')
+
+ plat = DtbPlatdata(dtb_file, include_disabled)
+ plat.scan_dtb()
+ plat.scan_tree()
+ plat.setup_output(output)
+ structs = plat.scan_structs()
+ plat.scan_phandles()
+
+ for cmd in args[0].split(','):
+ if cmd == 'struct':
+ plat.generate_structs(structs)
+ elif cmd == 'platdata':
+ plat.generate_tables()
+ else:
+ raise ValueError("Unknown command '%s': (use: struct, platdata)" %
+ cmd)