All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: host: ehci-generic: Make resets and clocks optional
@ 2022-06-07 23:42 Andre Przywara
  2022-06-08  7:00 ` Patrice CHOTARD
  2022-06-17 13:16 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Przywara @ 2022-06-07 23:42 UTC (permalink / raw)
  To: Tom Rini, Marek Vasut; +Cc: Patrice Chotard, u-boot, linux-sunxi

The generic EHCI binding does not *require* resets and clocks
properties, and indeed for instance the Allwinner A20 SoCs does not
need or define any resets in its DT.

Don't easily give up if clk_get_bulk() or reset_get_bulk() return an
error, but check if that is due to the DT simply having no entries for
either of them.

This fixes USB operation on all boards with an Allwinner A10 or A20 SoC,
which were reporting an error after commit ba96176ab70e2999:
=======================
Bus usb@1c14000: ehci_generic usb@1c14000: Failed to get resets (err=-2)
probe failed, error -2
=======================

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/usb/host/ehci-generic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 4734af03962..15267e9a05a 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -69,7 +69,7 @@ static int ehci_usb_probe(struct udevice *dev)
 
 	err = 0;
 	ret = clk_get_bulk(dev, &priv->clocks);
-	if (ret) {
+	if (ret && ret != -ENOENT) {
 		dev_err(dev, "Failed to get clocks (ret=%d)\n", ret);
 		return ret;
 	}
@@ -81,7 +81,7 @@ static int ehci_usb_probe(struct udevice *dev)
 	}
 
 	err = reset_get_bulk(dev, &priv->resets);
-	if (err) {
+	if (ret && ret != -ENOENT) {
 		dev_err(dev, "Failed to get resets (err=%d)\n", err);
 		goto clk_err;
 	}
-- 
2.35.3


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

* Re: [PATCH] usb: host: ehci-generic: Make resets and clocks optional
  2022-06-07 23:42 [PATCH] usb: host: ehci-generic: Make resets and clocks optional Andre Przywara
@ 2022-06-08  7:00 ` Patrice CHOTARD
  2022-06-17 13:16 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2022-06-08  7:00 UTC (permalink / raw)
  To: Andre Przywara, Tom Rini, Marek Vasut; +Cc: u-boot, linux-sunxi

Hi Andre

On 6/8/22 01:42, Andre Przywara wrote:
> The generic EHCI binding does not *require* resets and clocks
> properties, and indeed for instance the Allwinner A20 SoCs does not
> need or define any resets in its DT.
> 
> Don't easily give up if clk_get_bulk() or reset_get_bulk() return an
> error, but check if that is due to the DT simply having no entries for
> either of them.
> 
> This fixes USB operation on all boards with an Allwinner A10 or A20 SoC,
> which were reporting an error after commit ba96176ab70e2999:
> =======================
> Bus usb@1c14000: ehci_generic usb@1c14000: Failed to get resets (err=-2)
> probe failed, error -2
> =======================
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  drivers/usb/host/ehci-generic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
> index 4734af03962..15267e9a05a 100644
> --- a/drivers/usb/host/ehci-generic.c
> +++ b/drivers/usb/host/ehci-generic.c
> @@ -69,7 +69,7 @@ static int ehci_usb_probe(struct udevice *dev)
>  
>  	err = 0;
>  	ret = clk_get_bulk(dev, &priv->clocks);
> -	if (ret) {
> +	if (ret && ret != -ENOENT) {
>  		dev_err(dev, "Failed to get clocks (ret=%d)\n", ret);
>  		return ret;
>  	}
> @@ -81,7 +81,7 @@ static int ehci_usb_probe(struct udevice *dev)
>  	}
>  
>  	err = reset_get_bulk(dev, &priv->resets);
> -	if (err) {
> +	if (ret && ret != -ENOENT) {
>  		dev_err(dev, "Failed to get resets (err=%d)\n", err);
>  		goto clk_err;
>  	}

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

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

* Re: [PATCH] usb: host: ehci-generic: Make resets and clocks optional
  2022-06-07 23:42 [PATCH] usb: host: ehci-generic: Make resets and clocks optional Andre Przywara
  2022-06-08  7:00 ` Patrice CHOTARD
@ 2022-06-17 13:16 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2022-06-17 13:16 UTC (permalink / raw)
  To: Andre Przywara; +Cc: Marek Vasut, Patrice Chotard, u-boot, linux-sunxi

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

On Wed, Jun 08, 2022 at 12:42:22AM +0100, Andre Przywara wrote:

> The generic EHCI binding does not *require* resets and clocks
> properties, and indeed for instance the Allwinner A20 SoCs does not
> need or define any resets in its DT.
> 
> Don't easily give up if clk_get_bulk() or reset_get_bulk() return an
> error, but check if that is due to the DT simply having no entries for
> either of them.
> 
> This fixes USB operation on all boards with an Allwinner A10 or A20 SoC,
> which were reporting an error after commit ba96176ab70e2999:
> =======================
> Bus usb@1c14000: ehci_generic usb@1c14000: Failed to get resets (err=-2)
> probe failed, error -2
> =======================
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Applied to u-boot/master, thanks!

-- 
Tom

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

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

end of thread, other threads:[~2022-06-17 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 23:42 [PATCH] usb: host: ehci-generic: Make resets and clocks optional Andre Przywara
2022-06-08  7:00 ` Patrice CHOTARD
2022-06-17 13:16 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.