mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-26 05:34:30 +08:00
dm: core: device: switch off power domain after device removal
The power domain associated with a device is enabled when probing, but currently the domain remains enabled when the device is removed. Some boards started to disable power domains for selected devices via custom board_quiesce_devices(), but it doesn't work in many cases, i. e. because devices still can be accessed later in .remove() callback on behalf of dm_remove_devices_flags(). Utilize the DM core to power off the device power domain, but add a device flag to be able to selectively let the power domain enabled after device removal. This might be required for devices that must remain enabled when booting OS, i. e. serial console for debug output, etc. Signed-off-by: Anatolij Gustschin <agust@denx.de> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
0cf795a802
commit
52edfed65d
@ -16,6 +16,7 @@
|
||||
#include <dm/uclass.h>
|
||||
#include <dm/uclass-internal.h>
|
||||
#include <dm/util.h>
|
||||
#include <power-domain.h>
|
||||
|
||||
int device_chld_unbind(struct udevice *dev, struct driver *drv)
|
||||
{
|
||||
@ -192,6 +193,10 @@ int device_remove(struct udevice *dev, uint flags)
|
||||
}
|
||||
}
|
||||
|
||||
if (!(drv->flags & DM_FLAG_DEFAULT_PD_CTRL_OFF) &&
|
||||
(dev != gd->cur_serial_dev))
|
||||
dev_power_domain_off(dev);
|
||||
|
||||
if (flags_remove(flags, drv->flags)) {
|
||||
device_free(dev);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user