Skip to contentSkip to conversation

usb: ehci-omap: Fix deferred probe for phy handling

PATCH New Peter Ujfalusi 1 participant 1 message Dec 14, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 usb: ehci-omap: Fix deferred probe for phy handling

Roger,

Quoted 10 lines · Roger Quadros

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.

Quoted 22 lines
Cc Alan Stern <[email protected]>
Cc Johan Hovold <[email protected]>
Cc Ladislav Michl <[email protected]>
Cc Peter Ujfalusi <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 drivers/usb/host/ehci-omap.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/host/ehci-omap.c +0 -2
index 7e4c1334..7d20296 100644
@@ -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)

drivers/usb/host/ehci-omap.c static int ehci_hcd_omap_probe(struct platform_device *pdev) · line 170

Quoted 10 lines
drivers/usb/host/ehci-omap.c +4 -1
+			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