mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH RESEND] usb: chipidea-imx: Fix usb initialization
@ 2013-03-12 17:02 Alexander Shiyan
  2013-03-15 19:06 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-03-12 17:02 UTC (permalink / raw)
  To: barebox

This patch fix chipidea-imx usb initialization.
"imx_chipidea_port_init" was moved before PORTSC setup in the
commit "USB i.MX chipidea: implement post init support". This
change breaks usb function with ULPI. Patch moves port initialization
back after PORTSC setup, so it works again.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 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 483484e..1570f90 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -73,13 +73,13 @@ static int imx_chipidea_probe(struct device_d *dev)
 	data.post_init = imx_chipidea_port_post_init;
 	data.drvdata = dev;
 
-	imx_chipidea_port_init(dev);
-
 	portsc = readl(base + 0x184);
 	portsc &= ~MXC_EHCI_PORTSC_MASK;
 	portsc |= pdata->flags & MXC_EHCI_PORTSC_MASK;
 	writel(portsc, base + 0x184);
 
+	imx_chipidea_port_init(dev);
+
 	if ((pdata->flags & MXC_EHCI_PORTSC_MASK) == MXC_EHCI_MODE_ULPI) {
 		dev_dbg(dev, "using ULPI phy\n");
 		if (IS_ENABLED(CONFIG_USB_ULPI)) {
-- 
1.7.12.4


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

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

* Re: [PATCH RESEND] usb: chipidea-imx: Fix usb initialization
  2013-03-12 17:02 [PATCH RESEND] usb: chipidea-imx: Fix usb initialization Alexander Shiyan
@ 2013-03-15 19:06 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-03-15 19:06 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

Hi Alexander,

On Tue, Mar 12, 2013 at 09:02:42PM +0400, Alexander Shiyan wrote:
> This patch fix chipidea-imx usb initialization.
> "imx_chipidea_port_init" was moved before PORTSC setup in the
> commit "USB i.MX chipidea: implement post init support". This
> change breaks usb function with ULPI. Patch moves port initialization
> back after PORTSC setup, so it works again.

I finally found some time to test it on the EfikaMX which I was afraid
this patch breaks. Good news is it doesn't.

You probably missed my answer to the original patch, so here it's again:
On which board are you working? The ULPI works for me on the the pcm038
and the EfikaMX smartbook with or without the patch.

After some digging around in the Efika U-Boot I found the equivalent of
the attached patch, which seems to make ULPI initialization far more
reliable. Do you have a chance to try this on your hardware?

Sascha

8<------------------------------------------------
commit 3be7b966ed7be54590e27e67a7f6b197d85b38f8
Author: Sascha Hauer <s.hauer@pengutronix.de>
Date:   Mon Dec 3 21:59:56 2012 +0100

    pcm038: Stop ongoing ULPI transfers before registering the transceiver
    
    The ULPI lines are normally input to the USB port. In order to configure
    the ULPI transceiver properly the ongoing transfers must be stopped. This
    can be done by configuring the the STP pin as gpio output and drinving
    it high.
    
    Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c
index 7b25110..a50a1f2 100644
--- a/arch/arm/boards/pcm038/pcm970.c
+++ b/arch/arm/boards/pcm038/pcm970.c
@@ -160,7 +160,7 @@ static int pcm970_init(void)
 		PA1_PF_USBH2_DIR,
 		PA2_PF_USBH2_DATA7,
 		PA3_PF_USBH2_NXT,
-		PA4_PF_USBH2_STP,
+		4 | GPIO_PORTA | GPIO_GPIO | GPIO_OUT,
 		PD19_AF_USBH2_DATA4,
 		PD20_AF_USBH2_DATA3,
 		PD21_AF_USBH2_DATA6,
@@ -176,8 +176,14 @@ static int pcm970_init(void)
 	/* Configure SJA1000 on cs4 */
 	imx27_setup_weimcs(4, 0x0000DCF6, 0x444A0301, 0x44443302);
 
-	if (IS_ENABLED(CONFIG_USB))
+	if (IS_ENABLED(CONFIG_USB)) {
+		/* Stop ULPI */
+		gpio_direction_output(4, 1);
+		mdelay(1);
+		imx_gpio_mode(PA4_PF_USBH2_STP);
+
 		imx27_add_usbh2(&pcm970_usbh2_pdata);
+	}
 
 #ifdef CONFIG_DISK_INTF_PLATFORM_IDE
 	pcm970_ide_init();

-- 
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] 2+ messages in thread

end of thread, other threads:[~2013-03-15 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 17:02 [PATCH RESEND] usb: chipidea-imx: Fix usb initialization Alexander Shiyan
2013-03-15 19:06 ` Sascha Hauer

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