[U-Boot] [PATCH 04/10] samsung: misc: set the dfu bootloader setting at boot time.

Przemyslaw Marczak p.marczak at samsung.com
Tue Jun 10 13:32:58 CEST 2014


This change adds new function:
- set_dfu_boot_alt(bootmode) - where bootmode is the value of Exynos ompin[5:1]
                               masked with BOOT_MODE(x) macro.

This change is useful for devices with more than one boot device,
e.g. with a separated SD and eMMC slots. Different dfu entities are
required for SD and eMMC cards. The board config should define:
- CONFIG_MISC_COMMON
- CONFIG_SET_DFU_BOOT_ALT
and at least one of below alt setting:
- CONFIG_DFU_BOOT_ALT_SD, e.g: "u-boot raw 1 2048"
- CONFIG_DFU_BOOT_ALT_eMMC, e.g: "u-boot raw 0 2048 mmcpart 1"

Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Piotr Wilczek <p.wilczek at samsung.com>
Cc: Minkyu Kang <mk7.kang at samsung.com>
---
 board/samsung/common/board.c |  3 +++
 board/samsung/common/misc.c  | 23 +++++++++++++++++++++++
 include/samsung/misc.h       |  4 ++++
 3 files changed, 30 insertions(+)

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 2970340..9a745d9 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -323,6 +323,9 @@ int arch_early_init_r(void)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
+#ifdef CONFIG_SET_DFU_BOOT_ALT
+	set_dfu_boot_alt(bootmode);
+#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 a453a82..d31583b 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -21,6 +21,29 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_SET_DFU_BOOT_ALT
+void set_dfu_boot_alt(int bootmode)
+{
+	char *alt_bootloader = NULL;
+
+	switch (bootmode) {
+	case BOOT_SDMMC:
+#ifdef CONFIG_DFU_BOOT_ALT_SD
+		alt_bootloader = CONFIG_DFU_BOOT_ALT_SD;
+#endif
+		break;
+	default:
+#ifdef CONFIG_DFU_BOOT_ALT_EMMC
+		alt_bootloader = CONFIG_DFU_BOOT_ALT_EMMC;
+#endif
+		break;
+	}
+
+	if (alt_bootloader)
+		setenv("dfu_alt_bootloader", alt_bootloader);
+}
+#endif
+
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 void set_board_info(void)
 {
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index 87b53ec..dfc0946 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -33,4 +33,8 @@ void draw_logo(void);
 #define BOOT_MODE_SHIFT	(0x1)
 #define BOOT_MODE(x)	((x >> BOOT_MODE_SHIFT) & BOOT_MODE_MASK)
 
+#ifdef CONFIG_SET_DFU_BOOT_ALT
+void set_dfu_boot_alt(int bootmode);
+#endif
+
 #endif /* __SAMSUNG_MISC_COMMON_H__ */
-- 
1.9.1



More information about the U-Boot mailing list