
From: Marek Vasut marek.vasut@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@gmail.com Signed-off-by: Simon Glass sjg@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!