mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang
@ 2024-03-13 14:41 Ahmad Fatoum
  2024-03-13 14:41 ` [PATCH master 2/2] pmdomain: imx: gpc2: ignore missing regulators Ahmad Fatoum
  2024-03-15  7:09 ` [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-03-13 14:41 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Commit 6ea731079140 ("ARM: i.MX8MQ: Streamline lowlevel startup code")
changed i.MX8MQ PBL code to mimic the code introduced for later i.MX8M
variants. The mimicry went a bit too far though and it exchanged i.MX8MQ
boot source lookup with that of the i.MX8MN. Fix this to avoid the boot
hanging with:

  Unhandled bootsource BOOTSOURCE_0

Fixes: 6ea731079140 ("ARM: i.MX8MQ: Streamline lowlevel startup code")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-imx/atf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 9cbc38ef11e8..8b804602681b 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -323,7 +323,7 @@ void imx8mq_load_bl33(void *bl33)
 	enum bootsource src;
 	int instance;
 
-	imx8mn_get_boot_source(&src, &instance);
+	imx8mq_get_boot_source(&src, &instance);
 	switch (src) {
 	case BOOTSOURCE_MMC:
 		imx8m_esdhc_load_image(instance, bl33);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH master 2/2] pmdomain: imx: gpc2: ignore missing regulators
  2024-03-13 14:41 [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Ahmad Fatoum
@ 2024-03-13 14:41 ` Ahmad Fatoum
  2024-03-15  7:09 ` [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-03-13 14:41 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The GPV2 driver supports controlling voltage rails associated with
domains via adding a power-supply binding to the power domain's
device tree node. This is only done for the i.MX8MQ's GPU, VPU and MIPI
domains. All boards supported upstream that do this reference a
regulator of the pfuze100 as power supply.

While we have a pfuze100 driver, it only does one-time init and doesn't
implement a regulator API. This means these boards will fail with probe
deferrals:

  imx-pgc imx-pgc-domain5: error Requested probe deferral: Failed to get domain's regulator
  imx-pgc imx-pgc-domain6: error Requested probe deferral: Failed to get domain's regulator
  ERROR: imx-pgc-domain6: probe permanently deferred (Failed to get domain's regulator)
  ERROR: imx-pgc-domain5: probe permanently deferred (Failed to get domain's regulator)

As we don't use MIPI, GPU or VPU in barebox and we want to move boards
over to deep probe (where every EPROBE_DEFER is permanent), let's stop
propagating EPROBE_DEFER and just write an info message and continue
probing as usual and delay the error message until the regulator is
actually used.

Fixes: eb487a8d39e2 ("soc: imx: gpcv2: extend for i.MX8M Mini/Nano/Plus support")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/pmdomain/imx/gpcv2.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
index b967947478b9..fc2fbdaf140b 100644
--- a/drivers/pmdomain/imx/gpcv2.c
+++ b/drivers/pmdomain/imx/gpcv2.c
@@ -326,12 +326,16 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 	u32 reg_val, pgc;
 	int ret;
 
-	if (!IS_ERR(domain->regulator)) {
+	if (!IS_ERR(domain->regulator))
 		ret = regulator_enable(domain->regulator);
-		if (ret) {
-			dev_err(domain->dev, "failed to enable regulator\n");
-			return ret;
-		}
+	else if (PTR_ERR(domain->regulator) == -ENOENT)
+		ret = -ENOENT;
+	else
+		ret = 0;
+
+	if (ret) {
+		dev_err(domain->dev, "failed to enable regulator\n");
+		return ret;
 	}
 
 	/* Enable reset clocks for all devices in the domain */
@@ -1145,9 +1149,21 @@ static int imx_pgc_domain_probe(struct device *dev)
 
 	domain->regulator = regulator_get(domain->dev, "power");
 	if (IS_ERR(domain->regulator)) {
-		if (PTR_ERR(domain->regulator) != -ENODEV)
+		/* On i.MX8M, we usually set up PMIC in early board code once
+		 * and don't do dynamic voltage regulation in barebox.
+		 * This means, even with deferred probe we will never succeed.
+		 * Instead, let's just print an info message and continue
+		 *
+		 * If you actually require access to a regulator here that has
+		 * a driver, enable deep probe for your board.
+		 */
+		if (PTR_ERR(domain->regulator) == -EPROBE_DEFER) {
+			dev_info(domain->dev, "Failed to get domain's regulator (ignored)\n");
+			domain->regulator = ERR_PTR(-ENOENT);
+		} else if (PTR_ERR(domain->regulator) != -ENODEV) {
 			return dev_err_probe(domain->dev, PTR_ERR(domain->regulator),
 					     "Failed to get domain's regulator\n");
+		}
 	} else if (domain->voltage) {
 		regulator_set_voltage(domain->regulator,
 				      domain->voltage, domain->voltage);
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang
  2024-03-13 14:41 [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Ahmad Fatoum
  2024-03-13 14:41 ` [PATCH master 2/2] pmdomain: imx: gpc2: ignore missing regulators Ahmad Fatoum
@ 2024-03-15  7:09 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-03-15  7:09 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Wed, 13 Mar 2024 15:41:35 +0100, Ahmad Fatoum wrote:
> Commit 6ea731079140 ("ARM: i.MX8MQ: Streamline lowlevel startup code")
> changed i.MX8MQ PBL code to mimic the code introduced for later i.MX8M
> variants. The mimicry went a bit too far though and it exchanged i.MX8MQ
> boot source lookup with that of the i.MX8MN. Fix this to avoid the boot
> hanging with:
> 
>   Unhandled bootsource BOOTSOURCE_0
> 
> [...]

Applied, thanks!

[1/2] ARM: i.MX8MQ: fix early boot hang
      https://git.pengutronix.de/cgit/barebox/commit/?id=a4d3c0b78250 (link may not be stable)
[2/2] pmdomain: imx: gpc2: ignore missing regulators
      https://git.pengutronix.de/cgit/barebox/commit/?id=7ef7a95ac49e (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-15  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 14:41 [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Ahmad Fatoum
2024-03-13 14:41 ` [PATCH master 2/2] pmdomain: imx: gpc2: ignore missing regulators Ahmad Fatoum
2024-03-15  7:09 ` [PATCH master 1/2] ARM: i.MX8MQ: fix early boot hang Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox