mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* fsl-udc (USB gadget) anyone?
@ 2010-08-16  6:37 Baruch Siach
  2010-08-16  7:09 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Baruch Siach @ 2010-08-16  6:37 UTC (permalink / raw)
  To: barebox

Hi Barebox list,

I see that there are no in-tree fsl-udc driver users. Does anyone here have 
experience with this driver on an i.MX based system? What pre-probe() 
initialization does this driver require at the platform code?

TIA,

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

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

* Re: fsl-udc (USB gadget) anyone?
  2010-08-16  6:37 fsl-udc (USB gadget) anyone? Baruch Siach
@ 2010-08-16  7:09 ` Sascha Hauer
  2010-08-16  7:58   ` Eric Bénard
  2010-08-17 14:13   ` Baruch Siach
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2010-08-16  7:09 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

Hi Baruch,

On Mon, Aug 16, 2010 at 09:37:04AM +0300, Baruch Siach wrote:
> Hi Barebox list,
> 
> I see that there are no in-tree fsl-udc driver users. Does anyone here have 
> experience with this driver on an i.MX based system? What pre-probe() 
> initialization does this driver require at the platform code?


We are using it on a custom i.MX25 board (which is not in mainline
because hardly anyone could make use of the code). Here is the platform
initialization code (mixed with ehci host support). It works fine in DFU
mode, serial support is probably not working. I have tried serial
support, but had problems integrating it properly in barebox.

+static void cm3389_usb_init(void)
+{
+	unsigned int tmp;
+
+	/* Host 2 */
+	tmp = readl(IMX_OTG_BASE + 0x600);
+	tmp &= ~(3 << 21);
+	tmp |= (2 << 21) | (1 << 4) | (1 << 5);
+	writel(tmp, IMX_OTG_BASE + 0x600);
+
+	tmp = readl(IMX_OTG_BASE + 0x584);
+	tmp |= 3 << 30;
+	writel(tmp, IMX_OTG_BASE + 0x584);
+
+	/* Set to Host mode */
+	tmp = readl(IMX_OTG_BASE + 0x1a8);
+	writel(tmp | 0x3, IMX_OTG_BASE + 0x1a8);
+}
+
+static struct device_d usbh2_dev = {
+	.name     = "ehci",
+	.map_base = IMX_OTG_BASE + 0x400,
+	.size     = 0x200,
+};
+
+static struct fsl_usb2_platform_data usb_pdata = {
+	.operating_mode	= FSL_USB2_DR_DEVICE,
+	.phy_mode	= FSL_USB2_PHY_UTMI,
+};
+
+static struct device_d usbotg_dev = {
+	.name     = "fsl-udc",
+	.map_base = IMX_OTG_BASE,
+	.size     = 0x200,
+	.platform_data = &usb_pdata,
+};

Sascha

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

* Re: fsl-udc (USB gadget) anyone?
  2010-08-16  7:09 ` Sascha Hauer
@ 2010-08-16  7:58   ` Eric Bénard
  2010-08-17 14:13   ` Baruch Siach
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Bénard @ 2010-08-16  7:58 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sacha, Hi Baruch,

Le 16/08/2010 09:09, Sascha Hauer a écrit :
> On Mon, Aug 16, 2010 at 09:37:04AM +0300, Baruch Siach wrote:
>> Hi Barebox list,
>>
>> I see that there are no in-tree fsl-udc driver users. Does anyone here have
>> experience with this driver on an i.MX based system? What pre-probe()
>> initialization does this driver require at the platform code?
>
>
> We are using it on a custom i.MX25 board (which is not in mainline
> because hardly anyone could make use of the code). Here is the platform
> initialization code (mixed with ehci host support). It works fine in DFU
> mode, serial support is probably not working. I have tried serial
> support, but had problems integrating it properly in barebox.

interesting, I've tested it on an i.MX27 and I had to do the following 
change to get DFU working fine, else the 1st packet's last bytes were 
always wrong when flashing data to the NOR (or simply copying data into 
RAM) :
http://www.spinics.net/lists/u-boot-v2/msg01166.html

