[U-Boot] [PATCH v2 05/11] samsung: misc: set the dfu bootloader setting at boot time
Przemyslaw Marczak
p.marczak at samsung.com
Thu Jun 12 11:46:28 CEST 2014
This change adds new function:
- set_dfu_boot_alt(bootmode) - where bootmode is the value of Exynos ompin[5:1]
with proper bitmask using 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>
---
Changes v2:
- change config names:
CONFIG_SET_DFU_BOOT_ALT to CONFIG_DFU_ALT_BOOTLOADER and
CONFIG_DFU_BOOT_ALT_* to CONFIG_DFU_ALT_BOOT_*
- change function name: set_dfu_boot_alt() to set_dfu_alt_boot()
- remove superfluous ifdefs
---
board/samsung/common/board.c | 3 +++
board/samsung/common/misc.c | 19 +++++++++++++++++++
include/samsung/misc.h | 4 ++++
3 files changed, 26 insertions(+)
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 2970340..87d42e5 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_DFU_ALT_BOOTLOADER
+ set_dfu_alt_boot(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..9a5d2ac 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -21,6 +21,25 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_DFU_ALT_BOOTLOADER
+void set_dfu_alt_boot(int bootmode)
+{
+ char *alt_bootloader = NULL;
+
+ switch (bootmode) {
+ case BOOT_SDMMC:
+ alt_bootloader = CONFIG_DFU_ALT_BOOT_SD;
+ break;
+ default:
+ alt_bootloader = CONFIG_DFU_ALT_BOOT_EMMC;
+ 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..3d1d076 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_DFU_ALT_BOOTLOADER
+void set_dfu_alt_boot(int bootmode);
+#endif
+
#endif /* __SAMSUNG_MISC_COMMON_H__ */
--
1.9.1
More information about the U-Boot
mailing list