Skip to contentSkip to conversation

mmc: In mmc_power_up, use previously selected ocr if available

PATCH In review Balaji Rao 3 participants 6 messages Feb 9, 2009 – Mar 8, 2009 MMC, SD and SDIO

lore
Share & tools
lore

Balaji Rao

author
#0 lore raw

PATCH 1/1 mmc: In mmc_power_up, use previously selected ocr if available

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>
---
 drivers/mmc/core/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/mmc/core/core.c +7 -1
index df6ce4a..3ad7f87 100644
@@ -572,7 +572,13 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing)
  */
 static void mmc_power_up(struct mmc_host *host)
 {
-	int bit = fls(host->ocr_avail) - 1;
+	int bit;
+
+	/* If ocr is set, we use it */
+	if (host->ocr)
+		bit = ffs(host->ocr) - 1;
+	else
+		bit = fls(host->ocr_avail) - 1;
 
 	host->ios.vdd = bit;
 	if (mmc_host_is_spi(host)) {
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 19 lines · On Mon, 9 Feb 2009 18:58:08 +0530 Balaji Rao <[email protected]> wrote:

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>
---
 drivers/mmc/core/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/mmc/core/core.c +0 -1
index df6ce4a..3ad7f87 100644
@@ -572,7 +572,13 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing)
  */
 static void mmc_power_up(struct mmc_host *host)
 {
-	int bit = fls(host->ocr_avail) - 1;

drivers/mmc/core/core.c void mmc_set_timing(struct mmc_host *host, unsigned int timing) · line 584

Quoted 10 lines
drivers/mmc/core/core.c +7 -0
+	int bit;
+
+	/* If ocr is set, we use it */
+	if (host->ocr)
+		bit = ffs(host->ocr) - 1;
+	else
+		bit = fls(host->ocr_avail) - 1;
 
 	host->ios.vdd = bit;
 	if (mmc_host_is_spi(host)) {

What are the user-visible consequences of not having this patch in their kernels?

In other words, what does this patch fix?

Please always include this information in changelogs.

See, this patch is applicable to 2.6.28, 2.6.27, 2.6.26, 2.6.25 and probably earlier. But I don't have a clue whether it should be applied to those kernels, because you didn't tell me.

author
#2 lore raw
Quoted 36 lines · Andrew Morton
Quoted 19 lines · On Mon, 9 Feb 2009 18:58:08 +0530 Balaji Rao <[email protected]> wrote:

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>
---
 drivers/mmc/core/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
drivers/mmc/core/core.c +0 -1
index df6ce4a..3ad7f87 100644
@@ -572,7 +572,13 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing)
  */
 static void mmc_power_up(struct mmc_host *host)
 {
-	int bit = fls(host->ocr_avail) - 1;

drivers/mmc/core/core.c void mmc_set_timing(struct mmc_host *host, unsigned int timing) · line 584

Quoted 10 lines
drivers/mmc/core/core.c +7 -0
+	int bit;
+
+	/* If ocr is set, we use it */
+	if (host->ocr)
+		bit = ffs(host->ocr) - 1;
+	else
+		bit = fls(host->ocr_avail) - 1;
 
 	host->ios.vdd = bit;
 	if (mmc_host_is_spi(host)) {

What are the user-visible consequences of not having this patch in their kernels?

Quoted 4 lines

In other words, what does this patch fix?

Please always include this information in changelogs.

OK, sorry about that.

Actually, it's nothing more than the wrong voltage being used on resume. I have seen no consequences of this, but it shouldn't be doing so and should be using the voltage determined at probing time.

Quoted 3 lines

See, this patch is applicable to 2.6.28, 2.6.27, 2.6.26, 2.6.25 and probably earlier. But I don't have a clue whether it should be applied to those kernels, because you didn't tell me.

But since I haven't really seen any trouble, we could well apply it only to the current kernel ?

Thanks,
Balaji

#3 lore raw
In reply to Balaji Rao
Quoted 7 lines · On Mon, 9 Feb 2009 18:58:08 +0530 Balaji Rao <[email protected]> wrote:

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>

---

Hmm... This is a bit hackish and changes the previously known behaviour of mmc_power_up(). We probably need to refactor things and have some other explicit call from the resume path.

Rgds

Signature · 9 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.
author
#4 lore raw

PATCH 1/1 mmc: During unsafe resume, select the right volatge for the card

Quoted 6 lines · Pierre Ossman
Quoted 3 lines · On Mon, 9 Feb 2009 18:58:08 +0530 Balaji Rao <[email protected]> wrote:

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Quoted 9 lines
Quoted 4 lines
Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>

---

Hmm... This is a bit hackish and changes the previously known behaviour of mmc_power_up(). We probably need to refactor things and have some other explicit call from the resume path.

Hi Pierre,

Here's a simpler patch. How does this look ?

Thanks,
Balaji

---
During mmc unsafe resume, choose the right voltage for the card after powerup.

Although this has not seen to cause trouble, it's the wrong behaviour.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>
drivers/mmc/core/core.c +1 -0
index 3ad7f87..1e8de16 100644
@@ -881,6 +881,7 @@ int mmc_resume_host(struct mmc_host *host)
 	mmc_bus_get(host);
 	if (host->bus_ops && !host->bus_dead) {
 		mmc_power_up(host);
+		mmc_select_voltage(host, host->ocr);
 		BUG_ON(!host->bus_ops->resume);
 		host->bus_ops->resume(host);
 	}
#5 lore raw

Re: [PATCH] mmc: During unsafe resume, select the right volatge for the card

Quoted 12 lines · On Wed, 25 Feb 2009 15:28:09 +0530 Balaji Rao <[email protected]> wrote:
Quoted 11 lines · Pierre Ossman
Quoted 7 lines · On Mon, 9 Feb 2009 18:58:08 +0530 Balaji Rao <[email protected]> wrote:

When mmc_power_up is called during unsafe resume, host->ocr should be used instead of host->ocr_avail.

Cc Andy Green <[email protected]>
Cc Pierre Ossman <[email protected]>

---

Quoted 9 lines
Quoted 4 lines

Hmm... This is a bit hackish and changes the previously known behaviour of mmc_power_up(). We probably need to refactor things and have some other explicit call from the resume path.

Hi Pierre,

Here's a simpler patch. How does this look ?

Should work. Queued up.

Thanks

Signature · 9 lines
     -- Pierre Ossman

  Linux kernel, MMC maintainer        http://www.kernel.org
  rdesktop, core developer          http://www.rdesktop.org

  WARNING: This correspondence is being monitored by the
  Swedish government. Make sure your server uses encryption
  for SMTP traffic and consider using PGP for end-to-end
  encryption.