zephyr/scripts/dts
Johan Hedberg 4ba387829b edtlib: Match any parent bus when binding lacks an explicit on-bus
There are some drivers in the tree that support devices on multiple
different buses, although so far this has not been represented in
device tree using the bus concept. In order to convert these drivers &
bindings to refer to a formal bus in device tree we need to be able to
match bindings which lack an explicit "on-bus: ..." value against any
parent bus. This will also be needed for any external bindings, since
those would not be aware of on-bus (as it's a Zephyhr-specific
extension).

The two drivers I'm particularly targeting is the ns16550 UART driver
(drivers/serial/uart_ns16550.c) and the DW I2C driver
(drivers/i2c/i2c_dw.c). They both support devices with a fixed MMIO
address as well as devices connected and discovered over PCIe. The
only issue is that instead of encoding the bus information the proper
DT way these bindings use a special "pcie" property in the DT node
entries to indicate whether the node is on the PCIe bus or not.

Being able to convert the above two drivers to use the DT bus concept
allow the removal of "hacks" like this:

 if DT_INST_PROP(0, pcie) || \
       DT_INST_PROP(1, pcie) || \
       DT_INST_PROP(2, pcie) || \
       DT_INST_PROP(3, pcie)

to the more intuitive:

 if DT_ANY_INST_ON_BUS_STATUS_OKAY(pcie)

This also has the benefit that the driver doesn't need to make any
arbitrary assumptions of how many matching devices there may be but
works for any number of matches. This is already a problem now since
e.g. the ns16550 driver assumes a maximum of 4 nodes, whereas
dts/x86/elkhart_lake.dtsi defines up to 9 different ns16550 nodes.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2021-01-07 20:07:12 +02:00
..
test-bindings edtlib: Match any parent bus when binding lacks an explicit on-bus 2021-01-07 20:07:12 +02:00
test-bindings-2 scripts: edtlib.py: Deprecate 'title:' 2019-12-18 11:52:45 +01:00
dtlib.py scripts: dts: convert test suites to pytest 2020-10-02 11:51:15 +02:00
edtlib.py edtlib: Match any parent bus when binding lacks an explicit on-bus 2021-01-07 20:07:12 +02:00
gen_defines.py dts: handle unspecified phandle-array elements 2020-12-22 07:34:29 -06:00
grutils.py scripts: grutils: tweak sort keys to group siblings 2020-02-04 07:28:45 -06:00
test-multidir.dts scripts: dts: Add test for multiple binding directories 2019-08-03 14:17:49 -04:00
test.dts edtlib: Match any parent bus when binding lacks an explicit on-bus 2021-01-07 20:07:12 +02:00
testdtlib.py scripts: dts: convert test suites to pytest 2020-10-02 11:51:15 +02:00
testedtlib.py edtlib: Match any parent bus when binding lacks an explicit on-bus 2021-01-07 20:07:12 +02:00