colibri_vf: Enable USB support for Colibri Vybrid
authorSanchayan Maity <maitysanchayan@gmail.com>
Fri, 17 Apr 2015 13:26:42 +0000 (18:56 +0530)
committerTom Rini <trini@konsulko.com>
Thu, 23 Apr 2015 18:56:09 +0000 (14:56 -0400)
Enable USB support on Toradex Colibri Vybrid Modules.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
board/toradex/colibri_vf/colibri_vf.c
include/configs/colibri_vf.h

index e7bc6c1f641ef08ec9f5d5b08ceef4265050b473..31ebb1935fd6af62765e16dc1d6aba37eebf916b 100644 (file)
@@ -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;
+}
index 84ffbe8bcc44142a7f929db5e4d335463ca4d7e3..414600ac4317d41205911eb339ec3f1912dd508a 100644 (file)
 
 #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" \
        "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
 
 #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 */