All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
@ 2017-01-25 15:12 Ulf Hansson
  2017-01-25 15:12 ` [PATCH 1/6] mmc: core: Remove redundant code in mmc_set_signal_voltage() Ulf Hansson
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
eMMC card must support both if any, which makes the mmc host being the
potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
and a new corresponding DT binding, which tells whether 3.3V is supported for
the VCCQ.

In the context of these changes, I took the opportunity to make some clean-ups
of some related code.

Ulf Hansson (6):
  mmc: core: Remove redundant code in mmc_set_signal_voltage()
  mmc: core: Clarify usage of mmc_set_signal_voltage()
  mmc: core: Rename __mmc_set_signal_voltage() to
    mmc_set_signal_voltage()
  mmc: core: Invent MMC_CAP_3_3V_DDR
  mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
  mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v

 Documentation/devicetree/bindings/mmc/mmc.txt |  1 +
 drivers/mmc/core/core.c                       | 19 ++++++-------------
 drivers/mmc/core/core.h                       |  4 ++--
 drivers/mmc/core/host.c                       |  2 ++
 drivers/mmc/core/mmc.c                        | 27 +++++++++++++++------------
 drivers/mmc/core/sd.c                         |  3 +--
 drivers/mmc/core/sdio.c                       |  3 +--
 include/linux/mmc/host.h                      | 21 ++++++++++-----------
 8 files changed, 38 insertions(+), 42 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] mmc: core: Remove redundant code in mmc_set_signal_voltage()
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
@ 2017-01-25 15:12 ` Ulf Hansson
  2017-01-25 15:12 ` [PATCH 2/6] mmc: core: Clarify usage of mmc_set_signal_voltage() Ulf Hansson
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

The mmc_set_signal_voltage() function is used for SD/SDIO when switching to
1.8V for UHS mode. Therefore let's remove the redundant code dealing with
MMC_SIGNAL_VOLTAGE_330.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 8c45825..bb819d4 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1654,13 +1654,6 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr)
 	u32 clock;
 
 	/*
-	 * Send CMD11 only if the request is to switch the card to
-	 * 1.8V signalling.
-	 */
-	if (signal_voltage == MMC_SIGNAL_VOLTAGE_330)
-		return __mmc_set_signal_voltage(host, signal_voltage);
-
-	/*
 	 * If we cannot switch voltages, return failure so the caller
 	 * can continue without UHS mode
 	 */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] mmc: core: Clarify usage of mmc_set_signal_voltage()
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
  2017-01-25 15:12 ` [PATCH 1/6] mmc: core: Remove redundant code in mmc_set_signal_voltage() Ulf Hansson
@ 2017-01-25 15:12 ` Ulf Hansson
  2017-01-25 15:12 ` [PATCH 3/6] mmc: core: Rename __mmc_set_signal_voltage() to mmc_set_signal_voltage() Ulf Hansson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

The mmc_set_signal_voltage() function is used for SD/SDIO when switching to
1.8V for UHS mode. To clarify this let's do the following changes.

- We are always providing MMC_SIGNAL_VOLTAGE_180 as the signal_voltage
  parameter to the function. Then, let's just remove the parameter as it
  serves no purpose.
- Rename the function to mmc_set_uhs_voltage().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c | 4 ++--
 drivers/mmc/core/core.h | 2 +-
 drivers/mmc/core/sd.c   | 3 +--
 drivers/mmc/core/sdio.c | 3 +--
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index bb819d4..82c1a02 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1647,7 +1647,7 @@ int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage)
 
 }
 
-int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr)
+int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr)
 {
 	struct mmc_command cmd = {};
 	int err = 0;
@@ -1691,7 +1691,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr)
 	host->ios.clock = 0;
 	mmc_set_ios(host);
 
