[PATCH v2 3/6] dtoc: Improve handling of reg properties

Simon Glass sjg at chromium.org
Tue Apr 6 06:34:19 CEST 2021

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 at chromium.org>

Changes in v2:
- Drop the reg_val temporary var
- Add two new tests

 tools/dtoc/dtb_platdata.py               |  8 +++++--
 tools/dtoc/test/dtoc_test_noprops.dts    | 21 +++++++++++++++++
 tools/dtoc/test/dtoc_test_single_reg.dts | 30 ++++++++++++++++++++++++
 tools/dtoc/test_dtoc.py                  | 17 +++++++++++++-
 4 files changed, 73 insertions(+), 3 deletions(-)
 create mode 100644 tools/dtoc/test/dtoc_test_noprops.dts
 create mode 100644 tools/dtoc/test/dtoc_test_single_reg.dts

Applied to u-boot-dm, thanks!

More information about the U-Boot mailing list