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

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

 



On Tuesday, August 21, 2012 at 12:04 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx (mailto: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 (mailto:xobs@xxxxxxxx)>
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx (mailto: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

Do disconnect and reconnect still work?  I was under the impression that this particular solution would allow the USB port to detect a device connected, but then would miss the disconnect event and would no longer allow the user to plug in new devices. 

On the board I'm using there's a four-port hub on the PCB, so I can't ever disconnect the device that's connected to the root hub, but can you verify that you can unplug and then reinsert a device?  If not, we may either have to find out what event we can hook into to re-enable disconnect detect (i.e. after speed negotiation is complete), or fall back to the old sleep() solution used in Freescale's kernels.


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