Skip to contentSkip to conversation

power: domain: add dev_power_domain_on

PATCH New Peng Fan 4 participants 17 messages Sep 27, 2019 – Jan 21, 2020

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v3 1/2 power: domain: add dev_power_domain_on

Add this new API to power on multiple domains attached to a device.

---

V3:
Fix build break
Add R-b tag
V2:
create dev_power_domain_on

 drivers/power/domain/power-domain-uclass.c | 22 ++++++++++++++++++++++
 include/power-domain.h                     | 17 +++++++++++++++++
 2 files changed, 39 insertions(+)
drivers/power/domain/power-domain-uclass.c +22 -0
index 2ea0ff24c7..6eb4267de3 100644
@@ -107,6 +107,28 @@ int power_domain_off(struct power_domain *power_domain)
 	return ops->off(power_domain);
 }
 
+
+#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
+int dev_power_domain_on(struct udevice *dev)
+{
+	struct power_domain pd;
+	int i, count, ret;
+
+	count = dev_count_phandle_with_args(dev, "power-domains",
+					    "#power-domain-cells");
+	for (i = 0; i < count; i++) {
+		ret = power_domain_get_by_index(dev, &pd, i);
+		if (ret)
+			return ret;
+		ret = power_domain_on(&pd);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
+}
+#endif
+
 UCLASS_DRIVER(power_domain) = {
 	.id		= UCLASS_POWER_DOMAIN,
 	.name		= "power_domain",
include/power-domain.h +17 -0
index ef15dc9f60..490fedbb12 100644
@@ -155,4 +155,21 @@ static inline int power_domain_off(struct power_domain *power_domain)
 }
 #endif
 
+/**
+ * dev_power_domain_on - Enable power domains for a device .
+ *
+ * @dev:		The client device.
+ *
+ * @return 0 if OK, or a negative error code.
+ */
+#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) && \
+	CONFIG_IS_ENABLED(POWER_DOMAIN)
+int dev_power_domain_on(struct udevice *dev);
+#else
+static inline int dev_power_domain_on(struct udevice *dev)
+{
+	return 0;
+}
+#endif
+
 #endif
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

When multiple power domains attached to a device, need power on them all, so use dev_power_domain_on to do that.

---

V3:
Add R-b tag
V2:
Use dev_power_domain_on

 drivers/core/device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/core/device.c +3 -3
index 05dadf98f9..f4d7140698 100644
@@ -307,7 +307,6 @@ static void *alloc_priv(int size, uint flags)
 
 int device_probe(struct udevice *dev)
 {
-	struct power_domain pd;
 	const struct driver *drv;
 	int size = 0;
 	int ret;
@@ -390,8 +389,9 @@ int device_probe(struct udevice *dev)
 
 	if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
 	    device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
-		if (!power_domain_get(dev, &pd))
-			power_domain_on(&pd);
+		ret = dev_power_domain_on(dev);
+		if (ret)
+			goto fail;
 	}
 
 	ret = uclass_pre_probe_device(dev);
Signature · 1 line
2.16.4
#2 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hello Peng,

this patch broke my u-boot on a IMX8 QM ROM 7720a1 board.

f0cc4eae9a1702a768817ea25d9f23cece69d021

I bisect it and that is the first broken commit. The commits before are working fine.

I tried to remove your changes but then I run into this errrors:

sc_rm_get_memreg_info: mr:38 res:22
Memreg get info failed, -110
mu_hal_sendmsg timeout
sc_rm_is_memreg_owned: mr:39 res:21
sc_rm_is_memreg_owned: mr:39 res:21
mu_hal_sendmsg timeout

Some clue whats wrong here? Do I need to adapt my imx8qm board file?

Best regards,

Oliver

author
#3 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Quoted 13 lines

Subject: [U-Boot] [PATCH V3 2/2] core: device: use dev_power_domain_on

Hello Peng,

this patch broke my u-boot on a IMX8 QM ROM 7720a1 board.

f0cc4eae9a1702a768817ea25d9f23cece69d021

I bisect it and that is the first broken commit. The commits before are working fine.

I tried to remove your changes but then I run into this errrors:

Quoted 8 lines

sc_rm_get_memreg_info: mr:38 res:22
Memreg get info failed, -110
mu_hal_sendmsg timeout
sc_rm_is_memreg_owned: mr:39 res:21
sc_rm_is_memreg_owned: mr:39 res:21
mu_hal_sendmsg timeout

Some clue whats wrong here? Do I need to adapt my imx8qm board file?

Update your scfw/atf and they try again.

Regards,
Peng.

Quoted 4 lines

Best regards,

Oliver

#4 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Peng,

Quoted 1 line · Peng Fan

Update your scfw/atf and they try again.

Please update board/freescale/imx8qm_mek/README to point to the correct ATF/SCFW versions.

#5 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

In reply to Peng Fan

Hi Oliver,

Quoted 1 line · Peng Fan

Update your scfw/atf and they try again.

Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?

#6 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Quoted 7 lines · Fabio Estevam

Hi Oliver,

Quoted 1 line · Peng Fan

Update your scfw/atf and they try again.

Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?

Unfortunately, not. I checked out imx-atf in that branch. Build it with:

make PLAT=imx8qm bl31

copied the resulting bl31.bin into my u-boot folder and rebuild that.

But the imx8qm board is not booting with the resulting u-boot.

do I need a new scfw from my vendor?

Best Regards,

Oliver

#7 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Oliver, Fabio, Peng,

Quoted 16 lines · Oliver Graute
Quoted 7 lines · Fabio Estevam

Hi Oliver,

Quoted 1 line · Peng Fan

Update your scfw/atf and they try again.

Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?

Unfortunately, not. I checked out imx-atf in that branch. Build it with:

make PLAT=imx8qm bl31

copied the resulting bl31.bin into my u-boot folder and rebuild that.

Quoted 7 lines

But the imx8qm board is not booting with the resulting u-boot.

do I need a new scfw from my vendor?

Best Regards,

Oliver

FYI,

I do face the same boot issues on colibri-imx8qxp_defconfig , In my case using imx_4.19.35_1.0.0 TF-A(ATF) doesn't help too.

Bi-secting also points to this commit.

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#8 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Igor,

Quoted 4 lines · Igor Opaniuk

I do face the same boot issues on colibri-imx8qxp_defconfig , In my case using imx_4.19.35_1.0.0 TF-A(ATF) doesn't help too.

Bi-secting also points to this commit.

As we are close to the release, I think we should do a revert.

Could you please send a revert patch to fix the regression?

Thanks

#9 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Fabio,

Quoted 5 lines · On Mon, Dec 16, 2019, 18:24 Fabio Estevam <[email protected]> wrote:

Hi Igor,

On Mon, Dec 16, 2019 at 12:29 PM Igor Opaniuk <[email protected]> wrote:

Quoted 9 lines
Quoted 4 lines

I do face the same boot issues on colibri-imx8qxp_defconfig , In my case using imx_4.19.35_1.0.0 TF-A(ATF) doesn't help too.

Bi-secting also points to this commit.

As we are close to the release, I think we should do a revert.

Could you please send a revert patch to fix the regression?

Sure, will do tomorrow morning asap.Btw, there is also a regression in MMC subsystem (currently AFK, will look into it and provide more details also tomorrow), probably the same as explained in the "i.MX8MM-EVK Boot failure" thread.
Thanks

Quoted 2 lines

Thanks

#10 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Igor,

Quoted 1 line · Igor Opaniuk

Sure, will do tomorrow morning asap.Btw, there is also a regression in MMC subsystem (currently AFK, will look into it and provide more details also tomorrow), probably the same as explained in the "i.MX8MM-EVK Boot failure" thread.

What is the MMC error you see?

It seems we need an equivalent of kernelci.org in U-Boot. We are seeing lots of regression and we are close to the release.

#11 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Fabio,

Quoted 8 lines · Fabio Estevam

Hi Igor,

Quoted 1 line · Igor Opaniuk

Sure, will do tomorrow morning asap.Btw, there is also a regression in MMC subsystem (currently AFK, will look into it and provide more details also tomorrow), probably the same as explained in the "i.MX8MM-EVK Boot failure" thread.

What is the MMC error you see?

U-Boot 2019.10-00071-g9c1e982218 (Dec 17 2019 - 12:37:14 +0200)

CPU: NXP i.MX8QXP RevB A35 at 1200 MHz

DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1

Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment

In:    serial at 5a090000
Out:   serial at 5a090000
Err:   serial at 5a090000
Card did not respond to voltage select!
MMC init failed
MISSING TORADEX CONFIG BLOCK
Model: Toradex Colibri iMX8X
Build: SCFW 494c97f3
Boot:  USB
Net:   Could not get PHY for FEC0: addr 2
eth-1: ethernet at 5b040000
Hit any key to stop autoboot:  0
Quoted 2 lines

It seems we need an equivalent of kernelci.org in U-Boot. We are seeing lots of regression and we are close to the release.

BTW, we are currently working (internally in Toradex) on LAVA-based solution for testing both U-boot (hopefully Linaro finally added support for testing bootloaders, [1]) and Linux kernel.

We plan to automate testing of both BSP downstream and mainline trees, so it makes sense to configure (that's still under discussion) some interaction with ML, for example sending notification about regressions/automatic bi-secting results (analog of
syzbot emails in LKML) etc.

If you have any ideas - we're open to any suggestions/input.

[1] https://connect.linaro.org/resources/bkk19/bkk19-409/

Thanks

--
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

#12 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Quoted 22 lines · Igor Opaniuk

Fabio,

Quoted 8 lines · Fabio Estevam

Hi Igor,

Quoted 1 line · Igor Opaniuk

Sure, will do tomorrow morning asap.Btw, there is also a regression in MMC subsystem (currently AFK, will look into it and provide more details also tomorrow), probably the same as explained in the "i.MX8MM-EVK Boot failure" thread.

What is the MMC error you see?

U-Boot 2019.10-00071-g9c1e982218 (Dec 17 2019 - 12:37:14 +0200)

CPU: NXP i.MX8QXP RevB A35 at 1200 MHz

DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1

Loading Environment from MMC... Card did not respond to voltage select! *** Warning - No block device, using default environment

Quoted 12 lines
In:    serial at 5a090000
Out:   serial at 5a090000
Err:   serial at 5a090000
Card did not respond to voltage select!
MMC init failed
MISSING TORADEX CONFIG BLOCK
Model: Toradex Colibri iMX8X
Build: SCFW 494c97f3
Boot:  USB
Net:   Could not get PHY for FEC0: addr 2
eth-1: ethernet at 5b040000
Hit any key to stop autoboot:  0

Sorry for the noise about mmc, there was a bug introduced in c20851b3d8("dm: pinctrl: introduce PINCONF_RECURSIVE option"), which is already fixed in 44510daea4("dm: pinctrl: fix for introduce PINCONF_RECURSIVE option")

Quoted 30 lines
Quoted 4 lines

It seems we need an equivalent of kernelci.org in U-Boot. We are seeing lots of regression and we are close to the release.

BTW, we are currently working (internally in Toradex) on LAVA-based solution for testing both U-boot (hopefully Linaro finally added support for testing bootloaders, [1]) and Linux kernel.

We plan to automate testing of both BSP downstream and mainline trees, so it makes sense to configure (that's still under discussion) some interaction with ML, for example sending notification about regressions/automatic bi-secting results (analog of
syzbot emails in LKML) etc.

If you have any ideas - we're open to any suggestions/input.

[1] https://connect.linaro.org/resources/bkk19/bkk19-409/

Thanks

--
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk

Signature · 8 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+380 (93) 836 40 67
http://ua.linkedin.com/in/iopaniuk
#13 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

Hi Igor,

Quoted 4 lines · Igor Opaniuk

Sorry for the noise about mmc, there was a bug introduced in c20851b3d8("dm: pinctrl: introduce PINCONF_RECURSIVE option"), which is already fixed in 44510daea4("dm: pinctrl: fix for introduce PINCONF_RECURSIVE option")

Excellent: one less regression for us to care about then :-)

