mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig
@ 2022-03-01  9:14 Denis Orlov
  2022-03-01  9:14 ` [PATCH 2/2] usb: host: ehci: reorder code in ehci_probe() Denis Orlov
  2022-03-03  9:55 ` [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Denis Orlov @ 2022-03-01  9:14 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

With GENERIC_PHY disabled, EHCI driver initialization fails in
ehci_probe() as calling phy_optional_get() returns "Function not
implemented" value. So it seems reasonable to make USB_EHCI explicitly
depend on GENERIC_PHY.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/usb/host/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d38b4dcac4..cc71b76902 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -2,6 +2,7 @@
 config USB_EHCI
 	bool "EHCI driver"
 	depends on HAS_DMA
+	depends on GENERIC_PHY
 
 config USB_EHCI_OMAP
 	depends on ARCH_OMAP3
-- 
2.20.1


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


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

* [PATCH 2/2] usb: host: ehci: reorder code in ehci_probe()
  2022-03-01  9:14 [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Denis Orlov
@ 2022-03-01  9:14 ` Denis Orlov
  2022-03-03  9:55 ` [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Orlov @ 2022-03-01  9:14 UTC (permalink / raw)
  To: barebox; +Cc: Denis Orlov

Currently, after successful memory region requests the driver
initialization could still fail, leaving those regions allocated. By
reordering the code those requests can be placed later, after the
possibly failing calls.

Signed-off-by: Denis Orlov <denorl2009@gmail.com>
---
 drivers/usb/host/ehci-hcd.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index facfb3a95b..068504557b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1421,20 +1421,6 @@ static int ehci_probe(struct device_d *dev)
 		 */
 		data.flags = EHCI_HAS_TT;
 
-	iores = dev_request_mem_resource(dev, 0);
-	if (IS_ERR(iores))
-		return PTR_ERR(iores);
-	data.hccr = IOMEM(iores->start);
-
-	if (dev->num_resources > 1) {
-		iores = dev_request_mem_resource(dev, 1);
-		if (IS_ERR(iores))
-			return PTR_ERR(iores);
-		data.hcor = IOMEM(iores->start);
-	}
-	else
-		data.hcor = NULL;
-
 	usb2_generic_phy = phy_optional_get(dev, "usb");
 	if (IS_ERR(usb2_generic_phy))
 		return PTR_ERR(usb2_generic_phy);
@@ -1456,6 +1442,20 @@ static int ehci_probe(struct device_d *dev)
 	if (ret)
 		return ret;
 
+	iores = dev_request_mem_resource(dev, 0);
+	if (IS_ERR(iores))
+		return PTR_ERR(iores);
+	data.hccr = IOMEM(iores->start);
+
+	if (dev->num_resources > 1) {
+		iores = dev_request_mem_resource(dev, 1);
+		if (IS_ERR(iores))
+			return PTR_ERR(iores);
+		data.hcor = IOMEM(iores->start);
+	}
+	else
+		data.hcor = NULL;
+
 	ehci = ehci_register(dev, &data);
 	if (IS_ERR(ehci))
 		return PTR_ERR(ehci);
-- 
2.20.1


_______________________________________________
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 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig
  2022-03-01  9:14 [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Denis Orlov
  2022-03-01  9:14 ` [PATCH 2/2] usb: host: ehci: reorder code in ehci_probe() Denis Orlov
@ 2022-03-03  9:55 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-03-03  9:55 UTC (permalink / raw)
  To: Denis Orlov; +Cc: barebox

Hi Denis,

On Tue, Mar 01, 2022 at 12:14:22PM +0300, Denis Orlov wrote:
> With GENERIC_PHY disabled, EHCI driver initialization fails in
> ehci_probe() as calling phy_optional_get() returns "Function not
> implemented" value. So it seems reasonable to make USB_EHCI explicitly
> depend on GENERIC_PHY.
> 
> Signed-off-by: Denis Orlov <denorl2009@gmail.com>
> ---
>  drivers/usb/host/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index d38b4dcac4..cc71b76902 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -2,6 +2,7 @@
>  config USB_EHCI
>  	bool "EHCI driver"
>  	depends on HAS_DMA
> +	depends on GENERIC_PHY

This effectively disables the EHCI in a bunch of defconfigs. I finally
decided for the other approach and made phy_optional_get() return NULL
when GENERIC_PHY is disabled. This should solve this problem.

Applied the other patch in the series.

Sascha

>  
>  config USB_EHCI_OMAP
>  	depends on ARCH_OMAP3
> -- 
> 2.20.1
> 
> 

-- 
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:[~2022-03-03  9:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  9:14 [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Denis Orlov
2022-03-01  9:14 ` [PATCH 2/2] usb: host: ehci: reorder code in ehci_probe() Denis Orlov
2022-03-03  9:55 ` [PATCH 1/2] usb: host: ehci: add GENERIC_PHY dependency to Kconfig Sascha Hauer

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