-	if (__mmc_set_signal_voltage(host, signal_voltage)) {
+	if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) {
 		/*
 		 * Voltages may not have been switched, but we've already
 		 * sent CMD11, so a power cycle is required anyway
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 8a95c825..aee23f5 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -48,7 +48,7 @@ struct device_node *mmc_of_find_child_device(struct mmc_host *host,
 void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
 void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
 u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
-int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr);
+int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr);
 int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage);
 void mmc_set_timing(struct mmc_host *host, unsigned int timing);
 void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 8b4f139..89531b4 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -788,8 +788,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
 	 */
 	if (!mmc_host_is_spi(host) && rocr &&
 	   ((*rocr & 0x41000000) == 0x41000000)) {
-		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180,
-					pocr);
+		err = mmc_set_uhs_voltage(host, pocr);
 		if (err == -EAGAIN) {
 			retries--;
 			goto try_again;
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 261c886..a64a870 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -642,8 +642,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 	 * to make sure which speed mode should work.
 	 */
 	if (!powered_resume && (rocr & ocr & R4_18V_PRESENT)) {
-		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180,
-					ocr_card);
+		err = mmc_set_uhs_voltage(host, ocr_card);
 		if (err == -EAGAIN) {
 			mmc_sdio_resend_if_cond(host, card);
 			retries--;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] mmc: core: Rename __mmc_set_signal_voltage() to mmc_set_signal_voltage()
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
  2017-01-25 15:12 ` [PATCH 1/6] mmc: core: Remove redundant code in mmc_set_signal_voltage() Ulf Hansson
  2017-01-25 15:12 ` [PATCH 2/6] mmc: core: Clarify usage of mmc_set_signal_voltage() Ulf Hansson
@ 2017-01-25 15:12 ` Ulf Hansson
  2017-01-25 15:12 ` [PATCH 4/6] mmc: core: Invent MMC_CAP_3_3V_DDR Ulf Hansson
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

Earlier the mmc_set_signal_voltage() existed, but since it has been renamed
to mmc_set_uhs_voltage(), we can now use that name instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/core.c | 10 +++++-----
 drivers/mmc/core/core.h |  2 +-
 drivers/mmc/core/mmc.c  | 16 ++++++++--------
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 82c1a02..1d44aa2 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1631,7 +1631,7 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr)
 	return ocr;
 }
 
-int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage)
+int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage)
 {
 	int err = 0;
 	int old_signal_voltage = host->ios.signal_voltage;
@@ -1691,7 +1691,7 @@ int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr)
 	host->ios.clock = 0;
 	mmc_set_ios(host);
 
-	if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) {
+	if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) {
 		/*
 		 * Voltages may not have been switched, but we've already
 		 * sent CMD11, so a power cycle is required anyway
@@ -1800,11 +1800,11 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
 	mmc_set_initial_state(host);
 
 	/* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */
-	if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330) == 0)
+	if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330) == 0)
 		dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n");
-	else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0)
+	else if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0)
 		dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n");
-	else if (__mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120) == 0)
+	else if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120) == 0)
 		dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n");
 
 	/*
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index aee23f5..55f543f 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -49,7 +49,7 @@ struct device_node *mmc_of_find_child_device(struct mmc_host *host,
 void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
 u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
 int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr);
-int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage);
+int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage);
 void mmc_set_timing(struct mmc_host *host, unsigned int timing);
 void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type);
 int mmc_select_drive_strength(struct mmc_card *card, unsigned int max_dtr,
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b91abe0..5844f29 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1122,14 +1122,14 @@ static int mmc_select_hs_ddr(struct mmc_card *card)
 	 */
 	err = -EINVAL;
 	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
 
 	if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V))
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
 
 	/* make sure vccq is 3.3v after switching disaster */
 	if (err)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330);
 
 	return err;
 }
@@ -1296,10 +1296,10 @@ static int mmc_select_hs400es(struct mmc_card *card)
 	}
 
 	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_2V)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
 
 	if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400_1_8V)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
 
 	/* If fails try again during next card power cycle */
 	if (err)
