mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Revert "usb: chipidea-imx: Fix usb initialization"
@ 2013-06-05 13:26 Lucas Stach
  2013-06-05 13:33 ` Alexander Shiyan
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Stach @ 2013-06-05 13:26 UTC (permalink / raw)
  To: barebox

This breaks HSIC and has no good justification why this would
be needed for ULPI.

This reverts commit 2e7d66f526217f6ff3167e4580aecb9548a0de33.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index 928ebf3..4ee7610 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -148,13 +148,13 @@ 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);
+
 	portsc = readl(base + 0x184);
 	portsc &= ~MXC_EHCI_PORTSC_MASK;
 	portsc |= ci->flags & MXC_EHCI_PORTSC_MASK;
 	writel(portsc, base + 0x184);
 
-	imx_chipidea_port_init(ci);
-
 	if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
 		dev_dbg(dev, "using ULPI phy\n");
 		if (IS_ENABLED(CONFIG_USB_ULPI)) {
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "usb: chipidea-imx: Fix usb initialization"
  2013-06-05 13:26 [PATCH] Revert "usb: chipidea-imx: Fix usb initialization" Lucas Stach
@ 2013-06-05 13:33 ` Alexander Shiyan
  2013-06-05 20:20   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2013-06-05 13:33 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox



> This breaks HSIC and has no good justification why this would
> be needed for ULPI.
> 
> This reverts commit 2e7d66f526217f6ff3167e4580aecb9548a0de33.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/usb/imx/chipidea-imx.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
> index 928ebf3..4ee7610 100644
> --- a/drivers/usb/imx/chipidea-imx.c
> +++ b/drivers/usb/imx/chipidea-imx.c
> @@ -148,13 +148,13 @@ 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);
> +
>  	portsc = readl(base + 0x184);
>  	portsc &= ~MXC_EHCI_PORTSC_MASK;
>  	portsc |= ci->flags & MXC_EHCI_PORTSC_MASK;
>  	writel(portsc, base + 0x184);
>  
> -	imx_chipidea_port_init(ci);
> -
>  	if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
>  		dev_dbg(dev, "using ULPI phy\n");
>  		if (IS_ENABLED(CONFIG_USB_ULPI)) {

This order was be before driver rework. Unfortunately I can not check right now,
but when I test initial version, it was be a proper order, at least for pcm038 (imx27 module).

---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "usb: chipidea-imx: Fix usb initialization"
  2013-06-05 13:33 ` Alexander Shiyan
@ 2013-06-05 20:20   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-06-05 20:20 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Wed, Jun 05, 2013 at 05:33:55PM +0400, Alexander Shiyan wrote:
> 
> 
> > This breaks HSIC and has no good justification why this would
> > be needed for ULPI.
> > 
> > This reverts commit 2e7d66f526217f6ff3167e4580aecb9548a0de33.
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/usb/imx/chipidea-imx.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
> > index 928ebf3..4ee7610 100644
> > --- a/drivers/usb/imx/chipidea-imx.c
> > +++ b/drivers/usb/imx/chipidea-imx.c
> > @@ -148,13 +148,13 @@ 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);
> > +
> >  	portsc = readl(base + 0x184);
> >  	portsc &= ~MXC_EHCI_PORTSC_MASK;
> >  	portsc |= ci->flags & MXC_EHCI_PORTSC_MASK;
> >  	writel(portsc, base + 0x184);
> >  
> > -	imx_chipidea_port_init(ci);
> > -
> >  	if ((ci->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
> >  		dev_dbg(dev, "using ULPI phy\n");
> >  		if (IS_ENABLED(CONFIG_USB_ULPI)) {
> 
> This order was be before driver rework. Unfortunately I can not check right now,
> but when I test initial version, it was be a proper order, at least for pcm038 (imx27 module).

I just tried it here on our pcm038 board. With first stage USB2 never
works, no matter if this patch is reverted or not. if I start barebox
second stage it always works.

It helps to try a few more times to detect a phy. The first reads often
return wrong results. The following patch makes USB2 work here.

Sascha

8<-------------------------------------------------------

From 2d280e354b946a51ae394bcedd476800c8beabf7 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Wed, 5 Jun 2013 22:13:05 +0200
Subject: [PATCH] usb: ulpi: Try more often to detect a phy

Some boards need some more tries to successfully detect a phy. This
happens for example on the pcm038. Try up to four times to detect a
phy.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/otg/ulpi.c | 38 ++++++++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 19f64e0..e0aa201 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -146,9 +146,9 @@ static struct ulpi_info ulpi_ids[] = {
 	ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
 };
 
-int ulpi_probe(void __iomem *view)
+static int ulpi_read_id(void __iomem *view, int *vid, int *pid)
 {
-	int i, vid, pid, ret;
+	int i, ret;
 	uint32_t ulpi_id = 0;
 
 	for (i = 0; i < 4; i++) {
@@ -157,20 +157,34 @@ int ulpi_probe(void __iomem *view)
 			return ret;
 		ulpi_id = (ulpi_id << 8) | ret;
 	}
-	vid = ulpi_id & 0xffff;
-	pid = ulpi_id >> 16;
-
-	for (i = 0; i < ARRAY_SIZE(ulpi_ids); i++) {
-		if (ulpi_ids[i].id == ULPI_ID(vid, pid)) {
-			pr_info("Found %s ULPI transceiver (0x%04x:0x%04x).\n",
-			ulpi_ids[i].name, vid, pid);
-			return 0;
+
+	*vid = ulpi_id & 0xffff;
+	*pid = (ulpi_id >> 16) & 0xffff;
+
+	return 0;
+}
+
+int ulpi_probe(void __iomem *view)
+{
+	int i, j, vid, pid, ret;
+
+	for (i = 0; i < 4; i++) {
+		ret = ulpi_read_id(view, &vid, &pid);
+		if (ret)
+			return ret;
+
+		for (j = 0; j < ARRAY_SIZE(ulpi_ids); j++) {
+			if (ulpi_ids[j].id == ULPI_ID(vid, pid)) {
+				pr_info("Found %s ULPI transceiver (0x%04x:0x%04x).\n",
+				ulpi_ids[j].name, vid, pid);
+				return 0;
+			}
 		}
 	}
 
-	pr_err("No ULPI found.\n");
+	pr_err("No ULPI found. vid: 0x%04x pid: 0x%04x\n", vid, pid);
 
-	return -1;
+	return -ENODEV;
 }
 
 int ulpi_set_vbus(void __iomem *view, int on)
-- 
1.8.2.rc2


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-05 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-05 13:26 [PATCH] Revert "usb: chipidea-imx: Fix usb initialization" Lucas Stach
2013-06-05 13:33 ` Alexander Shiyan
2013-06-05 20:20   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox