Skip to contentSkip to conversation

mmc: core: fix the signaling 1.8V for HS200

PATCH Superseded Seungwon Jeon 2 participants 4 messages Apr 23, 2012 – Apr 25, 2012 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mmc: core: fix the signaling 1.8V for HS200

Currently only 1.2V is treated for HS200 mode. If the host has only 1.8V I/O capability not 1.2V, mmc_set_signal_voltage can't be called for 1.8V HS200. EXT_CSD_CARD_TYPE_SDR_1_8V needs to be considered.

---
 drivers/mmc/core/mmc.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
drivers/mmc/core/mmc.c +7 -5
index ebb9522..71eb320 100644
@@ -732,7 +732,7 @@ static int mmc_select_powerclass(struct mmc_card *card,
  */
 static int mmc_select_hs200(struct mmc_card *card)
 {
-	int idx, err = 0;
+	int idx, err = -EINVAL;
 	struct mmc_host *host;
 	static unsigned ext_csd_bits[] = {
 		EXT_CSD_BUS_WIDTH_4,
@@ -748,10 +748,12 @@ static int mmc_select_hs200(struct mmc_card *card)
 	host = card->host;
 
 	if (card->ext_csd.card_type & EXT_CSD_CARD_TYPE_SDR_1_2V &&
-	    host->caps2 & MMC_CAP2_HS200_1_2V_SDR)
-		if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0))
-			err = mmc_set_signal_voltage(host,
-						     MMC_SIGNAL_VOLTAGE_180, 0);
+			host->caps2 & MMC_CAP2_HS200_1_2V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0);
+
+	if (err && card->ext_csd.card_type & EXT_CSD_CARD_TYPE_SDR_1_8V &&
+			host->caps2 & MMC_CAP2_HS200_1_8V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, 0);
 
 	/* If fails try again during next card power cycle */
 	if (err)
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Seungwon,

Quoted 4 lines · Seungwon Jeon

Currently only 1.2V is treated for HS200 mode. If the host has only 1.8V I/O capability not 1.2V, mmc_set_signal_voltage can't be called for 1.8V HS200. EXT_CSD_CARD_TYPE_SDR_1_8V needs to be considered.

Commit text looks confusing to me. In this change, you are trying to set the 1.8V I/O voltage only if there is an error setting the 1.2v I/O? Can you please clarify more?

Quoted 36 lines
---
  drivers/mmc/core/mmc.c |   12 +++++++-----
  1 files changed, 7 insertions(+), 5 deletions(-)
