From 6dded97c74c42a63dc3c8ea194d470e73cb96f1b Mon Sep 17 00:00:00 2001 From: Antony Arun T Date: Mon, 24 Jun 2019 12:58:05 +0530 Subject: [PATCH] ipq6018: fixing "reset never completed issue" As per the SD controller hardware design document the SD bus power should be turned off and the iopad voltage has to be set to 3V (default), before doing reset for all in SD host controller. Change-Id: Ia77bb0acefe1e619c8ae7a2bc60024bf1ac5c6cd Signed-off-by: Antony Arun T --- board/qca/arm/ipq6018/ipq6018.c | 8 ++++++++ drivers/mmc/sdhci.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/board/qca/arm/ipq6018/ipq6018.c b/board/qca/arm/ipq6018/ipq6018.c index a04dcdd82a..795319e8c6 100644 --- a/board/qca/arm/ipq6018/ipq6018.c +++ b/board/qca/arm/ipq6018/ipq6018.c @@ -246,6 +246,14 @@ void mmc_iopad_config(struct sdhci_host *host) writel(val, host->ioaddr + SDHCI_VENDOR_IOPAD); } +void sdhci_bus_pwr_off(struct sdhci_host *host) +{ + u32 val; + + val = sdhci_readb(host, SDHCI_HOST_CONTROL); + sdhci_writeb(host,(val & (~SDHCI_POWER_ON)), SDHCI_POWER_CONTROL); +} + void emmc_clock_disable(void) { /* Clear divider */ diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index d51c36f146..b1fcd926fa 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -21,10 +21,18 @@ void *aligned_buffer; #define CACHE_LINE_SIZE (CONFIG_SYS_CACHELINE_SIZE) +__weak void sdhci_bus_pwr_off(struct sdhci_host *host) +{ + return; +} + static void sdhci_reset(struct sdhci_host *host, u8 mask) { unsigned long timeout; + if (mask & SDHCI_RESET_ALL) { + sdhci_bus_pwr_off(host); + } /* Wait max 100 ms */ timeout = 100; sdhci_writeb(host, mask, SDHCI_SOFTWARE_RESET);