#14 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

In reply to Igor Opaniuk

Hi Igor,

Quoted 1 line · Igor Opaniuk

U-Boot 2019.10-00071-g9c1e982218 (Dec 17 2019 - 12:37:14 +0200)

Does it also happen with 2020.01-rc5?

Quoted 5 lines

CPU: NXP i.MX8QXP RevB A35 at 1200 MHz

DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1

Loading Environment from MMC... Card did not respond to voltage select!

Looks like a different MMC issue than the one we saw with i.MX8MM EVK.

Quoted 11 lines

BTW, we are currently working (internally in Toradex) on LAVA-based solution for testing both U-boot (hopefully Linaro finally added support for testing bootloaders, [1]) and Linux kernel.

We plan to automate testing of both BSP downstream and mainline trees, so it makes sense to configure (that's still under discussion) some interaction with ML, for example sending notification about regressions/automatic bi-secting results (analog of
syzbot emails in LKML) etc.

If you have any ideas - we're open to any suggestions/input.

It would be very helpful to have regression notifications in the U-Boot mailing lists.

Thanks

author
#15 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

In reply to Fabio Estevam
Quoted 8 lines

Subject: Re: [U-Boot] [PATCH V3 2/2] core: device: use dev_power_domain_on

Hi Igor,

On Mon, Dec 16, 2019 at 12:29 PM Igor Opaniuk <[email protected]> wrote:

