Hi Jonas, On Sat, 5 Aug 2023 at 07:32, Jonas Karlman <jo...@kwiboo.se> wrote: > > Devices for nodes with e.g. bootph-pre-ram are initialized three times. > 1. At SPL stage (always bind and probe only if used) > 2. At U-Boot proper pre-reloc (always bind and probe) > 3. At U-Boot proper normal (always bind and probe only if used) > > Change ofnode_pre_reloc to report a node with bootph-pre-ram/sram prop > with a pre-reloc status only after U-Boot proper pre-relocation stage. > This prevents the device from being probed at U-Boot proper pre-reloc. > > Signed-off-by: Jonas Karlman <jo...@kwiboo.se> > --- > I am not sure if U-Boot proper pre-reloc behaves like this by design and > if there is some other way to signal that a device should not be probed > during U-Boot proper pre-reloc stage if it has been probed at SPL stage. > > For my use-case I added bootph-pre-ram prop to my RK8xx device node to > make the PMIC usable in SPL. However, I have no need for this device to > probe at U-Boot proper pre-reloc stage just after jumping out of TF-A. > And moments later bind and probe yet again at U-Boot proper normal stage. > > The bootph-pre-ram prop was used to have the device usable in SPL, else > I could have used bootph-all or added bootph-some-ram prop to indicate > use at U-Boot proper pre-reloc stage.
This is changing how things work...we really need to have something explicit to use this new behaviour. Perhaps we can augment the binding in some way? > > drivers/core/ofnode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c > index 8df16e56af5c..ebd5a408ae58 100644 > --- a/drivers/core/ofnode.c > +++ b/drivers/core/ofnode.c > @@ -1353,7 +1353,7 @@ bool ofnode_pre_reloc(ofnode node) > */ > if (ofnode_read_bool(node, "bootph-pre-ram") || > ofnode_read_bool(node, "bootph-pre-sram")) > - return true; > + return !!(gd->flags & GD_FLG_RELOC); I believe that the compiler knows how to convert 'gd->flags & GD_FLG_RELOC' into a bool, so !! is not needed. > > if (IS_ENABLED(CONFIG_OF_TAG_MIGRATE)) { > /* detect and handle old tags */ > -- > 2.41.0 > Regards, Simon