All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] dfu: allow to autoset configuration
@ 2015-02-17 11:24 Przemyslaw Marczak
  2015-02-17 11:24 ` [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code Przemyslaw Marczak
  2015-02-17 11:24 ` [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations Przemyslaw Marczak
  0 siblings, 2 replies; 6+ messages in thread
From: Przemyslaw Marczak @ 2015-02-17 11:24 UTC (permalink / raw)
  To: u-boot

Since the dfu supports multiple inferfaces, using a single ${dfu_alt_info}
variable, or manually presetting it for various interfaces is uncomfortable.

The interface is given as an argument to the dfu/thor commands,
so it can be easy used to set the environment.

The odroid, as an example, can boot from SD and eMMC cards,
but the boot binary offsets are little different.
Now the proper data in ${dfu_alt_info} is set automatically.

Inha Song (1):
  odroid: adjust get_dfu_alt_*() functions to new declarations

Przemyslaw Marczak (1):
  dfu: samsung: move call to set_dfu_alt_info() to dfu common code

 board/samsung/common/board.c  |  3 ---
 board/samsung/common/misc.c   |  6 +++---
 board/samsung/odroid/odroid.c | 31 +++++++++++++++++--------------
 drivers/dfu/dfu.c             |  3 +++
 include/dfu.h                 |  3 +++
 include/samsung/misc.h        |  5 ++---
 6 files changed, 28 insertions(+), 23 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code
  2015-02-17 11:24 [U-Boot] [PATCH 0/2] dfu: allow to autoset configuration Przemyslaw Marczak
@ 2015-02-17 11:24 ` Przemyslaw Marczak
  2015-02-19  9:22   ` Lukasz Majewski
  2015-02-17 11:24 ` [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations Przemyslaw Marczak
  1 sibling, 1 reply; 6+ messages in thread
From: Przemyslaw Marczak @ 2015-02-17 11:24 UTC (permalink / raw)
  To: u-boot

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 <p.marczak@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Marek Vasut <marex@denx.de>
---
 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 8b4c8e9..d28fed9 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 4538ac7..1a77c82 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 ad0a7e7..0560afa 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 c27856c..7d31abd 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 607e8d4..0f957dc 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);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations
  2015-02-17 11:24 [U-Boot] [PATCH 0/2] dfu: allow to autoset configuration Przemyslaw Marczak
  2015-02-17 11:24 ` [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code Przemyslaw Marczak
@ 2015-02-17 11:24 ` Przemyslaw Marczak
  2015-02-19  9:26   ` Lukasz Majewski
  1 sibling, 1 reply; 6+ messages in thread
From: Przemyslaw Marczak @ 2015-02-17 11:24 UTC (permalink / raw)
  To: u-boot

From: Inha Song <ideal.song@samsung.com>

This change is required after updated dfu_alt_system/boot declarations.

Signed-off-by: Inha Song <ideal.song@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Marek Vasut <marex@denx.de>
---
 board/samsung/odroid/odroid.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index b7d2381..e3f90bd 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -15,6 +15,7 @@
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
 #include <errno.h>
+#include <mmc.h>
 #include <usb.h>
 #include <usb/s3c_udc.h>
 #include <samsung/misc.h>
@@ -61,27 +62,29 @@ const char *get_board_type(void)
 #endif
 
 #ifdef CONFIG_SET_DFU_ALT_INFO
-char *get_dfu_alt_system(void)
+char *get_dfu_alt_system(char *interface, char *devstr)
 {
 	return getenv("dfu_alt_system");
 }
 
-char *get_dfu_alt_boot(void)
+char *get_dfu_alt_boot(char *interface, char *devstr)
 {
+	struct mmc *mmc;
 	char *alt_boot;
+	int dev_num;
+
+	dev_num = simple_strtoul(devstr, NULL, 10);
+
+	mmc = find_mmc_device(dev_num);
+	if (!mmc)
+		return NULL;
+
+	if (mmc_init(mmc))
+		return NULL;
+
+	alt_boot = IS_SD(mmc) ? CONFIG_DFU_ALT_BOOT_SD :
+				CONFIG_DFU_ALT_BOOT_EMMC;
 
-	switch (get_boot_mode()) {
-	case BOOT_MODE_SD:
-		alt_boot = CONFIG_DFU_ALT_BOOT_SD;
-		break;
-	case BOOT_MODE_EMMC:
-	case BOOT_MODE_EMMC_SD:
-		alt_boot = CONFIG_DFU_ALT_BOOT_EMMC;
-		break;
-	default:
-		alt_boot = NULL;
-		break;
-	}
 	return alt_boot;
 }
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code
  2015-02-17 11:24 ` [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code Przemyslaw Marczak
@ 2015-02-19  9:22   ` Lukasz Majewski
  0 siblings, 0 replies; 6+ messages in thread
From: Lukasz Majewski @ 2015-02-19  9:22 UTC (permalink / raw)
  To: u-boot

Hi Przemyslaw,

> 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 <p.marczak@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  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 8b4c8e9..d28fed9 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 4538ac7..1a77c82 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 ad0a7e7..0560afa 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 c27856c..7d31abd 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 607e8d4..0f957dc 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);

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Test HW: Odroid U3 (Exynos 4412)

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations
  2015-02-17 11:24 ` [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations Przemyslaw Marczak
@ 2015-02-19  9:26   ` Lukasz Majewski
  2015-02-23  0:16     ` Minkyu Kang
  0 siblings, 1 reply; 6+ messages in thread
From: Lukasz Majewski @ 2015-02-19  9:26 UTC (permalink / raw)
  To: u-boot

Hi Przemyslaw, Minkyu

> From: Inha Song <ideal.song@samsung.com>
> 
> This change is required after updated dfu_alt_system/boot
> declarations.
> 
> Signed-off-by: Inha Song <ideal.song@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  board/samsung/odroid/odroid.c | 31 +++++++++++++++++--------------
>  1 file changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/board/samsung/odroid/odroid.c
> b/board/samsung/odroid/odroid.c index b7d2381..e3f90bd 100644
> --- a/board/samsung/odroid/odroid.c
> +++ b/board/samsung/odroid/odroid.c
> @@ -15,6 +15,7 @@
>  #include <power/pmic.h>
>  #include <power/max77686_pmic.h>
>  #include <errno.h>
> +#include <mmc.h>
>  #include <usb.h>
>  #include <usb/s3c_udc.h>
>  #include <samsung/misc.h>
> @@ -61,27 +62,29 @@ const char *get_board_type(void)
>  #endif
>  
>  #ifdef CONFIG_SET_DFU_ALT_INFO
> -char *get_dfu_alt_system(void)
> +char *get_dfu_alt_system(char *interface, char *devstr)
>  {
>  	return getenv("dfu_alt_system");
>  }
>  
> -char *get_dfu_alt_boot(void)
> +char *get_dfu_alt_boot(char *interface, char *devstr)
>  {
> +	struct mmc *mmc;
>  	char *alt_boot;
> +	int dev_num;
> +
> +	dev_num = simple_strtoul(devstr, NULL, 10);
> +
> +	mmc = find_mmc_device(dev_num);
> +	if (!mmc)
> +		return NULL;
> +
> +	if (mmc_init(mmc))
> +		return NULL;
> +
> +	alt_boot = IS_SD(mmc) ? CONFIG_DFU_ALT_BOOT_SD :
> +				CONFIG_DFU_ALT_BOOT_EMMC;
>  
> -	switch (get_boot_mode()) {
> -	case BOOT_MODE_SD:
> -		alt_boot = CONFIG_DFU_ALT_BOOT_SD;
> -		break;
> -	case BOOT_MODE_EMMC:
> -	case BOOT_MODE_EMMC_SD:
> -		alt_boot = CONFIG_DFU_ALT_BOOT_EMMC;
> -		break;
> -	default:
> -		alt_boot = NULL;
> -		break;
> -	}
>  	return alt_boot;
>  }
>  #endif


Acked-by: Lukasz Majewski <l.majewski@samsung.com>

Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Test HW: Odroid U3 (Exynos 4412)

Minkyu - I would prefer to take this patch to -dfu tree since it deals
with dfu_alt_info env variable. Do you mind if I take it?

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations
  2015-02-19  9:26   ` Lukasz Majewski
@ 2015-02-23  0:16     ` Minkyu Kang
  0 siblings, 0 replies; 6+ messages in thread
From: Minkyu Kang @ 2015-02-23  0:16 UTC (permalink / raw)
  To: u-boot

Hi,

On 19/02/15 18:26, Lukasz Majewski wrote:
> Hi Przemyslaw, Minkyu
> 
>> From: Inha Song <ideal.song@samsung.com>
>>
>> This change is required after updated dfu_alt_system/boot
>> declarations.
>>
>> Signed-off-by: Inha Song <ideal.song@samsung.com>
>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>> Cc: Stephen Warren <swarren@nvidia.com>
>> Cc: Marek Vasut <marex@denx.de>
>> ---
> 
> 
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> 
> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
> Test HW: Odroid U3 (Exynos 4412)
> 
> Minkyu - I would prefer to take this patch to -dfu tree since it deals
> with dfu_alt_info env variable. Do you mind if I take it?
> 

It's OK.

Acked-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-23  0:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 11:24 [U-Boot] [PATCH 0/2] dfu: allow to autoset configuration Przemyslaw Marczak
2015-02-17 11:24 ` [U-Boot] [PATCH 1/2] dfu: samsung: move call to set_dfu_alt_info() to dfu common code Przemyslaw Marczak
2015-02-19  9:22   ` Lukasz Majewski
2015-02-17 11:24 ` [U-Boot] [PATCH 2/2] odroid: adjust get_dfu_alt_*() functions to new declarations Przemyslaw Marczak
2015-02-19  9:26   ` Lukasz Majewski
2015-02-23  0:16     ` Minkyu Kang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.