fsl-udc (USB gadget) anyone?

Sascha Hauer s.hauer at pengutronix.de
Mon Aug 16 03:09:04 EDT 2010


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 |



More information about the barebox mailing list