artik530: set the booting device in environemnt value
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 27 Sep 2017 06:06:10 +0000 (15:06 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 26 Mar 2018 02:31:18 +0000 (11:31 +0900)
set_booting_device shoud 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: Ib24351a87050d11bac39b26269f152e05acd4426
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
board/nexell/s5p4418/artik530_raptor/board.c
include/configs/artik530_raptor.h

index 9b3f685ba4891c53d3ea1fee77257e422b0d5892..70e608dce9b553d14aa0c34774dbe9b2b6756087 100644 (file)
@@ -208,6 +208,26 @@ int board_early_init_f(void)
        return 0;
 }
 
+/* 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(PHY_BASEADDR_SRAM + DEVICEBOOTINFO);
+               /*
+                * 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;
@@ -374,6 +394,8 @@ int board_late_init(void)
 #ifdef CONFIG_ARTIK_OTA
        check_ota_update();
 #endif
+       set_booting_device();
+
        return 0;
 }
 
index 761db4e4df70487d509030123e43c3a10e091019..e55a276ad06e0a84f74971fc20c522c379b057bc 100644 (file)
                        "setenv bootargs ${console} "                   \
                        "root=/dev/ram0 ${root_rw} "                    \
                        "${opts} ${recoverymode} "                      \
-                       "drm_panel=$lcd_panel;"                         \
+                       "drm_panel=$lcd_panel bootdev=mmcblk${rootdev};"                \
                "fi;"                                                   \
                "ext4load mmc ${rootdev}:${bootpart} $ramdiskaddr $ramdisk_file\0" \
        "boot_cmd_initrd="                                              \