drivers/mmc/core/mmc.c +7 -5
index ebb9522..71eb320 100644
@@ -732,7 +732,7 @@ static int mmc_select_powerclass(struct mmc_card *card,
   */
  static int mmc_select_hs200(struct mmc_card *card)
  {
-	int idx, err = 0;
+	int idx, err = -EINVAL;
  	struct mmc_host *host;
  	static unsigned ext_csd_bits[] = {
  		EXT_CSD_BUS_WIDTH_4,
@@ -748,10 +748,12 @@ static int mmc_select_hs200(struct mmc_card *card)
  	host = card->host;
 
  	if (card->ext_csd.card_type&  EXT_CSD_CARD_TYPE_SDR_1_2V&&
-	    host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
-		if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0))
-			err = mmc_set_signal_voltage(host,
-						     MMC_SIGNAL_VOLTAGE_180, 0);
+			host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0);
+
+	if (err&&  card->ext_csd.card_type&  EXT_CSD_CARD_TYPE_SDR_1_8V&&
+			host->caps2&  MMC_CAP2_HS200_1_8V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, 0);
 
  	/* If fails try again during next card power cycle */
  	if (err)
#2 lore raw
Quoted 10 lines · Subhash Jadavani

Hi Seungwon,

Quoted 4 lines · Seungwon Jeon

Currently only 1.2V is treated for HS200 mode. If the host has only 1.8V I/O capability not 1.2V, mmc_set_signal_voltage can't be called for 1.8V HS200. EXT_CSD_CARD_TYPE_SDR_1_8V needs to be considered.

Commit text looks confusing to me. In this change, you are trying to set the 1.8V I/O voltage only if there is an error setting the 1.2v I/O? Can you please clarify more?

This patch's purpose is to support 1.8V I/O. Origin considers only 1.2V I/O case. If the host has only 1.8V capability and card type is HS200 1.8V, there is no way to 1.8V I/O.

Assuming that card is type of HS200 1.2V and host has 1.2V capability,
the 1.2 I/O voltage will be tried. If it succeeds in 1.2V I/O ,
we don't need to trying the 1.8V I/O voltage though 1.8V I/O is possible. But the 1.8V I/O may be tried in case of 1.2V I/O failure, so error condition is needed.

And error is initialized by -EINVAL at the first time.
Thus, if card and host only are capable of 1.8V I/O, we can try to set the 1.8V I/O regardless of 1.2V I/O result.

Best regards,
Seungwon Jeon.

Quoted 41 lines
Quoted 26 lines
---
  drivers/mmc/core/mmc.c |   12 +++++++-----
  1 files changed, 7 insertions(+), 5 deletions(-)
drivers/mmc/core/mmc.c +1 -4
index ebb9522..71eb320 100644
@@ -732,7 +732,7 @@ static int mmc_select_powerclass(struct mmc_card *card,
   */
  static int mmc_select_hs200(struct mmc_card *card)
  {
-	int idx, err = 0;
+	int idx, err = -EINVAL;
  	struct mmc_host *host;
  	static unsigned ext_csd_bits[] = {
  		EXT_CSD_BUS_WIDTH_4,
@@ -748,10 +748,12 @@ static int mmc_select_hs200(struct mmc_card *card)
  	host = card->host;
 
  	if (card->ext_csd.card_type&  EXT_CSD_CARD_TYPE_SDR_1_2V&&
-	    host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
-		if (mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0))
-			err = mmc_set_signal_voltage(host,

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card *card) · line 759

Quoted 10 lines
drivers/mmc/core/mmc.c +6 -1
-						     MMC_SIGNAL_VOLTAGE_180, 0);
+			host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120, 0);
+
+	if (err&&  card->ext_csd.card_type&  EXT_CSD_CARD_TYPE_SDR_1_8V&&
+			host->caps2&  MMC_CAP2_HS200_1_8V_SDR)
+		err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, 0);
 
  	/* If fails try again during next card power cycle */
  	if (err)

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#3 lore raw
Quoted 15 lines

-----Original Message-----
From: Seungwon Jeon [mailto:[email protected]]
Sent: Wednesday, April 25, 2012 10:46 AM
To: 'Subhash Jadavani'
Cc: [email protected]; 'Chris Ball'; 'Girish K S'
Subject: RE: [PATCH 2/2] mmc: core: fix the signaling 1.8V for HS200

Quoted 6 lines · Subhash Jadavani

Hi Seungwon,

Quoted 3 lines · Seungwon Jeon

Currently only 1.2V is treated for HS200 mode. If the host has only 1.8V I/O capability not 1.2V, mmc_set_signal_voltage can't be called for 1.8V HS200. EXT_CSD_CARD_TYPE_SDR_1_8V needs to be considered.

Quoted 6 lines
Quoted 3 lines

Commit text looks confusing to me. In this change, you are trying to set the 1.8V I/O voltage only if there is an error setting the 1.2v I/O? Can you please clarify more?

This patch's purpose is to support 1.8V I/O. Origin considers only 1.2V I/O case. If the host has only 1.8V capability and card type is HS200 1.8V, there is no way to 1.8V I/O.

Thanks for clarification. I was assuming that most of the devices will have I/O voltage always set to 1.8v by host (when device is powered up) but yes, according to spec, it's possible that I/O may be at 3.3v (high voltage) as well. This patch looks good to me.

Regards,
Subhash

Quoted 62 lines

Assuming that card is type of HS200 1.2V and host has 1.2V capability, the 1.2 I/O voltage will be tried. If it succeeds in 1.2V I/O , we don't need to trying the 1.8V I/O voltage though 1.8V I/O is possible.
But the 1.8V I/O may be tried in case of 1.2V I/O failure, so error condition is needed.

And error is initialized by -EINVAL at the first time.
Thus, if card and host only are capable of 1.8V I/O, we can try to set the 1.8V I/O regardless of 1.2V I/O result.

Best regards,
Seungwon Jeon.

Quoted 11 lines

drivers/mmc/core/mmc.c static int mmc_select_powerclass(struct mmc_card

Quoted 11 lines
---
  drivers/mmc/core/mmc.c |   12 +++++++-----
  1 files changed, 7 insertions(+), 5 deletions(-)
drivers/mmc/core/mmc.c index renamed from drivers/mmc/core/mmc.c +0 -0

ebb9522..71eb320 100644

drivers/mmc/core/mmc.c +0 -0
@@ -732,7 +732,7 @@ static int mmc_select_powerclass(struct mmc_card

*card,

Quoted 9 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card

Quoted 9 lines
drivers/mmc/core/mmc.c +1 -1
   */
  static int mmc_select_hs200(struct mmc_card *card)
  {
-	int idx, err = 0;
+	int idx, err = -EINVAL;
  	struct mmc_host *host;
  	static unsigned ext_csd_bits[] = {
  		EXT_CSD_BUS_WIDTH_4,
@@ -748,10 +748,12 @@ static int mmc_select_hs200(struct mmc_card

*card)

Quoted 5 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card · line 752

Quoted 5 lines
drivers/mmc/core/mmc.c +0 -2
  	host = card->host;
 
  	if (card->ext_csd.card_type&  EXT_CSD_CARD_TYPE_SDR_1_2V&&
-	    host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
-		if (mmc_set_signal_voltage(host,

MMC_SIGNAL_VOLTAGE_120, 0))

Quoted 2 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card · line 754

Quoted 2 lines
drivers/mmc/core/mmc.c +0 -2
-			err = mmc_set_signal_voltage(host,
-

MMC_SIGNAL_VOLTAGE_180, 0);

Quoted 2 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card · line 752

Quoted 2 lines
drivers/mmc/core/mmc.c +2 -0
+			host->caps2&  MMC_CAP2_HS200_1_2V_SDR)
+		err = mmc_set_signal_voltage(host,

MMC_SIGNAL_VOLTAGE_120, 0);

Quoted 2 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card · line 754

Quoted 2 lines
drivers/mmc/core/mmc.c +2 -0
+
+	if (err&&  card->ext_csd.card_type&

EXT_CSD_CARD_TYPE_SDR_1_8V&&

Quoted 2 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card · line 756

Quoted 2 lines
drivers/mmc/core/mmc.c +2 -0
+			host->caps2&  MMC_CAP2_HS200_1_8V_SDR)
+		err = mmc_set_signal_voltage(host,

MMC_SIGNAL_VOLTAGE_180, 0);

Quoted 8 lines

drivers/mmc/core/mmc.c static int mmc_select_hs200(struct mmc_card *card) · line 759

Quoted 3 lines
drivers/mmc/core/mmc.c +0 -0
  	/* If fails try again during next card power cycle */
  	if (err)

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html