u-boot/drivers/power/domain
Anatolij Gustschin 3e4fcfa4bc power-domain: fix hang in endless loop on i.MX8
Currently when booting the kernel on i.MX8 U-Boot hangs in an
endless loop when switching off dma, connectivity or lsio power
domains during device removal. It hapens first when removing
gpio0 (gpio@5d080000) device, here its power domain device
'lsio_gpio0' is obtained for switching off power. Since the
obtained 'lsio_gpio0' device is removed afterwards, its power
domain is also switched off and here the parent power domain
device 'lsio_power_domain' is optained for switching off the
power. Thereafter, when the obtained 'lsio_power_domain' is
removed, device_remove() removes its first child 'lsio_gpio0'.
During this child removal the 'lsio_power_domain' device is
obtained again for switching and when removing it later,
the same child removal is repeated, so we are stuck in an
endless loop. Below is a snippet from dm tree on i.MX8QXP
for better illustration of the DM devices relationship:

 Class     Index  Probed  Driver                Name
-----------------------------------------------------------
 root          0  [ + ]   root_driver           root_driver
...
 simple_bus    0  [ + ]   generic_simple_bus    |-- imx8qx-pm
 power_doma    0  [ + ]   imx8_power_domain     |   |-- lsio_power_domain
 power_doma    1  [ + ]   imx8_power_domain     |   |   |-- lsio_gpio0
 power_doma    2  [ + ]   imx8_power_domain     |   |   |-- lsio_gpio1

Do not remove a power domain device if it is a parent of the
currently controlled device.

Fixes: 52edfed65d ("dm: core: device: switch off power domain after device removal")
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Oliver Graute <oliver.graute@gmail.com>
Reported-by: Fabio Estevam <festevam@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
2020-03-10 16:29:38 -04:00
..
bcm6328-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
imx8-power-domain-legacy.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
imx8-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
imx8m-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
Kconfig power: domain: add Amlogic Everything-Else power domain driver 2019-10-18 14:33:21 +02:00
Makefile power: domain: add i.MX8 scu power domain driver 2019-11-05 10:27:18 +01:00
meson-ee-pwrc.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
meson-gx-pwrc-vpu.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
mtk-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
power-domain-uclass.c power-domain: fix hang in endless loop on i.MX8 2020-03-10 16:29:38 -04:00
sandbox-power-domain-test.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
sandbox-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
tegra186-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
ti-sci-power-domain.c dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00