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