Hi, If the phcd from 1 to 0 at ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]), The SoC needs to wait 2-3 ms to get the real ID/vbus value (otgsc). If not, it doesn't need to wait for current i.MX SoC USB module. Best regards, Peter Chen -----Original Message----- From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of Matthieu CASTET Sent: Thursday, October 28, 2010 4:04 PM To: Alan Stern Cc: Uwe Kleine-König; linux-usb@xxxxxxxxxxxxxxx; kernel@xxxxxxxxxxxxxx Subject: Re: ehci-mxc broken [Was: Re: [PATCH] ehci tdi : let's tdi_reset set host mode] Hi, sorry for breaking this, Alan Stern a écrit : > On Wed, 27 Oct 2010, Uwe Kleine-König wrote: > >> >> diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c >> index ac9c4d7..70edb11 100644 >> --- a/drivers/usb/host/ehci-mxc.c >> +++ b/drivers/usb/host/ehci-mxc.c >> @@ -36,6 +36,8 @@ struct ehci_mxc_priv { >> static int ehci_mxc_setup(struct usb_hcd *hcd) >> { >> struct ehci_hcd *ehci = hcd_to_ehci(hcd); >> + struct device *dev = hcd->self.controller; >> + struct mxc_usbh_platform_data *pdata = dev_get_platdata(dev); >> int retval; >> >> /* EHCI registers start at offset 0x100 */ >> @@ -64,6 +66,11 @@ static int ehci_mxc_setup(struct usb_hcd *hcd) >> ehci_reset(ehci); >> >> ehci_port_power(ehci, 0); >> + >> + /* set up the PORTSCx register */ >> + ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); >> + mdelay(10); >> + >> return 0; >> } >> >> @@ -114,7 +121,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) >> struct mxc_usbh_platform_data *pdata = pdev->dev.platform_data; >> struct usb_hcd *hcd; >> struct resource *res; >> - int irq, ret, temp; >> + int irq, ret; >> struct ehci_mxc_priv *priv; >> struct device *dev = &pdev->dev; >> >> @@ -188,10 +195,6 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) >> clk_enable(priv->ahbclk); >> } >> >> - /* set up the PORTSCx register */ >> - ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); >> - mdelay(10); >> - >> /* setup specific usb hw */ >> ret = mxc_initialize_usb_hw(pdev->id, pdata->flags); >> if (ret < 0) >> >> If I don't hear anything about this being stupid I will try to get that >> tested tomorrow on real hardware. > > It's not clear whether the mdelay() call should be moved, and it sure > looks like it should be changed to msleep(). > > Also, I don't know where in that function the PORTSCx write really > belongs. Somebody who is familiar with the hardware will have to > answer these questions. > You can look in other driver using the arc design. For example ehci-fsl does it before ehci_port_power(ehci, 0), without delay. From the arc datasheet I didn't found too much info. It should be done after reset and before starting ehci. Matthieu -- 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 -- 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