From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 25 Nov 2020 19:20:10 +0100 Subject: [PATCH 4/4] arm: mvebu: Espressobin: Detect presence of emmc at runtime In-Reply-To: <20201125182010.23167-1-pali@kernel.org> References: <20201125182010.23167-1-pali@kernel.org> Message-ID: <20201125182010.23167-5-pali@kernel.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Try to initialize emmc in board_late_init() and if it fails then we know that emmc device is not connected. This allows to use in U-Boot just one DTS file for all Espressobin variants and also to correctly set fdtfile env variable for Linux kernel. Signed-off-by: Pali Roh?r Tested-by: G?rald Kerma --- board/Marvell/mvebu_armada-37xx/board.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 73d69e0388..f67b04b78c 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -83,6 +84,7 @@ int board_init(void) #ifdef CONFIG_BOARD_LATE_INIT int board_late_init(void) { + struct mmc *mmc_dev; bool ddr4, emmc; if (env_get("fdtfile")) @@ -95,7 +97,9 @@ int board_late_init(void) ddr4 = ((readl(A3700_CH0_MC_CTRL2_REG) >> A3700_MC_CTRL2_SDRAM_TYPE_OFFS) & A3700_MC_CTRL2_SDRAM_TYPE_MASK) == A3700_MC_CTRL2_SDRAM_TYPE_DDR4; - emmc = of_machine_is_compatible("globalscale,espressobin-emmc"); + /* eMMC is mmc dev num 1 */ + mmc_dev = find_mmc_device(1); + emmc = (mmc_dev && mmc_init(mmc_dev) == 0); if (ddr4 && emmc) env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb"); -- 2.20.1