artik710: set the booting device in environment value
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 4 Dec 2017 10:44:33 +0000 (19:44 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 26 Mar 2018 02:31:21 +0000 (11:31 +0900)
set_booting_device should be set dynamically after checking OM pin.
eMMC boot - bootdev = mmcblk0 (rootdev = 0)
SD boot   - bootdev = mmcblk1 (rootdev = 1)

The 'bootdev' env variable should be passed to kernel side after
including it in cmdline.

Change-Id: I7c2bf0caf45e1dfe53a8e1ee0e611f13099baf09
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
board/nexell/s5p6818/artik710_raptor/board.c
include/configs/artik710_raptor.h

index fbfe46b557afaebe83147cf79b2985fbbf157fc2..93ab3dd8d61a94659dfa9417f58102a6b6ffc06a 100644 (file)
@@ -172,6 +172,26 @@ void board_display_reset(void)
 }
 #endif
 
+/* Set the environment value about booting from which device */
+static void set_booting_device(void)
+{
+       int port_num;
+       int boot_mode = readl(PHY_BASEADDR_CLKPWR + SYSRSTCONFIG);
+
+       if ((boot_mode & BOOTMODE_MASK) == BOOTMODE_SDMMC) {
+               port_num = readl(SCR_ARM_SECOND_BOOT_REG1);
+               /*
+                * Kernel will be detected as the below block devices.
+                * mmcblk0 - eMMC card
+                * mmcblk1 - SD card
+                */
+               if (port_num == EMMC_PORT_NUM)
+                       setenv("rootdev", "0");
+               else if (port_num == SD_PORT_NUM)
+                       setenv("rootdev", "1");
+       }
+}
+
 int mmc_get_env_dev(void)
 {
        int port_num;
@@ -354,6 +374,8 @@ int board_late_init(void)
 #endif
        check_reboot_mode();
 
+       set_booting_device();
+
        return 0;
 }
 
index 7b67e6e03b387d36a103a5ed7e90c7d8092d0f8f..097317b0afe0e69e6d97c2c04d2fbc26a658d642 100644 (file)
                        "setenv bootargs ${console} "                   \
                        "root=/dev/ram0 ${root_rw} "                    \
                        "${opts} ${recoverymode} "                      \
-                       "drm_panel=$lcd_panel bootmode=${bootmode};"    \
+                       "drm_panel=$lcd_panel bootdev=mmcblk${rootdev} "        \
+                       "bootmode=${bootmode};"                         \
                "fi;"                                                   \
                "ext4load mmc ${rootdev}:${bootpart} $ramdiskaddr $ramdisk_file\0" \
        "boot_cmd_initrd="                                              \