diff mbox series

dm: automatically set DM_FLAG_PRE_RELOC based on device-tree property

Message ID 20220922134540.3268586-1-foss+uboot@0leil.net
State Superseded
Delegated to: Simon Glass
Headers show
Series dm: automatically set DM_FLAG_PRE_RELOC based on device-tree property | expand

Commit Message

Quentin Schulz Sept. 22, 2022, 1:45 p.m. UTC
From: Quentin Schulz <quentin.schulz@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@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 drivers/core/lists.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Marek Vasut Sept. 22, 2022, 1:53 p.m. UTC | #1
On 9/22/22 15:45, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@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@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@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@denx.de>

Tom, this does look like a bugfix for this release, but it would be good 
to have Simon look over this too.
Quentin Schulz Sept. 22, 2022, 3:55 p.m. UTC | #2
Hi all,

On 9/22/22 15:45, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@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@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This patch can be abandoned, it is now superseded by:
https://lore.kernel.org/u-boot/20220922155326.3293815-1-foss+uboot@0leil.net/

Cheers,
Quentin
Tom Rini Sept. 29, 2022, 2:34 p.m. UTC | #3
On Thu, Sep 22, 2022 at 03:53:46PM +0200, Marek Vasut wrote:
> On 9/22/22 15:45, Quentin Schulz wrote:
> > From: Quentin Schulz <quentin.schulz@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@0leil.net>
> > Signed-off-by: Quentin Schulz <quentin.schulz@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@denx.de>
> 
> Tom, this does look like a bugfix for this release, but it would be good to
> have Simon look over this too.

Cycling back here, I would like to hear what Simon thinks here.
Quentin Schulz Sept. 29, 2022, 3:23 p.m. UTC | #4
Hi Tom,

On 9/29/22 4:34 PM, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Sep 22, 2022 at 03:53:46PM +0200, Marek Vasut wrote:
> > On 9/22/22 15:45, Quentin Schulz wrote:
> >> From: Quentin Schulz <quentin.schulz@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@0leil.net>
> >> Signed-off-by: Quentin Schulz <quentin.schulz@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@denx.de>
> >
> > Tom, this does look like a bugfix for this release, but it would be good to
> > have Simon look over this too.
> 
> Cycling back here, I would like to hear what Simon thinks here.
> 

This patch is superseded by https://lore.kernel.org/u-boot/20220922155326.3293815-1-foss+uboot@0leil.net/, please abandon it.

Cheers,
Quentin
Tom Rini Sept. 29, 2022, 3:24 p.m. UTC | #5
On Thu, Sep 29, 2022 at 05:23:15PM +0200, quentin.schulz@theobroma-systems.com wrote:
> Hi Tom,
> 
> On 9/29/22 4:34 PM, Tom Rini <trini@konsulko.com> wrote:
> > On Thu, Sep 22, 2022 at 03:53:46PM +0200, Marek Vasut wrote:
> > > On 9/22/22 15:45, Quentin Schulz wrote:
> > >> From: Quentin Schulz <quentin.schulz@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@0leil.net>
> > >> Signed-off-by: Quentin Schulz <quentin.schulz@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@denx.de>
> > >
> > > Tom, this does look like a bugfix for this release, but it would be good to
> > > have Simon look over this too.
> > 
> > Cycling back here, I would like to hear what Simon thinks here.
> > 
> 
> This patch is superseded by https://lore.kernel.org/u-boot/20220922155326.3293815-1-foss+uboot@0leil.net/, please abandon it.

Done, thanks!
diff mbox series

Patch

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;