Skip to content

Commit fb02181

Browse files
authored
Merge pull request #11638 from dhalbert/zephyr-cp-static-board-buses
zephyr-cp: restore fixed board buses on non-nRF boards
2 parents 246a7ab + 4815d5a commit fb02181

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

‎ports/zephyr-cp/cptools/zephyr2cp.py‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,16 +1433,21 @@ def zephyr_dts_to_cp_board(board_id, portdir, builddir, zephyrbuilddir, mpconfig
14331433

14341434
# Bus instances the board enabled with all-disconnected pins are routed to
14351435
# arbitrary pins at runtime by busio objects instead of being exposed as
1436-
# fixed board.X() singletons.
1436+
# fixed board.X() singletons. For now only nRF has iobroker routing. Other
1437+
# SoCs' pinctrl states have no psels, so all() of the empty list would
1438+
# wrongly mark every one of their buses as routable.
1439+
#
1440+
# TODO: add iobroker routing for the non-nRF SoCs.
14371441
iobroker_labels = set()
1438-
for driver in BUSIO_CLASSES:
1439-
for labels in active_zephyr_devices.get(driver, []):
1440-
node = device_tree.label2node[labels[0]]
1441-
psels = _pinctrl_default_psels(node)
1442-
if psels is not None and all(
1443-
(value & NRF_PIN_FIELD_MASK) == NRF_PIN_FIELD_MASK for value in psels
1444-
):
1445-
iobroker_labels.add(labels[0])
1442+
if pinctrl_nrf:
1443+
for driver in BUSIO_CLASSES:
1444+
for labels in active_zephyr_devices.get(driver, []):
1445+
node = device_tree.label2node[labels[0]]
1446+
psels = _pinctrl_default_psels(node)
1447+
if psels is not None and all(
1448+
(value & NRF_PIN_FIELD_MASK) == NRF_PIN_FIELD_MASK for value in psels
1449+
):
1450+
iobroker_labels.add(labels[0])
14461451

14471452
# The zephyr,console and zephyr,shell-uart UARTs belong to Zephyr, so they
14481453
# are never board objects.

0 commit comments

Comments
 (0)