From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Fri, 07 Nov 2014 15:40:00 +0100 Subject: [U-Boot] [PATCH 5/5] arm: socfpga: Add example UDC config In-Reply-To: <1415077654-17181-5-git-send-email-marex@denx.de> References: <1415077654-17181-1-git-send-email-marex@denx.de> <1415077654-17181-5-git-send-email-marex@denx.de> Message-ID: <20141107154000.2f059b83@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, > Add example of an USB UDC configuration with DFU and UMS. > > Signed-off-by: Marek Vasut > Cc: Chin Liang See > Cc: Dinh Nguyen > Cc: Vince Bridgers > Cc: Pavel Machek > Cc: Stefan Roese > Cc: Lukasz Majewski > --- > board/altera/socfpga/socfpga_cyclone5.c | 21 +++++++++++++++++++++ > include/configs/socfpga_common.h | 30 > +++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 > deletion(-) > > diff --git a/board/altera/socfpga/socfpga_cyclone5.c > b/board/altera/socfpga/socfpga_cyclone5.c index 0f81d89..ce625e5 > 100644 --- a/board/altera/socfpga/socfpga_cyclone5.c > +++ b/board/altera/socfpga/socfpga_cyclone5.c > @@ -8,6 +8,10 @@ > #include > #include > > +#include > +#include > +#include > + > #include > > DECLARE_GLOBAL_DATA_PTR; > @@ -39,3 +43,20 @@ int board_init(void) > > return 0; > } > + > +#ifdef CONFIG_USB_GADGET > +struct s3c_plat_otg_data socfpga_otg_data = { > + .regs_otg = CONFIG_USB_DWC2_REG_ADDR, > + .usb_gusbcfg = 0x1417, > +}; > + > +int board_usb_init(int index, enum usb_init_type init) > +{ > + return s3c_udc_probe(&socfpga_otg_data); > +} > + > +int g_dnl_board_usb_cable_connected(void) > +{ > + return 1; > +} > +#endif > diff --git a/include/configs/socfpga_common.h > b/include/configs/socfpga_common.h index 1df886b..9823be6 100644 > --- a/include/configs/socfpga_common.h > +++ b/include/configs/socfpga_common.h > @@ -37,7 +37,7 @@ > */ > #define CONFIG_NR_DRAM_BANKS 1 > #define PHYS_SDRAM_1 0x0 > -#define CONFIG_SYS_MALLOC_LEN (10 * 1024 * 1024) > +#define CONFIG_SYS_MALLOC_LEN (64 * 1024 * 1024) > #define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1 > #define CONFIG_SYS_MEMTEST_END PHYS_SDRAM_1_SIZE > > @@ -191,6 +191,34 @@ > #endif > > /* > + * USB Gadget (DFU, UMS) > + */ > +#if defined(CONFIG_CMD_DFU) || defined(CONFIG_CMD_USB_MASS_STORAGE) > +#define CONFIG_USB_GADGET > +#define CONFIG_USB_GADGET_S3C_UDC_OTG > +#define CONFIG_USB_GADGET_DUALSPEED > +#define CONFIG_USB_GADGET_VBUS_DRAW 2 > + > +/* USB Composite download gadget - g_dnl */ > +#define CONFIG_USBDOWNLOAD_GADGET > +#define CONFIG_USB_GADGET_MASS_STORAGE > + > +#define CONFIG_DFU_FUNCTION > +#define CONFIG_DFU_MMC > +#define CONFIG_SYS_DFU_DATA_BUF_SIZE (32 * 1024 * 1024) > +#define DFU_DEFAULT_POLL_TIMEOUT 300 > + > +/* USB IDs */ > +#define CONFIG_G_DNL_VENDOR_NUM 0x0525 /* > NetChip */ +#define CONFIG_G_DNL_PRODUCT_NUM 0xA4A5 /* > Linux-USB File-backed Storage Gadget */ +#define > CONFIG_G_DNL_UMS_VENDOR_NUM CONFIG_G_DNL_VENDOR_NUM +#define > CONFIG_G_DNL_UMS_PRODUCT_NUM CONFIG_G_DNL_PRODUCT_NUM +#ifndef > CONFIG_G_DNL_MANUFACTURER +#define > CONFIG_G_DNL_MANUFACTURER "Altera" +#endif > +#endif > + > +/* > * U-Boot environment > */ > #define CONFIG_SYS_CONSOLE_IS_IN_ENV Reviewed-by: Lukasz Majewski Tested-by: Lukasz Majewski -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group