Merge git://git.denx.de/u-boot-usb

master
Tom Rini 6 years ago
commit 1c124d379d
  1. 2
      README
  2. 4
      board/siemens/common/factoryset.c
  3. 2
      cmd/Kconfig
  4. 18
      cmd/dfu.c
  5. 18
      cmd/fastboot/Kconfig
  6. 4
      cmd/usb_gadget_sdp.c
  7. 6
      common/Makefile
  8. 4
      common/spl/spl_sdp.c
  9. 14
      drivers/dfu/Kconfig
  10. 2
      drivers/dfu/Makefile
  11. 4
      drivers/dfu/dfu_tftp.c
  12. 1
      drivers/usb/Kconfig
  13. 2
      drivers/usb/gadget/Makefile
  14. 27
      drivers/usb/gadget/f_sdp.c
  15. 2
      include/configs/tegra-common-post.h

@ -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

@ -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,

@ -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"

@ -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

@ -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();

@ -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

@ -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;
}

@ -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.

@ -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

@ -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();

@ -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.

@ -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

@ -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) {

@ -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)

Loading…
Cancel
Save