Quoted 8 lines
Quoted 4 lines

I do face the same boot issues on colibri-imx8qxp_defconfig , In my case using imx_4.19.35_1.0.0 TF-A(ATF) doesn't help too.

Bi-secting also points to this commit.

As we are close to the release, I think we should do a revert.

Could you please send a revert patch to fix the regression?

No, the previous method not check return value of power domain on, so even if fails, it still continue. However this patch will check the return value, if power fails, if will return failure. I think this is the issue, you need check which power domain fails in your side.
Revert this patch is not good.

Thanks,
Peng.

Quoted 2 lines

Thanks

#16 lore raw

PATCH v3 2/2 core: device: use dev_power_domain_on

In reply to Igor Opaniuk
Quoted 26 lines · Igor Opaniuk

Hi Oliver, Fabio, Peng,

Quoted 22 lines · Oliver Graute
Quoted 7 lines · Fabio Estevam

Hi Oliver,

Quoted 1 line · Peng Fan

Update your scfw/atf and they try again.

Does it boot if you use the imx_4.19.35_1.0.0 ATF branch?

Unfortunately, not. I checked out imx-atf in that branch. Build it with:

make PLAT=imx8qm bl31

copied the resulting bl31.bin into my u-boot folder and rebuild that.

But the imx8qm board is not booting with the resulting u-boot.

do I need a new scfw from my vendor?

Best Regards,

Quoted 8 lines
Quoted 1 line

Oliver

FYI,

I do face the same boot issues on colibri-imx8qxp_defconfig , In my case using imx_4.19.35_1.0.0 TF-A(ATF) doesn't help too.

Bi-secting also points to this commit.

Did you made some progress here?

I tried this combination but without success for the imx8qm_rom_7720:

u-boot 2020.01
imx-atf imx_4.19.35_1.1.0
imx-sc-firmware-1.2.7.1.bin
imx-seco-2.3.1.bin

Which latest combination is vaild for the imx8qm_mek board?

Best Regards,

Oliver