Skip to content

Commit

Permalink
dts: edtlib: fix reg / unit addr warn location
Browse files Browse the repository at this point in the history
I can't see a good reason to be doing this in the Node class's
unit_addr accessor. Move it up to the edtlib initialization so it only
happens once.

Signed-off-by: Martí Bolívar <[email protected]>
  • Loading branch information
mbolivar-nordic authored and galak committed Jul 8, 2020
1 parent ae61b7e commit e05c94e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 9 additions & 10 deletions scripts/dts/edtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,14 @@ def _init_nodes(self):
node._init_interrupts()
node._init_pinctrls()

if self._warn_reg_unit_address_mismatch:
# This warning matches the simple_bus_reg warning in dtc
for node in self.nodes:
if node.regs and node.regs[0].addr != node.unit_addr:
self._warn("unit address and first address in 'reg' "
f"(0x{node.regs[0].addr:x}) don't match for "
f"{node.path}")

def _init_luts(self):
# Initialize node lookup tables (LUTs).

Expand Down Expand Up @@ -892,16 +900,7 @@ def unit_addr(self):
except ValueError:
_err("{!r} has non-hex unit address".format(self))

addr = _translate(addr, self._node)

# Matches the simple_bus_reg warning in dtc
if self.edt._warn_reg_unit_address_mismatch and \
self.regs and self.regs[0].addr != addr:
self.edt._warn("unit address and first address in 'reg' "
f"(0x{self.regs[0].addr:x}) don't match for "
f"{self.path}")

return addr
return _translate(addr, self._node)

@property
def description(self):
Expand Down
3 changes: 3 additions & 0 deletions scripts/dts/testedtlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ def run():
warning: please put 'required: false' instead of 'category: optional' in properties: optional: ...' in test-bindings/deprecated.yaml - 'category' will be removed
warning: 'sub-node: properties: ...' in test-bindings/deprecated.yaml is deprecated and will be removed - please give a full binding for the child node in 'child-binding:' instead (see binding-template.yaml)
warning: "#cells:" in test-bindings/deprecated.yaml is deprecated and will be removed - please put 'interrupt-cells:', 'pwm-cells:', 'gpio-cells:', etc., instead. The name should match the name of the corresponding phandle-array property (see binding-template.yaml)
warning: unit address and first address in 'reg' (0x1) don't match for /reg-zero-size-cells/node
warning: unit address and first address in 'reg' (0x5) don't match for /reg-ranges/parent/node
warning: unit address and first address in 'reg' (0x30000000200000001) don't match for /reg-nested-ranges/grandparent/parent/node
""")

#
Expand Down

0 comments on commit e05c94e

Please sign in to comment.