diff mbox series

[v2] usb: ehci-omap: Fix deferred probe for phy handling

Message ID 1544716952-13482-1-git-send-email-rogerq@ti.com (mailing list archive)
State Superseded
Headers show
Series [v2] usb: ehci-omap: Fix deferred probe for phy handling | expand

Commit Message

Roger Quadros Dec. 13, 2018, 4:02 p.m. UTC
PHY model is being used on omap5 platforms even if port mode
is not OMAP_EHCI_PORT_MODE_PHY. So don't guess if PHY is required
or not based on PHY mode.

If PHY is provided in device tree, it must be required. So, if
devm_usb_get_phy_by_phandle() gives us an error code other
than -ENODEV (no PHY) then error out.

This fixes USB Ethernet on omap5-uevm if PHY happens to
probe after EHCI thus causing a -EPROBE_DEFER.

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Johan Hovold <johan@kernel.org>
Cc: Ladislav Michl <ladis@linux-mips.org>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/ehci-omap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tony Lindgren Dec. 13, 2018, 4:21 p.m. UTC | #1
* Roger Quadros <rogerq@ti.com> [181213 16:03]:
> PHY model is being used on omap5 platforms even if port mode
> is not OMAP_EHCI_PORT_MODE_PHY. So don't guess if PHY is required
> or not based on PHY mode.
> 
> If PHY is provided in device tree, it must be required. So, if
> devm_usb_get_phy_by_phandle() gives us an error code other
> than -ENODEV (no PHY) then error out.
> 
> This fixes USB Ethernet on omap5-uevm if PHY happens to
> probe after EHCI thus causing a -EPROBE_DEFER.

OK works for me, let's go with this one instead:

Acked-by: Tony Lindgren <tony@atomide.com>
Alan Stern Dec. 13, 2018, 4:23 p.m. UTC | #2
On Thu, 13 Dec 2018, Roger Quadros wrote:

> PHY model is being used on omap5 platforms even if port mode
> is not OMAP_EHCI_PORT_MODE_PHY. So don't guess if PHY is required
> or not based on PHY mode.
> 
> If PHY is provided in device tree, it must be required. So, if
> devm_usb_get_phy_by_phandle() gives us an error code other
> than -ENODEV (no PHY) then error out.
> 
> This fixes USB Ethernet on omap5-uevm if PHY happens to
> probe after EHCI thus causing a -EPROBE_DEFER.
> 
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Ladislav Michl <ladis@linux-mips.org>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Cc: Tony Lindgren <tony@atomide.com>
> Reported-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/host/ehci-omap.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index 7e4c1334..0eacbf4 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -159,9 +159,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
>  		/* get the PHY device */
>  		phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
>  		if (IS_ERR(phy)) {
> -			/* Don't bail out if PHY is not absolutely necessary */
> -			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
> +			ret = PTR_ERR(phy);
> +			if (ret == -ENODEV) { /* no PHY */
> +				phy = NULL;
>  				continue;
> +			}
>  
>  			ret = PTR_ERR(phy);

Please remove this line.

Alan Stern

>  			if (ret != -EPROBE_DEFER)
>
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 7e4c1334..0eacbf4 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -159,9 +159,11 @@  static int ehci_hcd_omap_probe(struct platform_device *pdev)
 		/* get the PHY device */
 		phy = devm_usb_get_phy_by_phandle(dev, "phys", i);
 		if (IS_ERR(phy)) {
-			/* Don't bail out if PHY is not absolutely necessary */
-			if (pdata->port_mode[i] != OMAP_EHCI_PORT_MODE_PHY)
+			ret = PTR_ERR(phy);
+			if (ret == -ENODEV) { /* no PHY */
+				phy = NULL;
 				continue;
+			}
 
 			ret = PTR_ERR(phy);
 			if (ret != -EPROBE_DEFER)