summaryrefslogtreecommitdiff
path: root/drivers/mmc/xenon_sdhci.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-12-21 13:09:10 +0300
committerStefan Roese <sr@denx.de>2021-01-27 09:29:43 +0300
commit9d716339fbb4d3e074aa6dfca795bafd9832a34d (patch)
tree4d51b2a812af3fe1fba550e6b9b2eab8c31f1678 /drivers/mmc/xenon_sdhci.c
parent9c690314dba9a2860a97f56e6e57f63c8513ddba (diff)
downloadu-boot-9d716339fbb4d3e074aa6dfca795bafd9832a34d.tar.xz
arm: mvebu: Espressobin: Disable slot when emmc is not present
This change extends previous commit 061c6d1b238a ("arm: mvebu: Espressobin: Detect presence of emmc at runtime") and when emmc is not present then emmc is removed from U-Boot DM and corresponding slot is disabled. Therefore on Espressobin board without soldered emmc, state of emmc hw should be same as if emmc was disabled in DTS. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mmc/xenon_sdhci.c')
-rw-r--r--drivers/mmc/xenon_sdhci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c
index 14fec4b8e7..d635694401 100644
--- a/drivers/mmc/xenon_sdhci.c
+++ b/drivers/mmc/xenon_sdhci.c
@@ -338,6 +338,16 @@ static void xenon_mmc_enable_slot(struct sdhci_host *host, u8 slot)
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)
{
@@ -503,6 +513,14 @@ static int xenon_sdhci_probe(struct udevice *dev)
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);
@@ -552,6 +570,7 @@ U_BOOT_DRIVER(xenon_sdhci_drv) = {
.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),
};