From 873b6b6892befabecd2da3f61562b9325ace0795 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 16 Aug 2013 09:42:05 +0200 Subject: [PATCH 1/4] usb: chipidea i.MX: remove unused pdata->init hook Signed-off-by: Sascha Hauer --- drivers/usb/imx/chipidea-imx.c | 5 ----- include/usb/chipidea-imx.h | 1 - 2 files changed, 6 deletions(-) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index d8209d174..2f290e1ee 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -32,7 +32,6 @@ struct imx_chipidea { struct ehci_data data; unsigned long flags; enum imx_usb_mode mode; - int (*init)(int port); int portno; }; @@ -58,9 +57,6 @@ static int imx_chipidea_port_init(void *drvdata) if (ret) dev_err(ci->dev, "misc init failed: %s\n", strerror(-ret)); - if (ci->init) - ci->init(ci->portno); - return ret; } @@ -152,7 +148,6 @@ static int imx_chipidea_probe(struct device_d *dev) } ci->portno = dev->id; ci->flags = pdata->flags; - ci->init = pdata->init; ci->mode = pdata->mode; } diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h index 5801cf15e..487217cb7 100644 --- a/include/usb/chipidea-imx.h +++ b/include/usb/chipidea-imx.h @@ -42,7 +42,6 @@ enum imx_usb_mode { struct imxusb_platformdata { unsigned long flags; enum imx_usb_mode mode; - int (*init)(int port); }; int imx_usbmisc_port_init(int port, unsigned flags); From db4842821650a0efd1049c875f5274a3dcfc786a Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 16 Aug 2013 09:43:45 +0200 Subject: [PATCH 2/4] usb: chipidea i.MX: limit port init to HSIC mode imx_chipidea_port_init() will be called during startup from the ehci driver. Calling it before setting up the PORTSC register is only necessary in HSIC mode. Signed-off-by: Sascha Hauer --- drivers/usb/imx/chipidea-imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index 2f290e1ee..c81c10df4 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -161,7 +161,8 @@ static int imx_chipidea_probe(struct device_d *dev) ci->data.post_init = imx_chipidea_port_post_init; ci->data.drvdata = ci; - imx_chipidea_port_init(ci); + if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_HSIC) + imx_chipidea_port_init(ci); portsc = readl(base + 0x184); portsc &= ~MXC_EHCI_PORTSC_MASK; From d35fa7f26dc610db2f1b49e84e5b7cd47de8c688 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 16 Aug 2013 09:54:00 +0200 Subject: [PATCH 3/4] usb: chipidea i.MX: always print an error message when ULPI fails The ULPI code does not print a message when the operation times out. Add one to the caller so that he gets an idea that something is going wrong. Signed-off-by: Sascha Hauer --- drivers/usb/imx/chipidea-imx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index c81c10df4..dfaf59099 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -44,6 +44,9 @@ static int imx_chipidea_port_init(void *drvdata) dev_dbg(ci->dev, "using ULPI phy\n"); if (IS_ENABLED(CONFIG_USB_ULPI)) { ret = ulpi_setup(ci->base + 0x170, 1); + if (ret) + dev_err(ci->dev, "ULPI setup failed with %s\n", + strerror(-ret)); } else { dev_err(ci->dev, "no ULPI support available\n"); ret = -ENODEV; From 682d47d6ce1451ff070737975552ece613056eaa Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 16 Aug 2013 09:57:41 +0200 Subject: [PATCH 4/4] usb: chipidea i.MX: add some delay after ulpi_setup On the pcm038 the ULPI phy is found correctly, but after a power cycle the attached devices are not found. Adding some delay fixes this. Signed-off-by: Sascha Hauer --- drivers/usb/imx/chipidea-imx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c index dfaf59099..a7ad7343d 100644 --- a/drivers/usb/imx/chipidea-imx.c +++ b/drivers/usb/imx/chipidea-imx.c @@ -47,6 +47,7 @@ static int imx_chipidea_port_init(void *drvdata) if (ret) dev_err(ci->dev, "ULPI setup failed with %s\n", strerror(-ret)); + mdelay(20); } else { dev_err(ci->dev, "no ULPI support available\n"); ret = -ENODEV;