@@ -1405,10 +1405,10 @@ static int mmc_select_hs200(struct mmc_card *card)
 
 	old_signal_voltage = host->ios.signal_voltage;
 	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_2V)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
 
 	if (err && card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200_1_8V)
-		err = __mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
 
 	/* If fails try again during next card power cycle */
 	if (err)
@@ -1450,7 +1450,7 @@ static int mmc_select_hs200(struct mmc_card *card)
 err:
 	if (err) {
 		/* fall back to the old signal voltage, if fails report error */
-		if (__mmc_set_signal_voltage(host, old_signal_voltage))
+		if (mmc_set_signal_voltage(host, old_signal_voltage))
 			err = -EIO;
 
 		pr_err("%s: %s failed, error %d\n", mmc_hostname(card->host),
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] mmc: core: Invent MMC_CAP_3_3V_DDR
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (2 preceding siblings ...)
  2017-01-25 15:12 ` [PATCH 3/6] mmc: core: Rename __mmc_set_signal_voltage() to mmc_set_signal_voltage() Ulf Hansson
@ 2017-01-25 15:12 ` Ulf Hansson
       [not found] ` <1485357143-23280-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

According the JEDEC specification an eMMC card supporting 1.8V vccq in DDR
mode should also be capable of 3.3V. However, it's been reported that some
mmc hosts supports 3.3V, but not 1.8V.

Currently the mmc core implements an error handling when the host fails to
set 1.8V for vccq, by falling back to 3.3V. Unfortunate, this seems to be
insufficient for some mmc hosts. To enable these to use eMMC DDR mode let's
invent a new mmc cap, MMC_CAP_3_3V_DDR, which tells whether they support
the eMMC 3.3V DDR mode.

In case MMC_CAP_3_3V_DDR is set, but not MMC_CAP_1_8V_DDR, let's change to
remain on the 3.3V, as it's the default voltage level for vccq, set by the
earlier power up sequence.

As this change introduces MMC_CAP_3_3V_DDR, let's take the opportunity to
do some re-formatting of the related defines in the header file.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/mmc.c   | 11 +++++++----
 include/linux/mmc/host.h | 21 ++++++++++-----------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 5844f29..f1a451e 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -213,7 +213,7 @@ static void mmc_select_card_type(struct mmc_card *card)
 		avail_type |= EXT_CSD_CARD_TYPE_HS_52;
 	}
 
-	if (caps & MMC_CAP_1_8V_DDR &&
+	if (caps & (MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR) &&
 	    card_type & EXT_CSD_CARD_TYPE_DDR_1_8V) {
 		hs_max_dtr = MMC_HIGH_DDR_MAX_DTR;
 		avail_type |= EXT_CSD_CARD_TYPE_DDR_1_8V;
@@ -1120,11 +1120,14 @@ static int mmc_select_hs_ddr(struct mmc_card *card)
 	 *
 	 * WARNING: eMMC rules are NOT the same as SD DDR
 	 */
-	err = -EINVAL;
-	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V)
+	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_2V) {
 		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120);
+		if (!err)
+			return 0;
+	}
 
-	if (err && (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V))
+	if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_DDR_1_8V &&
+	    host->caps & MMC_CAP_1_8V_DDR)
 		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180);
 
 	/* make sure vccq is 3.3v after switching disaster */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 97699d5..83f1c4a 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -259,17 +259,16 @@ struct mmc_host {
 #define MMC_CAP_NONREMOVABLE	(1 << 8)	/* Nonremovable e.g. eMMC */
 #define MMC_CAP_WAIT_WHILE_BUSY	(1 << 9)	/* Waits while card is busy */
 #define MMC_CAP_ERASE		(1 << 10)	/* Allow erase/trim commands */
-#define MMC_CAP_1_8V_DDR	(1 << 11)	/* can support */
-						/* DDR mode at 1.8V */
-#define MMC_CAP_1_2V_DDR	(1 << 12)	/* can support */
-						/* DDR mode at 1.2V */
-#define MMC_CAP_POWER_OFF_CARD	(1 << 13)	/* Can power off after boot */
-#define MMC_CAP_BUS_WIDTH_TEST	(1 << 14)	/* CMD14/CMD19 bus width ok */
-#define MMC_CAP_UHS_SDR12	(1 << 15)	/* Host supports UHS SDR12 mode */
-#define MMC_CAP_UHS_SDR25	(1 << 16)	/* Host supports UHS SDR25 mode */
-#define MMC_CAP_UHS_SDR50	(1 << 17)	/* Host supports UHS SDR50 mode */
-#define MMC_CAP_UHS_SDR104	(1 << 18)	/* Host supports UHS SDR104 mode */
-#define MMC_CAP_UHS_DDR50	(1 << 19)	/* Host supports UHS DDR50 mode */
+#define MMC_CAP_3_3V_DDR	(1 << 11)	/* Host supports eMMC DDR 3.3V */
+#define MMC_CAP_1_8V_DDR	(1 << 12)	/* Host supports eMMC DDR 1.8V */
+#define MMC_CAP_1_2V_DDR	(1 << 13)	/* Host supports eMMC DDR 1.2V */
+#define MMC_CAP_POWER_OFF_CARD	(1 << 14)	/* Can power off after boot */
+#define MMC_CAP_BUS_WIDTH_TEST	(1 << 15)	/* CMD14/CMD19 bus width ok */
+#define MMC_CAP_UHS_SDR12	(1 << 16)	/* Host supports UHS SDR12 mode */
+#define MMC_CAP_UHS_SDR25	(1 << 17)	/* Host supports UHS SDR25 mode */
+#define MMC_CAP_UHS_SDR50	(1 << 18)	/* Host supports UHS SDR50 mode */
+#define MMC_CAP_UHS_SDR104	(1 << 19)	/* Host supports UHS SDR104 mode */
+#define MMC_CAP_UHS_DDR50	(1 << 20)	/* Host supports UHS DDR50 mode */
 #define MMC_CAP_DRIVER_TYPE_A	(1 << 23)	/* Host supports Driver Type A */
 #define MMC_CAP_DRIVER_TYPE_C	(1 << 24)	/* Host supports Driver Type C */
 #define MMC_CAP_DRIVER_TYPE_D	(1 << 25)	/* Host supports Driver Type D */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
       [not found] ` <1485357143-23280-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2017-01-25 15:12   ` Ulf Hansson
  2017-01-30 19:58     ` Rob Herring
  0 siblings, 1 reply; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc-u79uwXL29TY76Z2rM5mHXA, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Rob Herring

Cc: <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt
index 8a37782..c7f4a0e 100644
--- a/Documentation/devicetree/bindings/mmc/mmc.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc.txt
@@ -40,6 +40,7 @@ Optional properties:
 - cap-mmc-hw-reset: eMMC hardware reset is supported
 - cap-sdio-irq: enable SDIO IRQ signalling on this interface
 - full-pwr-cycle: full power cycle of the card is supported
+- mmc-ddr-3_3v: eMMC high-speed DDR mode(3.3V I/O) is supported
 - mmc-ddr-1_8v: eMMC high-speed DDR mode(1.8V I/O) is supported
 - mmc-ddr-1_2v: eMMC high-speed DDR mode(1.2V I/O) is supported
 - mmc-hs200-1_8v: eMMC HS200 mode(1.8V I/O) is supported
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (4 preceding siblings ...)
       [not found] ` <1485357143-23280-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2017-01-25 15:12 ` Ulf Hansson
  2017-01-27  2:27 ` [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Shawn Lin
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-25 15:12 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

When mmc_of_parse() finds the binding, it sets the mmc cap,
MMC_CAP_3_3V_DDR, which informs the core whether eMMC DDR at 3.3V I/O is
supported by the mmc host.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/host.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 98f25ff..8f75a84 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -301,6 +301,8 @@ int mmc_of_parse(struct mmc_host *host)
 	if (of_property_read_bool(np, "wakeup-source") ||
 	    of_property_read_bool(np, "enable-sdio-wakeup")) /* legacy */
 		host->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
+	if (of_property_read_bool(np, "mmc-ddr-3_3v"))
+		host->caps |= MMC_CAP_3_3V_DDR;
 	if (of_property_read_bool(np, "mmc-ddr-1_8v"))
 		host->caps |= MMC_CAP_1_8V_DDR;
 	if (of_property_read_bool(np, "mmc-ddr-1_2v"))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (5 preceding siblings ...)
  2017-01-25 15:12 ` [PATCH 6/6] mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v Ulf Hansson
@ 2017-01-27  2:27 ` Shawn Lin
  2017-01-27  8:57   ` Ulf Hansson
  2017-01-27 12:06 ` Jan Glauber
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 14+ messages in thread
From: Shawn Lin @ 2017-01-27  2:27 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: shawn.lin, Jaehoon Chung, Adrian Hunter, Stefan Wahren,
	Fabio Estevam, Jan Glauber

On 2017/1/25 23:12, Ulf Hansson wrote:
> It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
> eMMC card must support both if any, which makes the mmc host being the
> potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
> and a new corresponding DT binding, which tells whether 3.3V is supported for
> the VCCQ.
>
> In the context of these changes, I took the opportunity to make some clean-ups
> of some related code.
>

This patchset looks good. Just a nit, maybe we could take this chance
to improve the patch 3 as we touch it now:)

s/mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0/
!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180), and so on:)

Anyway,
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> Ulf Hansson (6):
>   mmc: core: Remove redundant code in mmc_set_signal_voltage()
>   mmc: core: Clarify usage of mmc_set_signal_voltage()
>   mmc: core: Rename __mmc_set_signal_voltage() to
>     mmc_set_signal_voltage()
>   mmc: core: Invent MMC_CAP_3_3V_DDR
>   mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
>   mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v
>
>  Documentation/devicetree/bindings/mmc/mmc.txt |  1 +
>  drivers/mmc/core/core.c                       | 19 ++++++-------------
>  drivers/mmc/core/core.h                       |  4 ++--
>  drivers/mmc/core/host.c                       |  2 ++
>  drivers/mmc/core/mmc.c                        | 27 +++++++++++++++------------
>  drivers/mmc/core/sd.c                         |  3 +--
>  drivers/mmc/core/sdio.c                       |  3 +--
>  include/linux/mmc/host.h                      | 21 ++++++++++-----------
>  8 files changed, 38 insertions(+), 42 deletions(-)
>


-- 
Best Regards
Shawn Lin


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-27  2:27 ` [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Shawn Lin
@ 2017-01-27  8:57   ` Ulf Hansson
  0 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-27  8:57 UTC (permalink / raw)
  To: Shawn Lin
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Stefan Wahren,
	Fabio Estevam, Jan Glauber

On 27 January 2017 at 03:27, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> On 2017/1/25 23:12, Ulf Hansson wrote:
>>
>> It's been reported that some mmc hosts don't support a VCCQ (signal
>> voltage) of
>> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC
>> spec, an
>> eMMC card must support both if any, which makes the mmc host being the
>> potential limitation. Therefore, let's invent a new mmc cap,
>> MMC_CAP_3_3V_DDR,
>> and a new corresponding DT binding, which tells whether 3.3V is supported
>> for
>> the VCCQ.
>>
>> In the context of these changes, I took the opportunity to make some
>> clean-ups
>> of some related code.
>>
>
> This patchset looks good. Just a nit, maybe we could take this chance
> to improve the patch 3 as we touch it now:)
>
> s/mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180) == 0/
> !mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180), and so on:)

Good idea! I found three places in mmc_power_up() which I fixed up.

I postpone to send a new version, to wait for further comments. If
none, I will just amend the change in patch3/6.

>
> Anyway,
> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

Thanks for reviewing!

[...]

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (6 preceding siblings ...)
  2017-01-27  2:27 ` [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Shawn Lin
@ 2017-01-27 12:06 ` Jan Glauber
  2017-01-27 14:58 ` Ulf Hansson
  2017-01-30  9:13 ` Stefan Wahren
  9 siblings, 0 replies; 14+ messages in thread
From: Jan Glauber @ 2017-01-27 12:06 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Shawn Lin,
	Stefan Wahren, Fabio Estevam

On Wed, Jan 25, 2017 at 04:12:17PM +0100, Ulf Hansson wrote:
> It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
> eMMC card must support both if any, which makes the mmc host being the
> potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
> and a new corresponding DT binding, which tells whether 3.3V is supported for
> the VCCQ.
> 
> In the context of these changes, I took the opportunity to make some clean-ups
> of some related code.

Works fine with the new Cavium driver (enables DDR mode for the eMMC).

Tested-by: Jan Glauber <jglauber@cavium.com>

> Ulf Hansson (6):
>   mmc: core: Remove redundant code in mmc_set_signal_voltage()
>   mmc: core: Clarify usage of mmc_set_signal_voltage()
>   mmc: core: Rename __mmc_set_signal_voltage() to
>     mmc_set_signal_voltage()
>   mmc: core: Invent MMC_CAP_3_3V_DDR
>   mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
>   mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v
> 
>  Documentation/devicetree/bindings/mmc/mmc.txt |  1 +
>  drivers/mmc/core/core.c                       | 19 ++++++-------------
>  drivers/mmc/core/core.h                       |  4 ++--
>  drivers/mmc/core/host.c                       |  2 ++
>  drivers/mmc/core/mmc.c                        | 27 +++++++++++++++------------
>  drivers/mmc/core/sd.c                         |  3 +--
>  drivers/mmc/core/sdio.c                       |  3 +--
>  include/linux/mmc/host.h                      | 21 ++++++++++-----------
>  8 files changed, 38 insertions(+), 42 deletions(-)
> 
> -- 
> 1.9.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (7 preceding siblings ...)
  2017-01-27 12:06 ` Jan Glauber
@ 2017-01-27 14:58 ` Ulf Hansson
  2017-01-30  9:13 ` Stefan Wahren
  9 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-27 14:58 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Stefan Wahren,
	Fabio Estevam, Jan Glauber

On 25 January 2017 at 16:12, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
> eMMC card must support both if any, which makes the mmc host being the
> potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
> and a new corresponding DT binding, which tells whether 3.3V is supported for
> the VCCQ.
>
> In the context of these changes, I took the opportunity to make some clean-ups
> of some related code.
>
> Ulf Hansson (6):
>   mmc: core: Remove redundant code in mmc_set_signal_voltage()
>   mmc: core: Clarify usage of mmc_set_signal_voltage()
>   mmc: core: Rename __mmc_set_signal_voltage() to
>     mmc_set_signal_voltage()
>   mmc: core: Invent MMC_CAP_3_3V_DDR
>   mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
>   mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v
>
>  Documentation/devicetree/bindings/mmc/mmc.txt |  1 +
>  drivers/mmc/core/core.c                       | 19 ++++++-------------
>  drivers/mmc/core/core.h                       |  4 ++--
>  drivers/mmc/core/host.c                       |  2 ++
>  drivers/mmc/core/mmc.c                        | 27 +++++++++++++++------------
>  drivers/mmc/core/sd.c                         |  3 +--
>  drivers/mmc/core/sdio.c                       |  3 +--
>  include/linux/mmc/host.h                      | 21 ++++++++++-----------
>  8 files changed, 38 insertions(+), 42 deletions(-)
>
> --
> 1.9.1
>

Applied for next, amended patch 3/6 according to suggestions by Shawn.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
                   ` (8 preceding siblings ...)
  2017-01-27 14:58 ` Ulf Hansson
@ 2017-01-30  9:13 ` Stefan Wahren
  2017-01-30 10:05   ` Ulf Hansson
  9 siblings, 1 reply; 14+ messages in thread
From: Stefan Wahren @ 2017-01-30  9:13 UTC (permalink / raw)
  To: Ulf Hansson, linux-mmc
  Cc: Jaehoon Chung, Adrian Hunter, Shawn Lin, Fabio Estevam, Jan Glauber

Am 25.01.2017 um 16:12 schrieb Ulf Hansson:
> It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
> eMMC card must support both if any, which makes the mmc host being the
> potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
> and a new corresponding DT binding, which tells whether 3.3V is supported for
> the VCCQ.
>
> In the context of these changes, I took the opportunity to make some clean-ups
> of some related code.

I know this series has already been merged, but i want to mention that
it works fine with mxs-mmc on a i.MX28.

Thanks

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V
  2017-01-30  9:13 ` Stefan Wahren
@ 2017-01-30 10:05   ` Ulf Hansson
  0 siblings, 0 replies; 14+ messages in thread
From: Ulf Hansson @ 2017-01-30 10:05 UTC (permalink / raw)
  To: Stefan Wahren
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Shawn Lin,
	Fabio Estevam, Jan Glauber

On 30 January 2017 at 10:13, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> Am 25.01.2017 um 16:12 schrieb Ulf Hansson:
>> It's been reported that some mmc hosts don't support a VCCQ (signal voltage) of
>> 1.8V for eMMC DDR mode, but instead only 3.3V. According to the JEDEC spec, an
>> eMMC card must support both if any, which makes the mmc host being the
>> potential limitation. Therefore, let's invent a new mmc cap, MMC_CAP_3_3V_DDR,
>> and a new corresponding DT binding, which tells whether 3.3V is supported for
>> the VCCQ.
>>
>> In the context of these changes, I took the opportunity to make some clean-ups
>> of some related code.
>
> I know this series has already been merged, but i want to mention that
> it works fine with mxs-mmc on a i.MX28.

Thanks! I have added your tested by tag.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support
  2017-01-25 15:12   ` [PATCH 5/6] mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support Ulf Hansson
@ 2017-01-30 19:58     ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2017-01-30 19:58 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, Jaehoon Chung, Adrian Hunter, Shawn Lin,
	Stefan Wahren, Fabio Estevam, Jan Glauber, devicetree

On Wed, Jan 25, 2017 at 04:12:22PM +0100, Ulf Hansson wrote:
> Cc: <devicetree@vger.kernel.org>
> Cc: Rob Herring <robh@kernel.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  Documentation/devicetree/bindings/mmc/mmc.txt | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-01-30 19:58 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 15:12 [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Ulf Hansson
2017-01-25 15:12 ` [PATCH 1/6] mmc: core: Remove redundant code in mmc_set_signal_voltage() Ulf Hansson
2017-01-25 15:12 ` [PATCH 2/6] mmc: core: Clarify usage of mmc_set_signal_voltage() Ulf Hansson
2017-01-25 15:12 ` [PATCH 3/6] mmc: core: Rename __mmc_set_signal_voltage() to mmc_set_signal_voltage() Ulf Hansson
2017-01-25 15:12 ` [PATCH 4/6] mmc: core: Invent MMC_CAP_3_3V_DDR Ulf Hansson
     [not found] ` <1485357143-23280-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2017-01-25 15:12   ` [PATCH 5/6] mmc: dt: Document binding for eMMC DDR 3.3V I/O voltage support Ulf Hansson
2017-01-30 19:58     ` Rob Herring
2017-01-25 15:12 ` [PATCH 6/6] mmc: core: Extend mmc_of_parse() to check for mmc-ddr-3_3v Ulf Hansson
2017-01-27  2:27 ` [PATCH 0/6] mmc: core: Enable mmc hosts to specify support for eMMC DDR 3.3V Shawn Lin
2017-01-27  8:57   ` Ulf Hansson
2017-01-27 12:06 ` Jan Glauber
2017-01-27 14:58 ` Ulf Hansson
2017-01-30  9:13 ` Stefan Wahren
2017-01-30 10:05   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.