From 270efaacd171ecf43c17b1e78cc4231462639e2b Mon Sep 17 00:00:00 2001 From: "jino.cho" Date: Thu, 14 Apr 2016 16:33:56 +0900 Subject: [PATCH] artik5: gadget: add usb initialization functions This patch adds usb initialization functions for the artik5 board to support thor downloader. Change-Id: Ie0a96da2f8d2b852db4aadfae6c4c4f21b612a2b Signed-off-by: jino.cho --- board/samsung/espresso3250/espresso3250.c | 45 +++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/board/samsung/espresso3250/espresso3250.c b/board/samsung/espresso3250/espresso3250.c index 10e1d6467..f8a5b4d9c 100644 --- a/board/samsung/espresso3250/espresso3250.c +++ b/board/samsung/espresso3250/espresso3250.c @@ -32,6 +32,9 @@ #include #include #include +#include +#include +#include #include #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) { -- 2.34.1