mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-17 12:41:32 +00:00
arm: mvebu: Espressobin: Detect presence of emmc at runtime
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 <pali@kernel.org> Tested-by: Gérald Kerma <gerald@gk2.net> Reviewed-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
parent
135973967b
commit
061c6d1b23
1 changed files with 5 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <i2c.h>
|
#include <i2c.h>
|
||||||
#include <init.h>
|
#include <init.h>
|
||||||
|
#include <mmc.h>
|
||||||
#include <phy.h>
|
#include <phy.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/cpu.h>
|
#include <asm/arch/cpu.h>
|
||||||
|
@ -83,6 +84,7 @@ int board_init(void)
|
||||||
#ifdef CONFIG_BOARD_LATE_INIT
|
#ifdef CONFIG_BOARD_LATE_INIT
|
||||||
int board_late_init(void)
|
int board_late_init(void)
|
||||||
{
|
{
|
||||||
|
struct mmc *mmc_dev;
|
||||||
bool ddr4, emmc;
|
bool ddr4, emmc;
|
||||||
|
|
||||||
if (env_get("fdtfile"))
|
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)
|
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;
|
& 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)
|
if (ddr4 && emmc)
|
||||||
env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb");
|
env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb");
|
||||||
|
|
Loading…
Add table
Reference in a new issue