diff options
author | Simon Glass <sjg@chromium.org> | 2021-02-03 06:01:15 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-03-22 19:23:27 +1300 |
commit | 4b91be2fd8e7ab95da7b18714687e08849a4b835 (patch) | |
tree | 03d8453ec7637474f4383cb06b2e825229930eb8 /tools/dtoc/dtb_platdata.py | |
parent | 426d12f42f47b0b004c838f753dcf415c3268c37 (diff) |
dtoc: Don't generate platform data with instantiation
This file is not used when instantiating devices. Update dtoc to skip
generating its contents and just add a comment instead.
Also it is useful to see the driver name and parent for each device.
Update the file to show that information, to avoid updating the same
tests twice.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 040b724678..befe7c1490 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -786,19 +786,46 @@ class DtbPlatdata(): uclass.node_refs[-1] = ref uclass.node_refs[len(uclass.devs)] = ref - def output_node(self, node): + def output_node_plat(self, node): """Output the C code for a node Args: node (fdt.Node): node to output """ - self.buf('/* Node %s index %d */\n' % (node.path, node.idx)) + driver = node.driver + parent_driver = node.parent_driver + + line1 = 'Node %s index %d' % (node.path, node.idx) + if driver: + self.buf('/*\n') + self.buf(' * %s\n' % line1) + self.buf(' * driver %s parent %s\n' % (driver.name, + parent_driver.name if parent_driver else 'None')) + self.buf(' */\n') + else: + self.buf('/* %s */\n' % line1) self._output_values(node) self._declare_device(node) self.out(''.join(self.get_buf())) + def check_instantiate(self, require): + """Check if self._instantiate is set to the required value + + If not, this outputs a message into the current file + + Args: + require: True to require --instantiate, False to require that it not + be enabled + """ + if require != self._instantiate: + self.out( + '/* This file is not used: --instantiate was %senabled */\n' % + ('not ' if require else '')) + return False + return True + def generate_plat(self): """Generate device defintions for the platform data @@ -809,6 +836,8 @@ class DtbPlatdata(): See the documentation in doc/driver-model/of-plat.rst for more information. """ + if not self.check_instantiate(False): + return self.out('/* Allow use of U_BOOT_DRVINFO() in this file */\n') self.out('#define DT_PLAT_C\n') self.out('\n') @@ -818,7 +847,7 @@ class DtbPlatdata(): self.out('\n') for node in self._valid_nodes: - self.output_node(node) + self.output_node_plat(node) self.out(''.join(self.get_buf())) |