Skip to contentSkip to conversation

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

DISCUSSION Roger Quadros 1 participant 1 message Dec 13, 2018 USB

lore
Share & tools
lore
#0 lore raw

Tony,

Quoted 5 lines · Tony Lindgren

The only case where we can bail out safely without a phy is port_mode is OMAP_USBHS_PORT_MODE_UNUSED. It used to be that OMAP_EHCI_PORT_MODE_PHY was optional, but that's not a good assumption. We should already have "ehci-phy" in all the dts files using OMAP_EHCI_PORT_MODE_PHY.

We don't use the PHY at all if port mode is not OMAP_EHCI_PORT_MODE_PHY.

Quoted 8 lines

Note that this fix should not be needed for kernels earlier than v4.19 as that's when we started moving devices to probe with ti-sysc. We now probe l4 interconnects separately, which can cause deferred probe with the phy being on a separate l4 interconnect from EHCI.

And old kernels would need to be checked for "ehci-phy" property for this fix to avoid regressions.

What issue is this patch fixing?

Quoted 15 lines
Cc Alan Stern <[email protected]>
Cc Johan Hovold <[email protected]>
Cc Ladislav Michl <[email protected]>
Cc Peter Ujfalusi <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/usb/host/ehci-omap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

Quoted 10 lines
drivers/usb/host/ehci-omap.c +2 -2
@@ -159,8 +159,8 @@ 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)
+			/* Don't bail out if PHY is unused */
+			if (pdata->port_mode[i] == OMAP_USBHS_PORT_MODE_UNUSED)
 				continue;
 
 			ret = PTR_ERR(phy);

devm_usb_get_phy_by_phandle() returns -ENODEV if PHY phandle is not present which would be the case in PHY'less modes (e.g. "ehci-tll" or "ehci-hsic"). This change will error out instead of proceeding normally in those cases.

cheers,
-roger