Do you think this fix is wrong ?

The init is the following :

static struct fsl_usb2_platform_data udc_info = {
	.operating_mode = FSL_USB2_DR_DEVICE,
	.phy_mode = FSL_USB2_PHY_ULPI,
};

static struct device_d udc_dev = {
	.name     = "fsl-udc",
	.map_base = IMX_OTG_BASE,
	.platform_data	= &udc_info,
};

Eric

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

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

* Re: fsl-udc (USB gadget) anyone?
  2010-08-16  7:09 ` Sascha Hauer
  2010-08-16  7:58   ` Eric Bénard
@ 2010-08-17 14:13   ` Baruch Siach
  1 sibling, 0 replies; 4+ messages in thread
From: Baruch Siach @ 2010-08-17 14:13 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

On Mon, Aug 16, 2010 at 09:09:04AM +0200, Sascha Hauer wrote:
> On Mon, Aug 16, 2010 at 09:37:04AM +0300, Baruch Siach wrote:
> > Hi Barebox list,
> > 
> > I see that there are no in-tree fsl-udc driver users. Does anyone here have 
> > experience with this driver on an i.MX based system? What pre-probe() 
> > initialization does this driver require at the platform code?
> 
> 
> We are using it on a custom i.MX25 board (which is not in mainline
> because hardly anyone could make use of the code). Here is the platform
> initialization code (mixed with ehci host support). It works fine in DFU
> mode, serial support is probably not working. I have tried serial
> support, but had problems integrating it properly in barebox.

[snip]

> +static struct fsl_usb2_platform_data usb_pdata = {
> +	.operating_mode	= FSL_USB2_DR_DEVICE,
> +	.phy_mode	= FSL_USB2_PHY_UTMI,
> +};
> +
> +static struct device_d usbotg_dev = {
> +	.name     = "fsl-udc",
> +	.map_base = IMX_OTG_BASE,
> +	.size     = 0x200,
> +	.platform_data = &usb_pdata,
> +};

Thanks for the info. Unfortunately I was not able to get dfu work on both the 
i.MX25 PDK and our custom board. The board doesn't even get enumerated. The 
USB PHY wiring is the same on both.  After running the 'dfu' command as 
follows:

barebox:/ dfu -V 0x082d -P 0x2000 test(script)

I connect the board to my host and see the following on the host side:

[113870.024034] usb 2-1: new high speed USB device using ehci_hcd and address 101
[113870.092245] hub 2-0:1.0: unable to enumerate USB device on port 1
[113870.584048] usb 6-1: new full speed USB device using uhci_hcd and address 27
[113870.700071] hub 6-0:1.0: unable to enumerate USB device on port 1
[113871.080062] usb 6-1: new full speed USB device using uhci_hcd and address 28
[113871.200106] usb 6-1: device descriptor read/64, error -71
[113871.424073] usb 6-1: device descriptor read/64, error -71
[113871.640069] usb 6-1: new full speed USB device using uhci_hcd and address 29
[113871.760068] usb 6-1: device descriptor read/64, error -71
[113871.984068] usb 6-1: device descriptor read/64, error -71
[113872.200067] usb 6-1: new full speed USB device using uhci_hcd and address 30
[113872.608070] usb 6-1: device not accepting address 30, error -71
[113872.720073] usb 6-1: new full speed USB device using uhci_hcd and address 31
[113873.128058] usb 6-1: device not accepting address 31, error -71
[113873.128079] hub 6-0:1.0: unable to enumerate USB device on port 1

Sprinkling printfs over the fsl-udc driver code didn't reveal much, except 
from repeated USB_STS_PORT_CHANGE and USB_STS_RESET interrupts. Before giving 
up completely I thought I'd just report this failure, maybe someone has a 
clue.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

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

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

end of thread, other threads:[~2010-08-17 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-16  6:37 fsl-udc (USB gadget) anyone? Baruch Siach
2010-08-16  7:09 ` Sascha Hauer
2010-08-16  7:58   ` Eric Bénard
2010-08-17 14:13   ` Baruch Siach

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