
On 3/22/24 5:55 AM, Sumit Garg wrote:
Hi,
I think if people are concerned about power consumption then it should be implemented properly in U-Boot to remove all the DT based devices before passing on control to the next stage.
I would expect imx8mp_hsiomix_off() to be called either on 'usb stop' or just before Linux boots (esp. at that point), so if you do not power off the bus domain before booting Linux, you may hand over a device which was not fully power cycled.
Unfortunately that's the current situation I see. IMO, the better solution would be to just remove all the DT devices before passing on control to Linux. That should automatically power off devices.
Doesn't CONFIG_DM_DEVICE_REMOVE=y do something like that already ?
I just did simple experiment via following diff:
diff --git a/drivers/power/domain/imx8mp-hsiomix.c b/drivers/power/domain/imx8mp-hsiomix.c index 6188a04c45e..0ddcd39923a 100644 --- a/drivers/power/domain/imx8mp-hsiomix.c +++ b/drivers/power/domain/imx8mp-hsiomix.c @@ -101,6 +101,7 @@ static int imx8mp_hsiomix_set(struct power_domain *power_domain, bool power_on) if (gpr_reg0_bits) setbits_le32(priv->base + GPR_REG0, gpr_reg0_bits); } else {
while(1); if (gpr_reg0_bits) clrbits_le32(priv->base + GPR_REG0, gpr_reg0_bits);
The boot doesn't hang suggesting that CONFIG_DM_DEVICE_REMOVE=y isn't effective to remove any DT devices. It can for sure be another followup series to make it effective.
That's odd. Please try and edit drivers/core/device-remove.c , look up device_remove() at the end , and see if the remove is being called on the hsiomix device . You might need to add some sort of printf() there, but that's where the removal happens.
The removal before boot is I think called from drivers/core/root.c dm_remove_devices_flags(), which itself is called from arch/arm/lib/bootm.c announce_and_cleanup() .