[PATCH 2/3] mx23-evk: add USB gadget support

Eric Bénard eric at eukrea.com
Sun Feb 10 11:22:50 EST 2013


- enable the USB OTG device in gadget mode
- tested on i.MX23 EVH rev B1 with DFU

Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
index 043b62b..76377b1 100644
--- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
+++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c
@@ -24,6 +24,8 @@
 #include <mach/imx-regs.h>
 #include <mach/clock.h>
 #include <mach/mci.h>
+#include <usb/fsl_usb2.h>
+#include <mach/usb.h>
 
 static struct mxs_mci_platform_data mci_pdata = {
 	.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
@@ -42,6 +44,13 @@ static const uint32_t pad_setup[] = {
 	SSP1_DETECT | PULLUP(1),
 };
 
+#ifdef CONFIG_USB_GADGET_DRIVER_ARC
+static struct fsl_usb2_platform_data usb_pdata = {
+	.operating_mode	= FSL_USB2_DR_DEVICE,
+	.phy_mode	= FSL_USB2_PHY_UTMI,
+};
+#endif
+
 static int mx23_evk_mem_init(void)
 {
 	arm_add_mem_device("ram0", IMX_MEMORY_BASE, 32 * 1024 * 1024);
@@ -111,6 +120,12 @@ static int mx23_evk_devices_init(void)
 		printf("Cannot create the 'env0' persistant "
 			 "environment storage (%d)\n", rc);
 
+#ifdef CONFIG_USB_GADGET_DRIVER_ARC
+	imx23_usb_phy_enable();
+	add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_USB_BASE, NULL);
+	add_generic_device("fsl-udc", DEVICE_ID_DYNAMIC, NULL, IMX_USB_BASE,
+			   0x200, IORESOURCE_MEM, &usb_pdata);
+#endif
 	return 0;
 }
 
-- 
1.7.11.7




More information about the barebox mailing list