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

Matthias Brugger mbrugger at suse.com
Wed Jul 8 13:22:37 CEST 2026



On 06/07/2026 19:21, Torsten Duwe wrote:
> 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>
> Reviewed-by: Peter Robinson <pbrobinson at gmail.com>
> Tested-by: Peter Robinson <pbrobinson at gmail.com>

Reviewed-by: Matthias Brugger <mbrugger at suse.com>

> ---
>   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 d365204ba11..b6d00cf4714 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;
>   
>   	/*



More information about the U-Boot mailing list