mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] usb: i.MX: warn if vbus regulator isn't available
@ 2021-03-05  9:00 Uwe Kleine-König
  2021-05-22 14:22 ` Uwe Kleine-König
  2021-05-25  5:24 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2021-03-05  9:00 UTC (permalink / raw)
  To: barebox; +Cc: Marco Felsch, Ahmad Fatoum

Instead of just ignoring errors related to getting the vbus regulator
yield at least a warning message. This would have saved me some
debugging time when trying to understand why USB doesn't work without
the right regulator driver enabled.

Note that machines that don't define a regulator in their device tree
don't issue this warning as regulator_get() returns the dummy regulator
in this case.

The alternative to error out wasn't accepted because this probably
creates regressions for regulators that are default-on but without a
driver in barebox.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

(implicit) v1 was sent some time ago with Message-ID:
<1485d35a-d55b-2440-4852-1737e78f8aa1@pengutronix.de>. Ahmad suggested
to use %pe instead of strerror(-ret). This is also the only change
compared to the first submission.

Best regards
Uwe

 drivers/usb/imx/chipidea-imx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 7b87f302a921..aa27941c8c66 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -256,8 +256,11 @@ static int imx_chipidea_probe(struct device_d *dev)
 	}
 
 	ci->vbus = regulator_get(dev, "vbus");
-	if (IS_ERR(ci->vbus))
+	if (IS_ERR(ci->vbus)) {
+		dev_warn(dev, "Cannot get vbus regulator: %pe (ignoring)\n",
+			 ci->vbus);
 		ci->vbus = NULL;
+	}
 
 	/*
 	 * Some devices have more than one clock, in this case they are enabled
-- 
2.30.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] usb: i.MX: warn if vbus regulator isn't available
  2021-03-05  9:00 [PATCH v2] usb: i.MX: warn if vbus regulator isn't available Uwe Kleine-König
@ 2021-05-22 14:22 ` Uwe Kleine-König
  2021-05-25  5:24 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2021-05-22 14:22 UTC (permalink / raw)
  To: barebox; +Cc: Marco Felsch, Ahmad Fatoum


[-- Attachment #1.1: Type: text/plain, Size: 2071 bytes --]

Hello,

On Fri, Mar 05, 2021 at 10:00:01AM +0100, Uwe Kleine-König wrote:
> Instead of just ignoring errors related to getting the vbus regulator
> yield at least a warning message. This would have saved me some
> debugging time when trying to understand why USB doesn't work without
> the right regulator driver enabled.
> 
> Note that machines that don't define a regulator in their device tree
> don't issue this warning as regulator_get() returns the dummy regulator
> in this case.
> 
> The alternative to error out wasn't accepted because this probably
> creates regressions for regulators that are default-on but without a
> driver in barebox.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> (implicit) v1 was sent some time ago with Message-ID:
> <1485d35a-d55b-2440-4852-1737e78f8aa1@pengutronix.de>. Ahmad suggested
> to use %pe instead of strerror(-ret). This is also the only change
> compared to the first submission.

ping!

Best regards
Uwe

>  drivers/usb/imx/chipidea-imx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
> index 7b87f302a921..aa27941c8c66 100644
> --- a/drivers/usb/imx/chipidea-imx.c
> +++ b/drivers/usb/imx/chipidea-imx.c
> @@ -256,8 +256,11 @@ static int imx_chipidea_probe(struct device_d *dev)
>  	}
>  
>  	ci->vbus = regulator_get(dev, "vbus");
> -	if (IS_ERR(ci->vbus))
> +	if (IS_ERR(ci->vbus)) {
> +		dev_warn(dev, "Cannot get vbus regulator: %pe (ignoring)\n",
> +			 ci->vbus);
>  		ci->vbus = NULL;
> +	}
>  
>  	/*
>  	 * Some devices have more than one clock, in this case they are enabled
> -- 
> 2.30.0
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH v2] usb: i.MX: warn if vbus regulator isn't available
  2021-03-05  9:00 [PATCH v2] usb: i.MX: warn if vbus regulator isn't available Uwe Kleine-König
  2021-05-22 14:22 ` Uwe Kleine-König
@ 2021-05-25  5:24 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-05-25  5:24 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox, Marco Felsch, Ahmad Fatoum

On Fri, Mar 05, 2021 at 10:00:01AM +0100, Uwe Kleine-König wrote:
> Instead of just ignoring errors related to getting the vbus regulator
> yield at least a warning message. This would have saved me some
> debugging time when trying to understand why USB doesn't work without
> the right regulator driver enabled.
> 
> Note that machines that don't define a regulator in their device tree
> don't issue this warning as regulator_get() returns the dummy regulator
> in this case.

Note that this warning appears on machines that do define a regulator in
their device tree (derived from the kernel upstream dts), but do not
actually need it as the regulator was enabled by board code.
Arguably that's the problem of these boards and we'll have to look there
how we can quiesce the warning. The obvious solution is to implement the
missing driver, but we could also add some
add_dummy_regulator_for_this_node() function to tell the regulator core
that we don't need a specific regulator.

First let's see if somebody is annoyed by this message, so applied,
thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-05-25  5:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  9:00 [PATCH v2] usb: i.MX: warn if vbus regulator isn't available Uwe Kleine-König
2021-05-22 14:22 ` Uwe Kleine-König
2021-05-25  5:24 ` Sascha Hauer

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