[PATCH 1/3] [RFC] dm: core: Add late driver remove option

Simon Glass sjg at chromium.org
Tue Apr 28 00:25:04 CEST 2020


Hi Marek,

On Sun, 26 Apr 2020 at 04:52, Marek Vasut <marek.vasut at gmail.com> wrote:
>
> Add another flag to the DM core which could be assigned to drivers and
> which makes those drivers call their remove callbacks last, just before
> booting OS and after all the other drivers finished with their remove
> callbacks. This is necessary for things like clock drivers, where the
> other drivers might depend on the clock driver in their remove callbacks.
> Prime example is the mmc subsystem, which can reconfigure a card from HS
> mode to slower modes in the remove callback and for that it needs to
> reconfigure the controller clock.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  arch/arm/lib/bootm.c         |  1 +
>  drivers/core/device-remove.c | 11 ++++++++---
>  drivers/core/root.c          |  2 ++
>  include/dm/device.h          |  4 ++++
>  4 files changed, 15 insertions(+), 3 deletions(-)

I think this solution is simpler than trying to track device
dependencies, something that driver model currently makes no attempt
to do.

It does need a test though.

Regards,
Simon


More information about the U-Boot mailing list