diff options
author | Simon Glass <sjg@chromium.org> | 2021-03-26 06:17:27 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-04-06 07:33:19 +0300 |
commit | da393412234a37af68188e7490eba136c832a275 (patch) | |
tree | 637eaafb06d762d0a850504a3f5e0b8042022bcd /tools/dtoc/dtb_platdata.py | |
parent | 3e200caff05bccc86392ba531770ebb0879ef93e (diff) | |
download | u-boot-da393412234a37af68188e7490eba136c832a275.tar.xz |
dtoc: Improve handling of reg properties
This existing code assumes that a reg property is larger than one cell,
but this is not always the case. Fix this assumption.
Also if a node's parent is missing the #address-cells and #size-cells
properties we use 2 as a default for each. But this should not happen in
practice. More likely the properties were removed for SPL due to there
being no 'u-boot,dm-pre-reloc' property, or similar. Add a warning for
this as the failure can be very confusing.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r-- | tools/dtoc/dtb_platdata.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index b989b4f4fc..1374f01c70 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -440,6 +440,9 @@ class DtbPlatdata(): Number of size cells for this node """ parent = node.parent + if parent and not parent.props: + raise ValueError("Parent node '%s' has no properties - do you need u-boot,dm-spl or similar?" % + parent.path) num_addr, num_size = 2, 2 if parent: addr_prop = parent.props.get('#address-cells') @@ -471,9 +474,10 @@ class DtbPlatdata(): reg.value = [reg.value] if len(reg.value) % total: raise ValueError( - "Node '%s' reg property has %d cells " + "Node '%s' (parent '%s') reg property has %d cells " 'which is not a multiple of na + ns = %d + %d)' % - (node.name, len(reg.value), num_addr, num_size)) + (node.name, node.parent.name, len(reg.value), num_addr, + num_size)) reg.num_addr = num_addr reg.num_size = num_size if num_addr > 1 or num_size > 1: |