* [U-Boot] [PATCH 2/3] dfu: Rename _FUNCTION_DFU to DFU_OVER_
2018-02-16 15:41 [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess Marek Vasut
@ 2018-02-16 15:41 ` Marek Vasut
2018-02-16 15:41 ` [U-Boot] [PATCH 3/3] dfu: tftp: Fix arm64 build warnings Marek Vasut
2018-02-19 19:55 ` [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess Lukasz Majewski
2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-02-16 15:41 UTC (permalink / raw)
To: u-boot
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 <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
---
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 81b7ee1ce8..cb8d5ef24f 100644
--- a/README
+++ b/README
@@ -1203,7 +1203,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/dfu.c b/cmd/dfu.c
index 76b89ca5ed..68b1a7fec9 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
"<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"
#endif
-#ifdef CONFIG_TFTP_FUNCTION_DFU
-#ifdef CONFIG_USB_FUNCTION_DFU
+#ifdef CONFIG_DFU_OVER_TFTP
+#ifdef CONFIG_DFU_OVER_USB
"dfu "
#endif
"tftp <interface> <dev> [<addr>]\n"
diff --git a/common/Makefile b/common/Makefile
index cdd0ab19d8..7011dada99 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 b077444059..51ab484c2a 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 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/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)
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH 3/3] dfu: tftp: Fix arm64 build warnings
2018-02-16 15:41 [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess Marek Vasut
2018-02-16 15:41 ` [U-Boot] [PATCH 2/3] dfu: Rename _FUNCTION_DFU to DFU_OVER_ Marek Vasut
@ 2018-02-16 15:41 ` Marek Vasut
2018-02-19 19:55 ` [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess Lukasz Majewski
2 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-02-16 15:41 UTC (permalink / raw)
To: u-boot
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 <marek.vasut+renesas@gmail.com>
Cc: Lukasz Majewski <lukma@denx.de>
---
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 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();
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess
2018-02-16 15:41 [U-Boot] [PATCH V2 1/3] dfu: Fix up the Kconfig mess Marek Vasut
2018-02-16 15:41 ` [U-Boot] [PATCH 2/3] dfu: Rename _FUNCTION_DFU to DFU_OVER_ Marek Vasut
2018-02-16 15:41 ` [U-Boot] [PATCH 3/3] dfu: tftp: Fix arm64 build warnings Marek Vasut
@ 2018-02-19 19:55 ` Lukasz Majewski
2 siblings, 0 replies; 4+ messages in thread
From: Lukasz Majewski @ 2018-02-19 19:55 UTC (permalink / raw)
To: u-boot
Hi Marek,
> 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 <marek.vasut+renesas@gmail.com>
> Cc: Lukasz Majewski <lukma@denx.de>
Acked-by: Lukasz Majewski <lukma@denx.de>
Tested-by: Lukasz Majewski <lukma@denx.de>
Test HW: Beagle Bone Black
> ---
> V2: Do not imply TFTP if net, we do not want this turned on by
> default. ---
> 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 7368b6df52..1caddc4072 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -582,7 +582,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 04291f6c08..76b89ca5ed 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
> "<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_TFTP_FUNCTION_DFU
> +#ifdef CONFIG_USB_FUNCTION_DFU
> + "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/common/Makefile b/common/Makefile
> index c7bde239c1..cdd0ab19d8 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 fa27efbb40..b077444059 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 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
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180219/2fdcb292/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread