artik5: gadget: add usb initialization functions 56/65956/2
authorjino.cho <jino.cho@samsung.com>
Thu, 14 Apr 2016 07:33:56 +0000 (16:33 +0900)
committerjino.cho <jino.cho@samsung.com>
Thu, 14 Apr 2016 07:40:04 +0000 (16:40 +0900)
This patch adds usb initialization functions for the artik5 board to support
thor downloader.

Change-Id: Ie0a96da2f8d2b852db4aadfae6c4c4f21b612a2b
Signed-off-by: jino.cho <jino.cho@samsung.com>
board/samsung/espresso3250/espresso3250.c

index 10e1d6467ad2c9b17c1b9e5e1e5e0ccb45d94e87..f8a5b4d9cf8ddf225ceacdcdd99b43a215dabfb0 100644 (file)
@@ -32,6 +32,9 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
 #include <asm/arch/sysreg.h>
+#include <asm/unaligned.h>
+#include <usb.h>
+#include <usb/s3c_udc.h>
 #include <mmc.h>
 #include "pmic.h"
 
@@ -604,6 +607,48 @@ int board_late_init(void)
        return 0;
 }
 
+#ifdef CONFIG_USB_GADGET
+static int s5p_phy_control(int on)
+{
+       return 0;
+}
+
+struct s3c_plat_otg_data s5p_otg_data = {
+       .phy_control    = s5p_phy_control,
+       .regs_phy       = EXYNOS4_USBPHY_BASE,
+       .regs_otg       = EXYNOS4_USBOTG_BASE,
+       .usb_phy_ctrl   = EXYNOS4_USBPHY_CONTROL,
+       .usb_flags      = PHY0_SLEEP,
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+       return s3c_udc_probe(&s5p_otg_data);
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_USBDOWNLOAD_GADGET
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+       if (!strcmp(name, "usb_dnl_thor")) {
+               put_unaligned(CONFIG_G_DNL_THOR_VENDOR_NUM, &dev->idVendor);
+               put_unaligned(CONFIG_G_DNL_THOR_PRODUCT_NUM, &dev->idProduct);
+       } else if (!strcmp(name, "usb_dnl_ums")) {
+               put_unaligned(CONFIG_G_DNL_UMS_VENDOR_NUM, &dev->idVendor);
+               put_unaligned(CONFIG_G_DNL_UMS_PRODUCT_NUM, &dev->idProduct);
+       } else {
+               put_unaligned(CONFIG_G_DNL_VENDOR_NUM, &dev->idVendor);
+               put_unaligned(CONFIG_G_DNL_PRODUCT_NUM, &dev->idProduct);
+       }
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_SET_DFU_ALT_INFO
 char *get_dfu_alt_system(char *interface, char *devstr)
 {