Skip to content

Commit dcd8d60

Browse files
57300mbolivar-ampere
authored andcommitted
scripts: dts: Support DT_NODE_HAS_PROP(node_id, ranges)
This is a one-line fix for edtlib, which lets gen_defines.py indicate whether the `ranges` property exists within a given node. Although address translation through ranges is typically automatic, users can choose to manually inspect ranges using DT_FOREACH_RANGE(), DT_NUM_RANGES(), and other DT_RANGES_* macros. These can be used to implement manual translation at runtime, which is currently done for PCIe controllers. The only thing missing is being able to check if a node contains an empty `ranges;`, which signifies a 1:1 translation to the parent bus. Checking DT_NUM_RANGES() is insufficient, because it returns zero whether or not `ranges;` is present. It should be possible to use DT_NODE_HAS_PROP(), but it was not working, because edtlib ignores properties which are undeclared in bindings and don't have a default type. Add a missing PropertySpec for `ranges` with "compound" type; it can't be "array" because it can be empty-valued. Signed-off-by: Grzegorz Swiderski <[email protected]>
1 parent daac517 commit dcd8d60

File tree

1 file changed

+1
-0
lines changed
  • scripts/dts/python-devicetree/src/devicetree

1 file changed

+1
-0
lines changed

scripts/dts/python-devicetree/src/devicetree/edtlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,6 +3176,7 @@ class _BindingLoader(Loader):
31763176
_DEFAULT_PROP_TYPES: Dict[str, str] = {
31773177
"compatible": "string-array",
31783178
"status": "string",
3179+
"ranges": "compound", # NUMS or EMPTY
31793180
"reg": "array",
31803181
"reg-names": "string-array",
31813182
"label": "string",

0 commit comments

Comments
 (0)