From 899a52821515d79f9e4e525fd3098bdb574062ed Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Tue, 17 Feb 2015 12:24:11 +0100 Subject: [PATCH] dfu: samsung: move call to set_dfu_alt_info() to dfu common code This common call can be used for setting proper entities based on dfu command arguments. The config: CONFIG_SET_DFU_ALT_INFO, was used only for few configs, and now it is common. The board file should implement: - set_dfu_alt_info() function Signed-off-by: Przemyslaw Marczak Tested-by: Lukasz Majewski [Test HW: Odroid U3 (Exynos 4412)] --- board/samsung/common/board.c | 3 --- board/samsung/common/misc.c | 6 +++--- drivers/dfu/dfu.c | 3 +++ include/dfu.h | 3 +++ include/samsung/misc.h | 5 ++--- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index da2245ff9d..6c7f59be87 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -338,9 +338,6 @@ int arch_early_init_r(void) #ifdef CONFIG_MISC_INIT_R int misc_init_r(void) { -#ifdef CONFIG_SET_DFU_ALT_INFO - set_dfu_alt_info(); -#endif #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG set_board_info(); #endif diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 4538ac7f2a..1a77c820ae 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -22,7 +22,7 @@ DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_SET_DFU_ALT_INFO -void set_dfu_alt_info(void) +void set_dfu_alt_info(char *interface, char *devstr) { size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN; ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size); @@ -34,13 +34,13 @@ void set_dfu_alt_info(void) puts("DFU alt info setting: "); - alt_setting = get_dfu_alt_boot(); + alt_setting = get_dfu_alt_boot(interface, devstr); if (alt_setting) { setenv("dfu_alt_boot", alt_setting); offset = snprintf(buf, buf_size, "%s", alt_setting); } - alt_setting = get_dfu_alt_system(); + alt_setting = get_dfu_alt_system(interface, devstr); if (alt_setting) { if (offset) alt_sep = ";"; diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index ad0a7e7c25..0560afa9ff 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -55,6 +55,9 @@ int dfu_init_env_entities(char *interface, char *devstr) char *env_bkp; int ret; +#ifdef CONFIG_SET_DFU_ALT_INFO + set_dfu_alt_info(interface, devstr); +#endif str_env = getenv("dfu_alt_info"); if (!str_env) { error("\"dfu_alt_info\" env variable not defined!\n"); diff --git a/include/dfu.h b/include/dfu.h index c27856cb72..7d31abdf33 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -140,6 +140,9 @@ struct dfu_entity { unsigned int inited:1; }; +#ifdef CONFIG_SET_DFU_ALT_INFO +void set_dfu_alt_info(char *interface, char *devstr); +#endif int dfu_config_entities(char *s, char *interface, char *devstr); void dfu_free_entities(void); void dfu_show_entities(void); diff --git a/include/samsung/misc.h b/include/samsung/misc.h index 607e8d4922..0f957dc367 100644 --- a/include/samsung/misc.h +++ b/include/samsung/misc.h @@ -29,9 +29,8 @@ void draw_logo(void); #endif #ifdef CONFIG_SET_DFU_ALT_INFO -char *get_dfu_alt_system(void); -char *get_dfu_alt_boot(void); -void set_dfu_alt_info(void); +char *get_dfu_alt_system(char *interface, char *devstr); +char *get_dfu_alt_boot(char *interface, char *devstr); #endif #ifdef CONFIG_BOARD_TYPES void set_board_type(void);