* [v3] usb: ehci-omap: Fix deferred probe for phy handling
@ 2018-12-14 9:36 Roger Quadros
0 siblings, 0 replies; 4+ messages in thread
From: Roger Quadros @ 2018-12-14 9:36 UTC (permalink / raw)
To: gregkh
Cc: linux-usb, Roger Quadros, Alan Stern, Johan Hovold,
Ladislav Michl, Peter Ujfalusi, Tony Lindgren
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 | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 7e4c1334..7d20296 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -159,11 +159,12 @@ 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)
dev_err(dev, "Can't get PHY for port %d: %d\n",
i, ret);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [v3] usb: ehci-omap: Fix deferred probe for phy handling
@ 2018-12-14 9:49 Peter Ujfalusi
0 siblings, 0 replies; 4+ messages in thread
From: Peter Ujfalusi @ 2018-12-14 9:49 UTC (permalink / raw)
To: Roger Quadros, gregkh
Cc: linux-usb, Alan Stern, Johan Hovold, Ladislav Michl,
Tony Lindgren
Roger,
On 14/12/2018 11.36, 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.
Thanks, it works.
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 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 | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index 7e4c1334..7d20296 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -159,11 +159,12 @@ 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)
> dev_err(dev, "Can't get PHY for port %d: %d\n",
> i, ret);
>
- Péter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v3] usb: ehci-omap: Fix deferred probe for phy handling
@ 2018-12-14 14:09 Tony Lindgren
0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2018-12-14 14:09 UTC (permalink / raw)
To: Roger Quadros
Cc: gregkh, linux-usb, Alan Stern, Johan Hovold, Ladislav Michl,
Peter Ujfalusi
* Roger Quadros <rogerq@ti.com> [181214 09:36]:
> 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.
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [v3] usb: ehci-omap: Fix deferred probe for phy handling
@ 2018-12-14 15:06 Alan Stern
0 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2018-12-14 15:06 UTC (permalink / raw)
To: Roger Quadros
Cc: gregkh, linux-usb, Johan Hovold, Ladislav Michl, Peter Ujfalusi,
Tony Lindgren
On Fri, 14 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 | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
> index 7e4c1334..7d20296 100644
> --- a/drivers/usb/host/ehci-omap.c
> +++ b/drivers/usb/host/ehci-omap.c
> @@ -159,11 +159,12 @@ 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)
> dev_err(dev, "Can't get PHY for port %d: %d\n",
> i, ret);
Acked-by: Alan Stern <stern@rowland.harvard.edu>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-14 15:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14 14:09 [v3] usb: ehci-omap: Fix deferred probe for phy handling Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2018-12-14 15:06 Alan Stern
2018-12-14 9:49 Peter Ujfalusi
2018-12-14 9:36 Roger Quadros
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).