From 24ccd0c8fd6285636edb94d0ece2cbcf062d64eb Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 15 Feb 2018 07:08:55 +0100 Subject: [PATCH 1/7] usb: gadget: sdp: add missing line breaks Cosmetic change. Signed-off-by: Andre Heider Reviewed-by: Lukasz Majewski Acked-by: Stefan Agner --- cmd/usb_gadget_sdp.c | 4 ++-- common/spl/spl_sdp.c | 4 ++-- drivers/usb/gadget/f_sdp.c | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c index ae4d73c..97d00ec 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/spl/spl_sdp.c b/common/spl/spl_sdp.c index 333d518..0c4603a 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/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index dd7b9cd..6da0530 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -238,12 +238,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 +323,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; } @@ -361,7 +361,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 +371,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 +394,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; } From a64a614db70f1c758aea0a1620c4fcd49e037d47 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 15 Feb 2018 10:17:29 +0100 Subject: [PATCH 2/7] usb: gadget: sdp: fix pointer cast warnings for 64bit archs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SDP protocol contains multiple 32bit pointers. Add a helper function to get a valid pointer from these values and use it. This fixes the following warnings: drivers/usb/gadget/f_sdp.c: In function ‘sdp_rx_data_complete’: drivers/usb/gadget/f_sdp.c:347:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] memcpy((void *)sdp->dnl_address, req->buf + 1, datalen); ^ drivers/usb/gadget/f_sdp.c: In function ‘sdp_jump_imxheader’: drivers/usb/gadget/f_sdp.c:625:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] entry = (void *)headerv2->entry; ^ drivers/usb/gadget/f_sdp.c: In function ‘sdp_handle_in_ep’: drivers/usb/gadget/f_sdp.c:668:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] memcpy(&data[1], (void *)sdp_func->dnl_address, datalen); ^ drivers/usb/gadget/f_sdp.c:679:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] status = sdp_jump_imxheader((void *)sdp_func->jmp_address); ^ Signed-off-by: Andre Heider --- drivers/usb/gadget/f_sdp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index 6da0530..43c5cfb 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; @@ -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; } @@ -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) { From 462c117ce045571fef86f88fad3be8b3117897b1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 21 Feb 2018 03:57:09 +0000 Subject: [PATCH 3/7] usb: kbd: select SYS_STDIO_DEREGISTER If SYS_STDIO_DEREGISTER is not selected and USB_KEYBOARD is selected U-Boot cannot be built due to missing function stdio_deregister_dev. So USB_KEYBOARD should select SYS_STDIO_DEREGISTER. Signed-off-by: Heinrich Schuchardt --- drivers/usb/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 7de4105..4fbe172 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. From 0f44d33536a50ef65259c322fa2d4a058585caf9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 16 Feb 2018 16:41:17 +0100 Subject: [PATCH 4/7] dfu: Fix up the Kconfig mess Clean up the screaming mess of configuration options that DFU is. It was impossible to configure DFU such that TFTP is enabled and USB is not, this patch fixes that and assures that DFU TFTP and DFU USB can be enabled separatelly and that the correct pieces of code are compiled in. Signed-off-by: Marek Vasut Cc: Lukasz Majewski --- cmd/Kconfig | 2 +- cmd/dfu.c | 18 +++++++++++++----- common/Makefile | 6 ++++-- drivers/dfu/Kconfig | 12 +++++++++++- drivers/dfu/Makefile | 2 +- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 885712f..d997f0c 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" diff --git a/cmd/dfu.c b/cmd/dfu.c index 04291f6..76b89ca 100644 --- a/cmd/dfu.c +++ b/cmd/dfu.c @@ -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_USB_FUNCTION_DFU 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_TFTP_FUNCTION_DFU 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_USB_FUNCTION_DFU 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_USB_FUNCTION_DFU " [list]\n" " - device firmware upgrade via \n" " on device , attached to interface\n" " \n" " [list] - list available alt settings\n" -#ifdef CONFIG_DFU_TFTP - "dfu tftp []\n" +#endif +#ifdef CONFIG_TFTP_FUNCTION_DFU +#ifdef CONFIG_USB_FUNCTION_DFU + "dfu " +#endif + "tftp []\n" " - device firmware upgrade via TFTP\n" " on device , attached to interface\n" " \n" diff --git a/common/Makefile b/common/Makefile index c7bde23..cdd0ab1 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_USB_FUNCTION_DFU) += 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_USB_FUNCTION_DFU) += dfu.o obj-y += command.o obj-$(CONFIG_$(SPL_)LOG) += log.o obj-$(CONFIG_$(SPL_)LOG_CONSOLE) += log_console.o diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index fa27efb..b077444 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -1,12 +1,22 @@ menu "DFU support" +config DFU + bool + imply USB_FUNCTION_DFU if USB_GADGET + config USB_FUNCTION_DFU bool select HASH + depends on USB_GADGET + +config TFTP_FUNCTION_DFU + bool + depends on NET -if CMD_DFU +if DFU config DFU_TFTP bool "DFU via TFTP" + select TFTP_FUNCTION_DFU 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 61f2b71..7f35871 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 From bb4059a53bc13615f12b5e21252872bf7e02dce4 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 16 Feb 2018 16:41:18 +0100 Subject: [PATCH 5/7] dfu: Rename _FUNCTION_DFU to DFU_OVER_ Do the following to make the symbol names less confusing. sed -i "s/\([TU][^_]\+\)_FUNCTION_DFU/DFU_OVER_\1/g" \ `git grep _FUNCTION_DFU | cut -d ":" -f 1 | sort -u` Signed-off-by: Marek Vasut Cc: Lukasz Majewski --- README | 2 +- board/siemens/common/factoryset.c | 4 ++-- cmd/dfu.c | 12 ++++++------ common/Makefile | 4 ++-- drivers/dfu/Kconfig | 8 ++++---- drivers/usb/gadget/Makefile | 2 +- include/configs/tegra-common-post.h | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README b/README index fabd532..48db0cb 100644 --- a/README +++ b/README @@ -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 81bbb57..7fa2673 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/dfu.c b/cmd/dfu.c index 76b89ca..68b1a7f 100644 --- a/cmd/dfu.c +++ b/cmd/dfu.c @@ -25,14 +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_USB_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_USB char *usb_controller = argv[1]; #endif char *interface = argv[2]; char *devstring = argv[3]; int ret = 0; -#ifdef CONFIG_TFTP_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_TFTP unsigned long addr = 0; if (!strcmp(argv[1], "tftp")) { if (argc == 5) @@ -41,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_USB_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_USB ret = dfu_init_env_entities(interface, devstring); if (ret) goto done; @@ -64,15 +64,15 @@ done: U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu, "Device Firmware Upgrade", -#ifdef CONFIG_USB_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_USB " [list]\n" " - device firmware upgrade via \n" " on device , attached to interface\n" " \n" " [list] - list available alt settings\n" #endif -#ifdef CONFIG_TFTP_FUNCTION_DFU -#ifdef CONFIG_USB_FUNCTION_DFU +#ifdef CONFIG_DFU_OVER_TFTP +#ifdef CONFIG_DFU_OVER_USB "dfu " #endif "tftp []\n" diff --git a/common/Makefile b/common/Makefile index cdd0ab1..7011dad 100644 --- a/common/Makefile +++ b/common/Makefile @@ -67,7 +67,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTSTAGE) += bootstage.o ifdef CONFIG_SPL_BUILD ifdef CONFIG_SPL_DFU_SUPPORT -obj-$(CONFIG_USB_FUNCTION_DFU) += dfu.o +obj-$(CONFIG_DFU_OVER_USB) += dfu.o endif obj-$(CONFIG_SPL_DFU_SUPPORT) += cli_hush.o obj-$(CONFIG_SPL_HASH_SUPPORT) += hash.o @@ -130,7 +130,7 @@ endif obj-y += cli.o obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o -obj-$(CONFIG_USB_FUNCTION_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/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index b077444..51ab484 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -2,21 +2,21 @@ menu "DFU support" config DFU bool - imply USB_FUNCTION_DFU if USB_GADGET + imply DFU_OVER_USB if USB_GADGET -config USB_FUNCTION_DFU +config DFU_OVER_USB bool select HASH depends on USB_GADGET -config TFTP_FUNCTION_DFU +config DFU_OVER_TFTP bool depends on NET if DFU config DFU_TFTP bool "DFU via TFTP" - select TFTP_FUNCTION_DFU + select DFU_OVER_TFTP help This option allows performing update of DFU-managed medium with data sent via TFTP boot. diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index ee8bc99..748366f 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/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h index aea8f1f..3eb9dd2 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) From 36dd7e7e2563772293d3ecce2b108b9c7300f588 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Fri, 16 Feb 2018 16:41:19 +0100 Subject: [PATCH 6/7] dfu: tftp: Fix arm64 build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix two build warnings when building for arm64: drivers/dfu/dfu_tftp.c: In function ‘dfu_tftp_write’: drivers/dfu/dfu_tftp.c:59:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] ret = dfu_write_from_mem_addr(dfu, (void *)addr, len); ^ and drivers/dfu/dfu_tftp.c: In function ‘dfu_tftp_write’: drivers/dfu/dfu_tftp.c:41:8: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘__kernel_size_t {aka long unsigned int}’ [-Wformat=] debug("%s: image name: %s strlen: %u\n", __func__, sb, strlen(sb)); ^ Signed-off-by: Marek Vasut Cc: Lukasz Majewski --- drivers/dfu/dfu_tftp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dfu/dfu_tftp.c b/drivers/dfu/dfu_tftp.c index 62bf797..f0afbac 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(); From b0cce3f90f546da0c1e0dda5abcaf05d81078b0d Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 7 Dec 2017 18:26:17 +0100 Subject: [PATCH 7/7] cmd: fastboot: Kconfig: solve config issue When FASTBOOT is activated, only one the supported device is supported in code at the same time - CONFIG_FASTBOOT_FLASH_MMC_DEV - CONFIG_FASTBOOT_FLASH_NAND_DEV But Today the choice is not exclusive in Kconfig and that cause Kconfig issue when : - CONFIG_FASTBOOT, CONFIG_MMC, CONFIG_NAND are activated - CONFIG_FASTBOOT_FLASH_MMC_DEV = 0 - CONFIG_FASTBOOT_FLASH_NAND_DEV is not activated The patch add a choice in Kconfig to select the FLASH provider - CONFIG_FASTBOOT_FLASH_MMC - CONFIG_FASTBOOT_FLASH_NAND Signed-off-by: Patrick Delaunay Acked-by: Maxime Ripard --- cmd/fastboot/Kconfig | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/fastboot/Kconfig b/cmd/fastboot/Kconfig index cbb9183..0d2c2f1 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