[PATCH 1/3] core: Skip parent device nodes without a DT reference when looking for dma-ranges

Torsten Duwe duwe at lst.de
Fri May 8 17:42:39 CEST 2026


From: Torsten Duwe <duwe at suse.de>

If a device node got created dynamically, there is no guarantee that the
parent node has an associated device tree node which could specify dma
constraints. Especially PCI(e) enumeration adds intermediate "bus nodes",
also dynamically.

Try harder to find the correct configuration by walking up the tree until
a DT association is found.

Suggested-by: Neil Armstrong <neil.armstrong at linaro.org>
Signed-off-by: Torsten Duwe <duwe at suse.de>

---
 drivers/core/device.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 779f371b9d5..9de64dbb3c5 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -459,7 +459,19 @@ static int device_get_dma_constraints(struct udevice *dev)
 	u64 size = 0;
 	int ret;
 
-	if (!CONFIG_IS_ENABLED(DM_DMA) || !parent || !dev_has_ofnode(parent))
+	if (!CONFIG_IS_ENABLED(DM_DMA) || !parent)
+		return 0;
+
+	/* Look for the first node in the parent chain */
+	while (parent) {
+		if (dev_has_ofnode(parent))
+			break;
+
+		parent = dev_get_parent(parent);
+	}
+
+	/* No parents have a node, bail out */
+	if (!parent)
 		return 0;
 
 	/*
-- 
2.54.0



More information about the U-Boot mailing list