[PATCH] usb: otg: mxs-phy: Allow USB host to work on mx23

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

 



From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>

Differently from mx28 and mx6q, the mx23 SoC has the following description
about ENHOSTDISCONDETECT bit in its Reference Manual:

"Due to a on chip issue (Errata #2791), software must pay attention to when
to assert the ENHOSTDISCONDETECT bit in HW_USBPHY_CTRL register:
1. Only set HW_USBPHY_CTRL.ENHOSTDISCONDETECT during high speed host mode.
2. Do not set HW_USBPHY_CTRL.ENHOSTDISCONDETECT during the reset and speed 
negotiation period.
3. Do not set HW_USBPHY_CTRL.ENHOSTDISCONDETECT during host suspend/resume
sequence."

If ENHOSTDISCONDETECT is not handled on mx23,  USB host can work.

Tested on a imx23-olinuxino board.

Suggested-by: Sean Cross <xobs@xxxxxxxx>
Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
---
 drivers/usb/otg/mxs-phy.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c
index c1a67cb..c70d026 100644
--- a/drivers/usb/otg/mxs-phy.c
+++ b/drivers/usb/otg/mxs-phy.c
@@ -20,6 +20,7 @@
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/of_platform.h>
 
 #define DRIVER_NAME "mxs_phy"
 
@@ -81,8 +82,10 @@ static int mxs_phy_on_connect(struct usb_phy *phy, int port)
 	dev_dbg(phy->dev, "Connect on port %d\n", port);
 
 	mxs_phy_hw_init(to_mxs_phy(phy));
-	writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
-			phy->io_priv + HW_USBPHY_CTRL_SET);
+
+	if (!of_machine_is_compatible("fsl,imx23"))
+		writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+				phy->io_priv + HW_USBPHY_CTRL_SET);
 
 	return 0;
 }
@@ -91,8 +94,9 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port)
 {
 	dev_dbg(phy->dev, "Disconnect on port %d\n", port);
 
-	writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
-			phy->io_priv + HW_USBPHY_CTRL_CLR);
+	if (!of_machine_is_compatible("fsl,imx23"))
+		writel_relaxed(BM_USBPHY_CTRL_ENHOSTDISCONDETECT,
+				phy->io_priv + HW_USBPHY_CTRL_CLR);
 
 	return 0;
 }
-- 
1.7.9.5

--
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