#include <common.h>
#include <dm.h>
+#include <dm/device-internal.h>
#include <env.h>
#include <i2c.h>
#include <init.h>
#ifdef CONFIG_BOARD_LATE_INIT
int board_late_init(void)
{
+ struct udevice *dev;
struct mmc *mmc_dev;
bool ddr4, emmc;
- if (env_get("fdtfile"))
- return 0;
-
if (!of_machine_is_compatible("globalscale,espressobin"))
return 0;
mmc_dev = find_mmc_device(1);
emmc = (mmc_dev && mmc_init(mmc_dev) == 0);
+ /* if eMMC is not present then remove it from DM */
+ if (!emmc && mmc_dev) {
+ dev = mmc_dev->dev;
+ device_remove(dev, DM_REMOVE_NORMAL);
+ device_unbind(dev);
+ }
+
+ if (env_get("fdtfile"))
+ return 0;
+
if (ddr4 && emmc)
env_set("fdtfile", "marvell/armada-3720-espressobin-v7-emmc.dtb");
else if (ddr4)
sdhci_writel(host, var, SDHC_SYS_OP_CTRL);
}
+/* Disable specific slot */
+static void xenon_mmc_disable_slot(struct sdhci_host *host, u8 slot)
+{
+ u32 var;
+
+ var = sdhci_readl(host, SDHC_SYS_OP_CTRL);
+ var &= ~(SLOT_MASK(slot) << SLOT_ENABLE_SHIFT);
+ sdhci_writel(host, var, SDHC_SYS_OP_CTRL);
+}
+
/* Enable Parallel Transfer Mode */
static void xenon_mmc_enable_parallel_tran(struct sdhci_host *host, u8 slot)
{
return ret;
}
+static int xenon_sdhci_remove(struct udevice *dev)
+{
+ struct sdhci_host *host = dev_get_priv(dev);
+
+ xenon_mmc_disable_slot(host, XENON_MMC_SLOT_ID_HYPERION);
+ return 0;
+}
+
static int xenon_sdhci_of_to_plat(struct udevice *dev)
{
struct sdhci_host *host = dev_get_priv(dev);
.ops = &sdhci_ops,
.bind = xenon_sdhci_bind,
.probe = xenon_sdhci_probe,
+ .remove = xenon_sdhci_remove,
.priv_auto = sizeof(struct xenon_sdhci_priv),
.plat_auto = sizeof(struct xenon_sdhci_plat),
};