[PATCH] mmc/host: Re-enable card en only after UHS mode changed for spreadtrum chipset.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhenxiong Lai <zhenxiong.lai@xxxxxxxxxx>

DLL locked status probably couldn't come out in a certain time on
Sharkl3 platform sometimes.
It can be workaround if re-anable card en bit only
rather than calling ->set_clock() after UHS timing changed.

Signed-off-by: Zhenxiong Lai <zhenxiong.lai@xxxxxxxxxx>
---
 drivers/mmc/host/sdhci.c | 7 ++++++-
 drivers/mmc/host/sdhci.h | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 07c6da1f2f0f..c415d00304fe 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2396,7 +2396,12 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 		}
 
 		/* Re-enable SD Clock */
-		host->ops->set_clock(host, host->clock);
+		if (host->quirks2 & SDHCI_QUIRK2_RE_ENABLE_CARD_EN) {
+			clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+			clk |= SDHCI_CLOCK_CARD_EN;
+			sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+		} else
+			host->ops->set_clock(host, host->clock);
 	} else
 		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index d7929d725730..3d4ab68f133f 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -477,6 +477,8 @@ struct sdhci_host {
  * block count.
  */
 #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT			(1<<18)
+/* controller only need to enable card en again after UHS timing was changed */
+#define SDHCI_QUIRK2_RE_ENABLE_CARD_EN			(1<<19)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */
-- 
2.17.0




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux