[PATCH 2/2] usb: phy: phy-mxs-usb: do not depend on speed for disconnect notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For some user cases, like plug out and replug in usb device during
the system suspend, the speed negotiation will be error due to host
doesn't know the device's disconnection, and it still hopes the
high speed device, but the device backs to "powered" state which
its high speed termination is not enabled, the usb core calls
the PHY's disconnect notifier with "full speed", it will NOT
take effect at all.

If the usb core calls disconnect notifer, the port change must happen,
so it is safe to disable high speed disconenct detector, since
connect notifier will be called soon if the device is still connected
on the port, and we will enable high speed disconnect detector at that
time.

Acked-by: Li Jun <b47624@xxxxxxxxxxxxx>
Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
---
 drivers/usb/phy/phy-mxs-usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index eaf94b0..58cae78 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -370,7 +370,9 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy,
 	dev_dbg(phy->dev, "%s device has disconnected\n",
 		(speed == USB_SPEED_HIGH) ? "HS" : "FS/LS");
 
-	if (speed == USB_SPEED_HIGH)
+	/* Sometimes, the speed is not high speed when the error occurs */
+	if (readl(phy->io_priv + HW_USBPHY_CTRL) &
+			BM_USBPHY_CTRL_ENHOSTDISCONDETECT)
 		writel(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
 		       phy->io_priv + HW_USBPHY_CTRL_CLR);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux