[PATCH 3/4] mmc: sdhci: Set ctrl_hs400 value in dts

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

 



Because ctrl_hs400 value is non-standard, add support to set it
in dts.

Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx>
---
 drivers/mmc/host/sdhci.c | 9 ++++++++-
 drivers/mmc/host/sdhci.h | 6 +++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a654f0aeb438..d8a6c1c91448 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1899,7 +1899,7 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
 		 (timing == MMC_TIMING_MMC_DDR52))
 		ctrl_2 |= SDHCI_CTRL_UHS_DDR50;
 	else if (timing == MMC_TIMING_MMC_HS400)
-		ctrl_2 |= SDHCI_CTRL_HS400; /* Non-standard */
+		ctrl_2 |= host->sdhci_ctrl_hs400; /* Non-standard */
 	sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2);
 }
 EXPORT_SYMBOL_GPL(sdhci_set_uhs_signaling);
@@ -3635,6 +3635,13 @@ void __sdhci_read_caps(struct sdhci_host *host, const u16 *ver,
 	of_property_read_u64(mmc_dev(host->mmc)->of_node,
 			     "sdhci-caps", &dt_caps);
 
+	if (of_property_read_u32(mmc_dev(host->mmc)->of_node,
+				 "sdhci-ctrl-hs400", &host->sdhci_ctrl_hs400))
+		host->sdhci_ctrl_hs400 = SDHCI_CTRL_HS400;
+	else
+		WARN_ON(host->sdhci_ctrl_hs400 > 7
+			|| host->sdhci_ctrl_hs400 < 5);
+
 	v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION);
 	host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
 
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 0e6f97eaa796..cac4d819f62c 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -184,7 +184,8 @@
 #define   SDHCI_CTRL_UHS_SDR50		0x0002
 #define   SDHCI_CTRL_UHS_SDR104		0x0003
 #define   SDHCI_CTRL_UHS_DDR50		0x0004
-#define   SDHCI_CTRL_HS400		0x0005 /* Non-standard */
+/* SDHCI_CTRL_HS400 is non-standard value, can change it in dts */
+#define   SDHCI_CTRL_HS400		0x0005
 #define  SDHCI_CTRL_VDD_180		0x0008
 #define  SDHCI_CTRL_DRV_TYPE_MASK	0x0030
 #define   SDHCI_CTRL_DRV_TYPE_B		0x0000
@@ -605,6 +606,9 @@ struct sdhci_host {
 
 	u64			data_timeout;
 
+	/* SDHCI_CTRL_HS400 value */
+	u32			sdhci_ctrl_hs400;
+
 	unsigned long private[0] ____cacheline_aligned;
 };
 
-- 
2.17.1




[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