On Wed, 15 Dec 2010, Fabio Estevam wrote: > In order to read/write to the i.MX OTG viewport register it is necessary to setup > the PORTSCx register first. > > By default i.MX OTG port is configured for USB serial PHY. In order to use a ULPI PHY > the PORTSCx register needs to be configured properly. > > commit 724c852 (USB: ehci/mxc: compile fix) placed the PORTSC setup after the OTG > viewport is accessed and this causes ULPI read/write to fail. > > Revert the PORTSC setup order. > > Tested on a MX31PDK board with a ISP1504 transceiver: > > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver > mxc-ehci mxc-ehci.0: initializing i.MX USB Controller > ULPI transceiver vendor/product ID 0x04cc/0x1504 > Found NXP ISP1504 ULPI transceiver. > ULPI integrity check: passed. > > Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx> > --- > Changes since v2: > - move portsc setup prior to mxc_initialize_usb_hw > > Changes since v1: > -removed second call to ehci = hcd_to_ehci(hcd); > > drivers/usb/host/ehci-mxc.c | 20 ++++++++++++++------ > 1 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c > index bce8505..15b3020 100644 > --- a/drivers/usb/host/ehci-mxc.c > +++ b/drivers/usb/host/ehci-mxc.c > @@ -65,12 +65,6 @@ static int ehci_mxc_setup(struct usb_hcd *hcd) > > ehci_reset(ehci); > > - /* set up the PORTSCx register */ > - ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); > - > - /* is this really needed? */ > - msleep(10); > - You also need to remove the declarations of dev and pdata; otherwise the compiler will complain about unused variables. > ehci_port_power(ehci, 0); > return 0; > } > @@ -125,6 +119,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) > int irq, ret; > struct ehci_mxc_priv *priv; > struct device *dev = &pdev->dev; > + struct ehci_hcd *ehci; > > dev_info(&pdev->dev, "initializing i.MX USB Controller\n"); > > @@ -196,6 +191,19 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) > clk_enable(priv->ahbclk); > } > > + ehci = hcd_to_ehci(hcd); > + > + /* EHCI registers start at offset 0x100 */ > + ehci->caps = hcd->regs + 0x100; > + ehci->regs = hcd->regs + 0x100 + > + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase)); Since you are adding these lines here, you should remove them from ehci_mxc_setup(). > + > + /* set up the PORTSCx register */ > + ehci_writel(ehci, pdata->portsc, &ehci->regs->port_status[0]); > + > + /* is this really needed? */ > + msleep(10); > + > /* setup specific usb hw */ > ret = mxc_initialize_usb_hw(pdev->id, pdata->flags); > if (ret < 0) Alan Stern -- 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