From patchwork Wed Jan 15 14:05:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 239615 List-Id: U-Boot discussion From: m.szyprowski at samsung.com (Marek Szyprowski) Date: Wed, 15 Jan 2020 15:05:58 +0100 Subject: [PATCH] arm: exynos: Read default MMC device from XOM[7:5] pins References: Message-ID: <20200115140558.6332-1-m.szyprowski@samsung.com> 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 Reviewed-by: Lukasz Majewski Reviewed-by: Anand Moon --- arch/arm/mach-exynos/include/mach/cpu.h | 1 + board/samsung/common/board.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h index 766edeeb29..fb5fdaf3ba 100644 --- a/arch/arm/mach-exynos/include/mach/cpu.h +++ b/arch/arm/mach-exynos/include/mach/cpu.h @@ -17,6 +17,7 @@ #define EXYNOS4_GPIO_PART3_BASE 0x03860000 #define EXYNOS4_PRO_ID 0x10000000 +#define EXYNOS4_OP_MODE 0x10000008 #define EXYNOS4_SYSREG_BASE 0x10010000 #define EXYNOS4_POWER_BASE 0x10020000 #define EXYNOS4_SWRESET 0x10020400 diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index ee2fc7971e..ac91c0a6fb 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -359,3 +359,17 @@ int board_usb_cleanup(int index, enum usb_init_type init) #endif return 0; } + +/** + * mmc_get_env_dev() - read boot MMC device id from XOM[7:5] pins. + */ +int mmc_get_env_dev(void) +{ + u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C; + + if (mode == 0x04) + return 2; /* MMC2: SD */ + + /* MMC0: eMMC or unknown */ + return 0; +}