[PATCH] dm: automatically set DM_FLAG_PRE_RELOC based on device-tree property

Marek Vasut marex at denx.de
Thu Sep 22 15:53:46 CEST 2022


On 9/22/22 15:45, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> 
> One needs to set u-boot,dm-pre-reloc in a device Device Tree node so
> that it is kept in SPL/TPL variant of the device tree. However, a device
> is automatically probed only if it's flagged with DM_FLAG_PRE_RELOC,
> regardless of u-boot,dm-pre-reloc DT property presence. This flag is
> currently only set by drivers directly.
> 
> However, this flag should be allowed to be set on a per-device basis
> even if the driver does not hardcode it so that the device will be
> probed in SPL/TPL regardless of the driver's defaults.
> 
> This sets the DM_FLAG_PRE_RELOC for all U_BOOT_CLASS devices whose DT
> node contains the u-boot,dm-pre-reloc property.
> 
> Cc: Quentin Schulz <foss+uboot at 0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
> ---
>   drivers/core/lists.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/core/lists.c b/drivers/core/lists.c
> index c49695b24f..86b75ffede 100644
> --- a/drivers/core/lists.c
> +++ b/drivers/core/lists.c
> @@ -260,6 +260,9 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
>   				ret);
>   			return log_msg_ret("bind", ret);
>   		} else {
> +			if (ofnode_pre_reloc(node))
> +				dev_or_flags(dev, DM_FLAG_PRE_RELOC);
> +
>   			found = true;
>   			if (devp)
>   				*devp = dev;

Reviewed-by: Marek Vasut <marex at denx.de>

Tom, this does look like a bugfix for this release, but it would be good 
to have Simon look over this too.


More information about the U-Boot mailing list