It is possible to boot from a few media devices, especially
using a micro SD or eMMC slots. In this situation depends on
a boot device - some setup can be changeg.

This change adds function:
boot_device() - which returns an OM[1:5] bits value

This allows checking if boot device is SD(0x2).

Signed-off-by: Przemyslaw Marczak <p.marc...@samsung.com>

---
Changes v3:
- new commit after separate one into two
---
 board/samsung/common/board.c | 10 +++++++++-
 include/samsung/misc.h       |  7 +++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 9dc7c83..ecf3f76 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -41,6 +41,13 @@ int __exynos_power_init(void)
 int exynos_power_init(void)
        __attribute__((weak, alias("__exynos_power_init")));
 
+unsigned int boot_device(void)
+{
+       unsigned int om_stat = samsung_get_base_power();
+
+       return BOOT_DEVICE(readl(om_stat));
+}
+
 #if defined CONFIG_EXYNOS_TMU
 /* Boot Time Thermal Analysis for SoC temperature threshold breach */
 static void boot_temp_check(void)
@@ -243,19 +250,20 @@ int board_eth_init(bd_t *bis)
 int board_mmc_init(bd_t *bis)
 {
        int ret;
+
 #ifdef CONFIG_DWMMC
        /* dwmmc initializattion for available channels */
        ret = exynos_dwmmc_init(gd->fdt_blob);
        if (ret)
                debug("dwmmc init failed\n");
 #endif
-
 #ifdef CONFIG_SDHCI
        /* mmc initializattion for available channels */
        ret = exynos_mmc_init(gd->fdt_blob);
        if (ret)
                debug("mmc init failed\n");
 #endif
+
        return ret;
 }
 #endif
diff --git a/include/samsung/misc.h b/include/samsung/misc.h
index 10653a1..57bac7d 100644
--- a/include/samsung/misc.h
+++ b/include/samsung/misc.h
@@ -28,4 +28,11 @@ void check_boot_mode(void);
 void draw_logo(void);
 #endif
 
+#define BOOT_DEVICE_SDMMC      0x2
+#define BOOT_DEVICE_MASK       0x1f
+#define BOOT_DEVICE_SHIFT      0x1
+#define BOOT_DEVICE(x)         (((x) >> BOOT_DEVICE_SHIFT) & BOOT_DEVICE_MASK)
+
+unsigned int boot_device(void);
+
 #endif /* __SAMSUNG_MISC_COMMON_H__ */
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to