[PATCH master 2/2] pmdomain: imx: gpc2: ignore missing regulators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux