diff options
author | Tom Rini <trini@konsulko.com> | 2018-02-23 13:04:48 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-02-23 13:04:48 -0500 |
commit | 1c124d379dbb78a93495202749efe952fbddba1c (patch) | |
tree | 0a402df7f30b79cc9321061b778eb56ca0a5cea9 | |
parent | 9ab81fcc8a0181cc19b8234d0e7632bd09c27c83 (diff) | |
parent | b0cce3f90f546da0c1e0dda5abcaf05d81078b0d (diff) | |
download | u-boot-1c124d379dbb78a93495202749efe952fbddba1c.tar.gz |
Merge git://git.denx.de/u-boot-usb
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | board/siemens/common/factoryset.c | 4 | ||||
-rw-r--r-- | cmd/Kconfig | 2 | ||||
-rw-r--r-- | cmd/dfu.c | 18 | ||||
-rw-r--r-- | cmd/fastboot/Kconfig | 18 | ||||
-rw-r--r-- | cmd/usb_gadget_sdp.c | 4 | ||||
-rw-r--r-- | common/Makefile | 6 | ||||
-rw-r--r-- | common/spl/spl_sdp.c | 4 | ||||
-rw-r--r-- | drivers/dfu/Kconfig | 14 | ||||
-rw-r--r-- | drivers/dfu/Makefile | 2 | ||||
-rw-r--r-- | drivers/dfu/dfu_tftp.c | 4 | ||||
-rw-r--r-- | drivers/usb/Kconfig | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/f_sdp.c | 27 | ||||
-rw-r--r-- | include/configs/tegra-common-post.h | 2 |
15 files changed, 75 insertions, 35 deletions
@@ -1198,7 +1198,7 @@ The following options need to be configured: key for the Replay Protection Memory Block partition in eMMC. - USB Device Firmware Update (DFU) class support: - CONFIG_USB_FUNCTION_DFU + CONFIG_DFU_OVER_USB This enables the USB portion of the DFU USB class CONFIG_DFU_MMC diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 81bbb5758d..7fa2673c2b 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -144,7 +144,7 @@ int factoryset_read_eeprom(int i2c_addr) unsigned char eeprom_buf[0x3c00], hdr[4], buf[MAX_STRING_LENGTH]; unsigned char *cp, *cp1; -#if defined(CONFIG_USB_FUNCTION_DFU) +#if defined(CONFIG_DFU_OVER_USB) factory_dat.usb_vendor_id = CONFIG_USB_GADGET_VENDOR_NUM; factory_dat.usb_product_id = CONFIG_USB_GADGET_PRODUCT_NUM; #endif @@ -202,7 +202,7 @@ int factoryset_read_eeprom(int i2c_addr) cp1 += 3; } -#if defined(CONFIG_USB_FUNCTION_DFU) +#if defined(CONFIG_DFU_OVER_USB) /* read vid and pid for dfu mode */ if (0 <= get_factory_record_val(cp, size, (uchar *)"USBD1", (uchar *)"vid", buf, diff --git a/cmd/Kconfig b/cmd/Kconfig index 885712f00f..d997f0c7a6 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -588,7 +588,7 @@ config CMD_DEMO config CMD_DFU bool "dfu" - select USB_FUNCTION_DFU + select DFU help Enables the command "dfu" which is used to have U-Boot create a DFU class device via USB. This command requires that the "dfu_alt_info" @@ -25,12 +25,14 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 4) return CMD_RET_USAGE; +#ifdef CONFIG_DFU_OVER_USB char *usb_controller = argv[1]; +#endif char *interface = argv[2]; char *devstring = argv[3]; - int ret; -#ifdef CONFIG_DFU_TFTP + int ret = 0; +#ifdef CONFIG_DFU_OVER_TFTP unsigned long addr = 0; if (!strcmp(argv[1], "tftp")) { if (argc == 5) @@ -39,7 +41,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return update_tftp(addr, interface, devstring); } #endif - +#ifdef CONFIG_DFU_OVER_USB ret = dfu_init_env_entities(interface, devstring); if (ret) goto done; @@ -56,18 +58,24 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) done: dfu_free_entities(); +#endif return ret; } U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu, "Device Firmware Upgrade", +#ifdef CONFIG_DFU_OVER_USB "<USB_controller> <interface> <dev> [list]\n" " - device firmware upgrade via <USB_controller>\n" " on device <dev>, attached to interface\n" " <interface>\n" " [list] - list available alt settings\n" -#ifdef CONFIG_DFU_TFTP - "dfu tftp <interface> <dev> [<addr>]\n" +#endif +#ifdef CONFIG_DFU_OVER_TFTP +#ifdef CONFIG_DFU_OVER_USB + "dfu " +#endif + "tftp <interface> <dev> [<addr>]\n" " - device firmware upgrade via TFTP\n" " on device <dev>, attached to interface\n" " <interface>\n" diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index cbb9183ea2..0d2c2f131e 100644 --- a/cmd/fastboot/Kconfig +++ b/cmd/fastboot/Kconfig @@ -72,9 +72,23 @@ config FASTBOOT_FLASH the downloaded image to a non-volatile storage device. Define this to enable the "fastboot flash" command. +choice + prompt "Flash provider for FASTBOOT" + depends on FASTBOOT_FLASH + +config FASTBOOT_FLASH_MMC + bool "FASTBOOT on MMC" + depends on MMC + +config FASTBOOT_FLASH_NAND + bool "FASTBOOT on NAND" + depends on NAND + +endchoice + config FASTBOOT_FLASH_MMC_DEV int "Define FASTBOOT MMC FLASH default device" - depends on FASTBOOT_FLASH && MMC + depends on FASTBOOT_FLASH_MMC default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 help @@ -84,7 +98,7 @@ config FASTBOOT_FLASH_MMC_DEV config FASTBOOT_FLASH_NAND_DEV int "Define FASTBOOT NAND FLASH default device" - depends on FASTBOOT_FLASH && NAND + depends on FASTBOOT_FLASH_NAND depends on CMD_MTDPARTS default 0 if ARCH_SUNXI && NAND_SUNXI help diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index ae4d73c125..97d00ec545 100644 --- a/cmd/usb_gadget_sdp.c +++ b/cmd/usb_gadget_sdp.c @@ -28,13 +28,13 @@ static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ret = sdp_init(controller_index); if (ret) { - pr_err("SDP init failed: %d", ret); + pr_err("SDP init failed: %d\n", ret); goto exit; } /* This command typically does not return but jumps to an image */ sdp_handle(controller_index); - pr_err("SDP ended"); + pr_err("SDP ended\n"); exit: g_dnl_unregister(); diff --git a/common/Makefile b/common/Makefile index c7bde239c1..7011dada99 100644 --- a/common/Makefile +++ b/common/Makefile @@ -66,7 +66,9 @@ endif # !CONFIG_SPL_BUILD obj-$(CONFIG_$(SPL_TPL_)BOOTSTAGE) += bootstage.o ifdef CONFIG_SPL_BUILD -obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu.o +ifdef CONFIG_SPL_DFU_SUPPORT +obj-$(CONFIG_DFU_OVER_USB) += dfu.o +endif obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o @@ -128,7 +130,7 @@ endif obj-y += cli.o obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o -obj-$(CONFIG_CMD_DFU) += dfu.o +obj-$(CONFIG_DFU_OVER_USB) += dfu.o obj-y += command.o obj-$(CONFIG_$(SPL_)LOG) += log.o obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index 333d518f4d..0c4603a3db 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -24,13 +24,13 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, ret = sdp_init(controller_index); if (ret) { - pr_err("SDP init failed: %d", ret); + pr_err("SDP init failed: %d\n", ret); return -ENODEV; } /* This command typically does not return but jumps to an image */ sdp_handle(controller_index); - pr_err("SDP ended"); + pr_err("SDP ended\n"); return -EINVAL; } diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index fa27efbb40..51ab484c2a 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -1,12 +1,22 @@ menu "DFU support" -config USB_FUNCTION_DFU +config DFU + bool + imply DFU_OVER_USB if USB_GADGET + +config DFU_OVER_USB bool select HASH + depends on USB_GADGET + +config DFU_OVER_TFTP + bool + depends on NET -if CMD_DFU +if DFU config DFU_TFTP bool "DFU via TFTP" + select DFU_OVER_TFTP help This option allows performing update of DFU-managed medium with data sent via TFTP boot. diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile index 61f2b71f91..7f35871ddc 100644 --- a/drivers/dfu/Makefile +++ b/drivers/dfu/Makefile @@ -5,7 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-$(CONFIG_USB_FUNCTION_DFU) += dfu.o +obj-$(CONFIG_DFU) += dfu.o obj-$(CONFIG_DFU_MMC) += dfu_mmc.o obj-$(CONFIG_DFU_NAND) += dfu_nand.o obj-$(CONFIG_DFU_RAM) += dfu_ram.o diff --git a/drivers/dfu/dfu_tftp.c b/drivers/dfu/dfu_tftp.c index 62bf797dac..f0afbac477 100644 --- a/drivers/dfu/dfu_tftp.c +++ b/drivers/dfu/dfu_tftp.c @@ -38,7 +38,7 @@ int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len, } strsep(&s, "@"); - debug("%s: image name: %s strlen: %d\n", __func__, sb, strlen(sb)); + debug("%s: image name: %s strlen: %zd\n", __func__, sb, strlen(sb)); alt_setting_num = dfu_get_alt(sb); free(sb); @@ -56,7 +56,7 @@ int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len, goto done; } - ret = dfu_write_from_mem_addr(dfu, (void *)addr, len); + ret = dfu_write_from_mem_addr(dfu, (void *)(uintptr_t)addr, len); done: dfu_free_entities(); diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7de41057ca..4fbe172e05 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -71,6 +71,7 @@ config USB_STORAGE config USB_KEYBOARD bool "USB Keyboard support" + select SYS_STDIO_DEREGISTER ---help--- Say Y here if you want to use a USB keyboard for U-Boot command line input. diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index ee8bc994c5..748366fb9f 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_CI_UDC) += ci_udc.o ifndef CONFIG_SPL_BUILD obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o -obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o +obj-$(CONFIG_DFU_OVER_USB) += f_dfu.o obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o obj-$(CONFIG_USB_FUNCTION_SDP) += f_sdp.o diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index dd7b9cddb1..43c5cfbb77 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -230,6 +230,11 @@ static struct usb_gadget_strings *sdp_generic_strings[] = { NULL, }; +static inline void *sdp_ptr(u32 val) +{ + return (void *)(uintptr_t)val; +} + static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) { struct f_sdp *sdp = req->context; @@ -238,12 +243,12 @@ static void sdp_rx_command_complete(struct usb_ep *ep, struct usb_request *req) u8 report = data[0]; if (status != 0) { - pr_err("Status: %d", status); + pr_err("Status: %d\n", status); return; } if (report != 1) { - pr_err("Unexpected report %d", report); + pr_err("Unexpected report %d\n", report); return; } @@ -323,12 +328,12 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) int datalen = req->length - 1; if (status != 0) { - pr_err("Status: %d", status); + pr_err("Status: %d\n", status); return; } if (report != 2) { - pr_err("Unexpected report %d", report); + pr_err("Unexpected report %d\n", report); return; } @@ -344,7 +349,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) } if (sdp->state == SDP_STATE_RX_FILE_DATA) { - memcpy((void *)sdp->dnl_address, req->buf + 1, datalen); + memcpy(sdp_ptr(sdp->dnl_address), req->buf + 1, datalen); sdp->dnl_address += datalen; } @@ -361,7 +366,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req) sdp->state = SDP_STATE_TX_SEC_CONF; break; default: - pr_err("Invalid state: %d", sdp->state); + pr_err("Invalid state: %d\n", sdp->state); } } @@ -371,7 +376,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req) int status = req->status; if (status != 0) { - pr_err("Status: %d", status); + pr_err("Status: %d\n", status); return; } @@ -394,7 +399,7 @@ static void sdp_tx_complete(struct usb_ep *ep, struct usb_request *req) sdp->state = SDP_STATE_IDLE; break; default: - pr_err("Wrong State: %d", sdp->state); + pr_err("Wrong State: %d\n", sdp->state); sdp->state = SDP_STATE_IDLE; break; } @@ -622,7 +627,7 @@ static u32 sdp_jump_imxheader(void *address) } printf("Jumping to 0x%08x\n", headerv2->entry); - entry = (void *)headerv2->entry; + entry = sdp_ptr(headerv2->entry); entry(); /* The image probably never returns hence we won't reach that point */ @@ -665,7 +670,7 @@ static void sdp_handle_in_ep(void) if (datalen > 64) datalen = 64; - memcpy(&data[1], (void *)sdp_func->dnl_address, datalen); + memcpy(&data[1], sdp_ptr(sdp_func->dnl_address), datalen); sdp_func->in_req->length = 65; sdp_func->dnl_bytes_remaining -= datalen; @@ -676,7 +681,7 @@ static void sdp_handle_in_ep(void) break; case SDP_STATE_JUMP: printf("Jumping to header at 0x%08x\n", sdp_func->jmp_address); - status = sdp_jump_imxheader((void *)sdp_func->jmp_address); + status = sdp_jump_imxheader(sdp_ptr(sdp_func->jmp_address)); /* If imx header fails, try some U-Boot specific headers */ if (status) { diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h index aea8f1fb8e..3eb9dd2af9 100644 --- a/include/configs/tegra-common-post.h +++ b/include/configs/tegra-common-post.h @@ -11,7 +11,7 @@ /* * Size of malloc() pool */ -#ifdef CONFIG_USB_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_USB #define CONFIG_SYS_MALLOC_LEN (SZ_4M + \ CONFIG_SYS_DFU_DATA_BUF_SIZE + \ CONFIG_SYS_DFU_MAX_FILE_SIZE) |