[U-Boot] [PATCH v4 7/7] colibri_vf: Enable USB support for Colibri Vybrid

Sanchayan Maity maitysanchayan at gmail.com
Fri Apr 17 15:26:42 CEST 2015


Enable USB support on Toradex Colibri Vybrid Modules.

Signed-off-by: Sanchayan Maity <maitysanchayan at gmail.com>
---
 board/toradex/colibri_vf/colibri_vf.c | 24 +++++++++++++++++++++++
 include/configs/colibri_vf.h          | 37 +++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c
index e7bc6c1..31ebb19 100644
--- a/board/toradex/colibri_vf/colibri_vf.c
+++ b/board/toradex/colibri_vf/colibri_vf.c
@@ -216,6 +216,14 @@ static void clock_init(void)
 	clrsetbits_le32(&ccm->ccgr10, CCM_REG_CTRL_MASK,
 			CCM_CCGR10_NFC_CTRL_MASK);
 
+#ifdef CONFIG_CI_UDC
+	setbits_le32(&ccm->ccgr1, CCM_CCGR1_USBC0_CTRL_MASK);
+#endif
+
+#ifdef CONFIG_USB_EHCI
+	setbits_le32(&ccm->ccgr7, CCM_CCGR7_USBC1_CTRL_MASK);
+#endif
+
 	clrsetbits_le32(&anadig->pll5_ctrl, ANADIG_PLL5_CTRL_BYPASS |
 			ANADIG_PLL5_CTRL_POWERDOWN, ANADIG_PLL5_CTRL_ENABLE |
 			ANADIG_PLL5_CTRL_DIV_SELECT);
@@ -359,3 +367,19 @@ int checkboard(void)
 
 	return 0;
 }
+
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+	unsigned short usb_pid;
+
+	put_unaligned(CONFIG_TRDX_VID, &dev->idVendor);
+
+	if (is_colibri_vf61())
+		usb_pid = CONFIG_TRDX_PID_COLIBRI_VF61IT;
+	else
+		usb_pid = CONFIG_TRDX_PID_COLIBRI_VF50IT;
+
+	put_unaligned(usb_pid, &dev->idProduct);
+
+	return 0;
+}
diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h
index 84ffbe8..414600a 100644
--- a/include/configs/colibri_vf.h
+++ b/include/configs/colibri_vf.h
@@ -146,6 +146,8 @@
 
 #define CONFIG_BOOTCOMMAND "run ubiboot; run sdboot; run nfsboot"
 
+#define DFU_ALT_NAND_INFO "vf-bcb part 0,1;u-boot part 0,2;ubi part 0,4"
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"kernel_addr_r=0x82000000\0" \
 	"fdt_addr_r=0x84000000\0" \
@@ -165,6 +167,7 @@
 	"source ${loadaddr}\0" \
 	"setupdate=run setsdupdate || run setusbupdate\0" \
 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
+	"dfu_alt_info=" DFU_ALT_NAND_INFO "\0" \
 	SD_BOOTCMD \
 	NFS_BOOTCMD \
 	UBI_BOOTCMD
@@ -231,4 +234,38 @@
 
 #define CONFIG_SYS_CACHELINE_SIZE 32
 
+/* USB Host Support */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_VF
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+
+/* USB Client Support */
+#define CONFIG_USB_GADGET
+#define CONFIG_CI_UDC
+#define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW      2
+#define CONFIG_TRDX_VID                  0x1B67
+#define CONFIG_TRDX_PID_COLIBRI_VF50     0x0016
+#define CONFIG_TRDX_PID_COLIBRI_VF61     0x0017
+#define CONFIG_TRDX_PID_COLIBRI_VF61IT   0x0018
+#define CONFIG_TRDX_PID_COLIBRI_VF50IT   0x0019
+#define CONFIG_G_DNL_MANUFACTURER        "Toradex"
+#define CONFIG_G_DNL_VENDOR_NUM          CONFIG_TRDX_VID
+#define CONFIG_G_DNL_PRODUCT_NUM         CONFIG_TRDX_PID_COLIBRI_VF50
+
+/* USB DFU */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_CMD_DFU
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_NAND
+#define CONFIG_DFU_MMC
+#define CONFIG_SYS_DFU_DATA_BUF_SIZE (1024 * 1024)
+
+/* USB Storage */
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
+#define CONFIG_CMD_USB_MASS_STORAGE
+
 #endif /* __CONFIG_H */
-- 
2.3.5



More information about the U-Boot mailing list