summaryrefslogtreecommitdiff
path: root/cmd/dfu.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2019-10-14 09:28:02 +0200
committerMarek Vasut <marek.vasut+renesas@gmail.com>2019-10-31 12:12:31 +0100
commitfebabe3ed4f422a39e461ba4c2aff5f0fde6e4d2 (patch)
tree507c0dddcef2fbe9e5d3f2b88ce8c8be61714af2 /cmd/dfu.c
parent9ada683055a11860b83d5c2cc13713ca2b173c33 (diff)
dfu: allow to manage DFU on several devices
Add support of DFU for several interface/device with one command. The format for "dfu_alt_info" in this case is : - <interface> <dev>'='alternate list (';' separated) - each interface is separated by '&' The previous behavior is always supported. One example for NOR (bootloaders) + NAND (rootfs in UBI): U-Boot> env set dfu_alt_info \ "sf 0:0:10000000:0=spl part 0 1;u-boot part 0 2; \ u-boot-env part 0 3&nand 0=UBI partubi 0,3" U-Boot> dfu 0 list DFU alt settings list: dev: SF alt: 0 name: spl layout: RAW_ADDR dev: SF alt: 1 name: ssbl layout: RAW_ADDR dev: SF alt: 2 name: u-boot-env layout: RAW_ADDR dev: NAND alt: 3 name: UBI layout: RAW_ADDR U-Boot> dfu 0 $> dfu-util -l Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\ intf=0, alt=3, name="UBI", serial="002700333338511934383330" Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\ intf=0, alt=2, name="u-boot-env", serial="002700333338511934383330" Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\ intf=0, alt=1, name="u-boot", serial="002700333338511934383330" Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\ intf=0, alt=0, name="spl", serial="002700333338511934383330" Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Diffstat (limited to 'cmd/dfu.c')
-rw-r--r--cmd/dfu.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/cmd/dfu.c b/cmd/dfu.c
index 91a750a4fca..33491d0bc9c 100644
--- a/cmd/dfu.c
+++ b/cmd/dfu.c
@@ -21,23 +21,28 @@
static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
- if (argc < 4)
+ if (argc < 2)
return CMD_RET_USAGE;
#ifdef CONFIG_DFU_OVER_USB
char *usb_controller = argv[1];
#endif
#if defined(CONFIG_DFU_OVER_USB) || defined(CONFIG_DFU_OVER_TFTP)
- char *interface = argv[2];
- char *devstring = argv[3];
+ char *interface = NULL;
+ char *devstring = NULL;
+
+ if (argc >= 4) {
+ interface = argv[2];
+ devstring = argv[3];
+ }
#endif
int ret = 0;
#ifdef CONFIG_DFU_OVER_TFTP
unsigned long addr = 0;
if (!strcmp(argv[1], "tftp")) {
- if (argc == 5)
- addr = simple_strtoul(argv[4], NULL, 0);
+ if (argc == 5 || argc == 3)
+ addr = simple_strtoul(argv[argc - 1], NULL, 0);
return update_tftp(addr, interface, devstring);
}
@@ -48,7 +53,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
goto done;
ret = CMD_RET_SUCCESS;
- if (argc > 4 && strcmp(argv[4], "list") == 0) {
+ if (strcmp(argv[argc - 1], "list") == 0) {
dfu_show_entities();
goto done;
}
@@ -67,7 +72,7 @@ U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
"Device Firmware Upgrade",
""
#ifdef CONFIG_DFU_OVER_USB
- "<USB_controller> <interface> <dev> [list]\n"
+ "<USB_controller> [<interface> <dev>] [list]\n"
" - device firmware upgrade via <USB_controller>\n"
" on device <dev>, attached to interface\n"
" <interface>\n"
@@ -77,7 +82,7 @@ U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
#ifdef CONFIG_DFU_OVER_USB
"dfu "
#endif
- "tftp <interface> <dev> [<addr>]\n"
+ "tftp [<interface> <dev>] [<addr>]\n"
" - device firmware upgrade via TFTP\n"
" on device <dev>, attached to interface\n"
" <interface>\n"