[PATCH V3] dm: core: Add late driver remove option
Simon Glass
sjg at chromium.org
Sun Nov 22 00:07:39 CET 2020
Hi Tom,
On Wed, 18 Nov 2020 at 08:53, Tom Rini <trini at konsulko.com> wrote:
>
> On Wed, Nov 18, 2020 at 07:37:27AM -0700, Simon Glass wrote:
> > Hi Marek,
> >
> > On Sun, 15 Nov 2020 at 06:19, Marek Vasut <marex at denx.de> wrote:
> > >
> > > On 11/9/20 1:21 AM, Simon Glass wrote:
> > > > Hi Marek,
> > >
> > > [...]
> > >
> > > >> diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
> > > >> index 1206e306db..f9091a3d41 100644
> > > >> --- a/arch/arm/lib/bootm.c
> > > >> +++ b/arch/arm/lib/bootm.c
> > > >> @@ -120,6 +120,7 @@ static void announce_and_cleanup(int fake)
> > > >> * of DMA operation or releasing device internal buffers.
> > > >> */
> > > >> dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);
> > > >> + dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL | DM_REMOVE_LATE);
> > > >
> > > > Please see my previous comments about the naming and semantics. I'm
> > > > repeating them here:
> > > >
> > > > Firstly I think we should use a different name. 'Late' doesn't really
> > > > tell me anything.
> > > >
> > > > If I understand it correctly, this is supposed to be after OS_PREPARE
> > > > but before booting the OS?
> > >
> > > No. The drivers which are marked as remove-late should be removed late,
> > > after all the normal drivers were removed. The example in the commit
> > > message explains where this is needed -- first remove mmc driver to set
> > > eMMC out of HS mode and change the bus clock and after that remove clock
> > > driver ; the clock driver is still required during the removal of the
> > > mmc driver.
> > >
> > > > I think we need to separate the flag names as they are too similar.
> > > >
> > > > I think DM_FLAG_BASIC and DM_REMOVE_NON_BASIC would be better (or some
> > > > term that explains that this is a device used by many others)
> > > >
> > > > If BASIC is too terrible, perhaps CORE, or VITAL, or PRIME or CRITICAL
> > > > or something like that?
> > >
> > > This makes no sense to me.
> >
> > I don't want the word 'late'. Then we'll end up with 'later' and
> > 'fairly late', etc. and it will get out of hand. We need a word that
> > describes what is special about the devices, not when to do stuff with
> > them.
> >
> > >
> > > > That way we are describing the property of the device rather than what
> > > > we want to do with it.
> > >
> > > The device is not critical or vital, it just needs to be torn down late.
> >
> > What is it about the device that requires it to be torn down 'late'?
>
> I think perhaps the problem isn't that it needs to be "late", it's that
> it has perhaps not obviously described children. Which gets back to
> what you just said as well about "later" and "fairly late". It's an
> ordering problem.
Yes it is.
We currently don't record devices that depend on others. It would be
possible to add a refcount to DM to cope with this and implement it
for clocks. I wonder if that might be better than what we have here?
Regards,
Simon
More information about the U-Boot
mailing list