From: Torsten Duwe <[email protected]> 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 <[email protected]> Signed-off-by: Torsten Duwe <[email protected]> --- 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

