liuyingdong / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
e336be
From patchwork Thu Jun 28 08:13:30 2018
e336be
Content-Type: text/plain; charset="utf-8"
e336be
MIME-Version: 1.0
e336be
Content-Transfer-Encoding: 7bit
e336be
Subject: [2/3] mmc: sdhci: add quirk to prevent higher speed modes
e336be
From: Stefan Agner <stefan@agner.ch>
e336be
X-Patchwork-Id: 10493273
e336be
Message-Id: <20180628081331.13051-3-stefan@agner.ch>
e336be
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
e336be
Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com,
e336be
 michael@amarulasolutions.com, rmk+kernel@armlinux.org.uk,
e336be
 linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
e336be
 Stefan Agner <stefan@agner.ch>
e336be
Date: Thu, 28 Jun 2018 10:13:30 +0200
e336be
e336be
Some hosts are capable of running higher speed modes but do not
e336be
have the board support for it. Introduce a quirk which prevents
e336be
the stack from using modes running at 100MHz or faster.
e336be
e336be
Signed-off-by: Stefan Agner <stefan@agner.ch>
e336be
---
e336be
 drivers/mmc/host/sdhci.c | 8 ++++++++
e336be
 drivers/mmc/host/sdhci.h | 2 ++
e336be
 2 files changed, 10 insertions(+)
e336be
e336be
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
e336be
index 1c828e0e9905..8ac257dfaab3 100644
e336be
--- a/drivers/mmc/host/sdhci.c
e336be
+++ b/drivers/mmc/host/sdhci.c
e336be
@@ -3749,6 +3749,14 @@ int sdhci_setup_host(struct sdhci_host *host)
e336be
 		}
e336be
 	}
e336be
 
e336be
+	if (host->quirks2 & SDHCI_QUIRK2_NO_UHS_HS200_HS400) {
e336be
+		host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
e336be
+				 SDHCI_SUPPORT_DDR50);
e336be
+
e336be
+		mmc->caps2 &= ~(MMC_CAP2_HSX00_1_8V | MMC_CAP2_HSX00_1_2V |
e336be
+				MMC_CAP2_HS400_ES);
e336be
+	}
e336be
+
e336be
 	if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V) {
e336be
 		host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
e336be
 				 SDHCI_SUPPORT_DDR50);
e336be
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
e336be
index 23966f887da6..cb2433d6d61f 100644
e336be
--- a/drivers/mmc/host/sdhci.h
e336be
+++ b/drivers/mmc/host/sdhci.h
e336be
@@ -450,6 +450,8 @@ struct sdhci_host {
e336be
  * obtainable timeout.
e336be
  */
e336be
 #define SDHCI_QUIRK2_DISABLE_HW_TIMEOUT			(1<<17)
e336be
+/* Do not support any higher speeds (>50MHz) */
e336be
+#define SDHCI_QUIRK2_NO_UHS_HS200_HS400			(1<<18)
e336be
 
e336be
 	int irq;		/* Device IRQ */
e336be
 	void __iomem *ioaddr;	/* Mapped address */