From d058bc820b20f425ad122adfecc0a515253ea85d Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Thu, 13 Nov 2014 11:40:02 +0100 Subject: [PATCH] samsung: misc_init_r: insert call to platform_setup() This change adds call of platform_setup() to check or set active platform configuration. Another change is setup environment variable: ${platname}, from board name in set_board_info(). Change-Id: I355736bf40f8fa3697ce0b4546f7702d2e54a0f9 Signed-off-by: Przemyslaw Marczak --- cmd/dfu.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/cmd/dfu.c b/cmd/dfu.c index 4a288f7..1d587b4 100644 --- a/cmd/dfu.c +++ b/cmd/dfu.c @@ -46,6 +46,34 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #endif int ret = 0; + +#ifdef CONFIG_DFU_OVER_USB + int argv_list = 0; + bool dfu_reset = false; + switch (argc) { + case 2: + argv_list = 1; + case 1: + usb_controller = strdup(env_get("dfu_usb_con")); + interface = strdup(env_get("dfu_interface")); + devstring = strdup(env_get("dfu_device")); + if (!usb_controller || !interface || !devstring) { + puts("DFU: default device environment is not set.\n"); + ret = CMD_RET_USAGE; + goto bad_args; + } + break; + case 5: + argv_list = 4; + case 4: + usb_controller = argv[1]; + interface = argv[2]; + devstring = argv[3]; + break; + default: + return CMD_RET_USAGE; + } +#endif #ifdef CONFIG_DFU_OVER_TFTP if (!strcmp(argv[1], "tftp")) return update_tftp(value, interface, devstring); @@ -59,8 +87,7 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) dfu_set_timeout(value * 1000); #endif - ret = CMD_RET_SUCCESS; - if (strcmp(argv[argc - 1], "list") == 0) { + if (argv_list && !strcmp(argv[argv_list], "list")) { dfu_show_entities(); goto done; } @@ -81,6 +108,17 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) done: dfu_free_entities(); + + if (dfu_reset) + run_command("reset", 0); + + g_dnl_clear_detach(); +bad_args: + if (argc == 1) { + free(usb_controller); + free(interface); + free(devstring); + } #endif return ret; } -- 2.7.4