diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2020-01-17 14:02:44 +0100 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2020-01-28 09:54:05 +0900 |
commit | 86c88711082b9fb4da5f7eb0b80d5604c283f0c5 (patch) | |
tree | cf75818ec9dc87be33ecb2acaaa11d911ba5523e /board/samsung | |
parent | da63b5da61318a2ea8a84a41f2e49eb24f8a3759 (diff) |
arm: exynos: Read default MMC device from XOM[7:5] pins
XOM pins provide information for iROM bootloader about the boot device.
Those pins are mapped to lower bits of OP_MODE register (0x10000008),
which is common for all Exynos SoC variants. Set the default MMC device id
to reflect the boot device selected by XOM[7:5] pins (2 for the SD or 0 for
the eMMC).
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'board/samsung')
-rw-r--r-- | board/samsung/common/board.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 5d4646d14c..390060e51f 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -25,6 +25,8 @@ #include <asm/arch/sromc.h> #include <lcd.h> #include <i2c.h> +#include <mmc.h> +#include <stdio_dev.h> #include <usb.h> #include <dwc3-uboot.h> #include <samsung/misc.h> @@ -43,6 +45,20 @@ __weak int exynos_power_init(void) return 0; } +/** + * get_boot_mmc_dev() - read boot MMC device id from XOM[7:5] pins. + */ +static int get_boot_mmc_dev(void) +{ + u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C; + + if (mode == 0x04) + return 2; /* MMC2: SD */ + + /* MMC0: eMMC or unknown */ + return 0; +} + #if defined CONFIG_EXYNOS_TMU /* Boot Time Thermal Analysis for SoC temperature threshold breach */ static void boot_temp_check(void) @@ -281,6 +297,8 @@ int board_late_init(void) { struct udevice *dev; int ret; + int mmcbootdev = get_boot_mmc_dev(); + char mmcbootdev_str[16]; stdio_print_current_devices(); ret = uclass_first_device_err(UCLASS_CROS_EC, &dev); @@ -293,6 +311,11 @@ int board_late_init(void) panic("Cannot init cros-ec device"); return -1; } + + printf("Boot device: MMC(%u)\n", mmcbootdev); + sprintf(mmcbootdev_str, "%u", mmcbootdev); + env_set("mmcbootdev", mmcbootdev_str); + return 0; } #endif @@ -360,3 +383,8 @@ int board_usb_cleanup(int index, enum usb_init_type init) #endif return 0; } + +int mmc_get_env_dev(void) +{ + return get_boot_mmc_dev(); +} |