[PATCH v5 7/9] dm: core: Add late driver remove option

Simon Glass sjg at chromium.org
Thu Feb 4 02:53:57 CET 2021


From: Marek Vasut <marek.vasut at gmail.com>

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>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v5:
- Change logic to allow flags to be combined

Changes in v4:
- Use 'vital' rather than 'late' as the description
- Invert the removal flag to DM_REMOVE_NON_VITAL, to avoid the need for
        two-pass processing in the bowels of driver model
- Simplify the test to only test 'vital'
- Drop the change to uclass_destroy()

 drivers/core/device-remove.c | 39 ++++++++++++---
 drivers/core/root.c          |  2 +
 include/dm/device-internal.h | 10 ++--
 include/dm/device.h          | 10 +++-
 test/dm/core.c               | 94 ++++++++++++++++++++++++++++++++++++
 test/dm/test-driver.c        | 22 +++++++++
 6 files changed, 165 insertions(+), 12 deletions(-)

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list