From cc6f4c8f2574472e359cb915811f6f93efdfcad4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 24 Jan 2021 14:32:46 -0700 Subject: dm: core: Add late driver remove option 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 Signed-off-by: Simon Glass --- drivers/core/root.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/core/root.c') diff --git a/drivers/core/root.c b/drivers/core/root.c index 2bfa75b4725..7ef2ec2da27 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -162,6 +162,8 @@ int dm_init(bool of_live) int dm_uninit(void) { + /* Remove non-vital devices first */ + device_remove(dm_root(), DM_REMOVE_NON_VITAL); device_remove(dm_root(), DM_REMOVE_NORMAL); device_unbind(dm_root()); gd->dm_root = NULL; -- cgit v1.2.3