public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: In mmc_power_up, use previously selected ocr if available
@ 2009-02-09 13:28 Balaji Rao
  2009-02-17 21:29 ` Andrew Morton
  2009-02-18 20:25 ` Pierre Ossman
  0 siblings, 2 replies; 6+ messages in thread
From: Balaji Rao @ 2009-02-09 13:28 UTC (permalink / raw)
  To: LKML; +Cc: Andy Green, Pierre Ossman

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

Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
Cc: Andy Green <andy@openmoko.com>
Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
---
 drivers/mmc/core/core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index df6ce4a..3ad7f87 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -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)) {
-- 
1.6.0.6

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

* Re: [PATCH] mmc: In mmc_power_up, use previously selected ocr if available
  2009-02-09 13:28 [PATCH] mmc: In mmc_power_up, use previously selected ocr if available Balaji Rao
@ 2009-02-17 21:29 ` Andrew Morton
  2009-02-18  2:57   ` Balaji Rao
  2009-02-18 20:25 ` Pierre Ossman
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-02-17 21:29 UTC (permalink / raw)
  To: Balaji Rao; +Cc: linux-kernel, andy, drzeus-mmc

On Mon, 9 Feb 2009 18:58:08 +0530
Balaji Rao <balajirrao@openmoko.org> wrote:

> When mmc_power_up is called during unsafe resume, host->ocr should be
> used instead of host->ocr_avail.
> 
> Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
> Cc: Andy Green <andy@openmoko.com>
> Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
> ---
>  drivers/mmc/core/core.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index df6ce4a..3ad7f87 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -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)) {

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.




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

* Re: [PATCH] mmc: In mmc_power_up, use previously selected ocr if available
  2009-02-17 21:29 ` Andrew Morton
@ 2009-02-18  2:57   ` Balaji Rao
  0 siblings, 0 replies; 6+ messages in thread
From: Balaji Rao @ 2009-02-18  2:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, andy, drzeus-mmc

On Tue, Feb 17, 2009 at 01:29:00PM -0800, Andrew Morton wrote:
> On Mon, 9 Feb 2009 18:58:08 +0530
> Balaji Rao <balajirrao@openmoko.org> wrote:
> 
> > When mmc_power_up is called during unsafe resume, host->ocr should be
> > used instead of host->ocr_avail.
> > 
> > Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
> > Cc: Andy Green <andy@openmoko.com>
> > Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
> > ---
> >  drivers/mmc/core/core.c |    8 +++++++-
> >  1 files changed, 7 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index df6ce4a..3ad7f87 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -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)) {
> 
> 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.
> 
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.

> 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

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

* Re: [PATCH] mmc: In mmc_power_up, use previously selected ocr if available
  2009-02-09 13:28 [PATCH] mmc: In mmc_power_up, use previously selected ocr if available Balaji Rao
  2009-02-17 21:29 ` Andrew Morton
@ 2009-02-18 20:25 ` Pierre Ossman
  2009-02-25  9:58   ` [PATCH] mmc: During unsafe resume, select the right volatge for the card Balaji Rao
  1 sibling, 1 reply; 6+ messages in thread
From: Pierre Ossman @ 2009-02-18 20:25 UTC (permalink / raw)
  To: Balaji Rao; +Cc: LKML, Andy Green

On Mon, 9 Feb 2009 18:58:08 +0530
Balaji Rao <balajirrao@openmoko.org> wrote:

> When mmc_power_up is called during unsafe resume, host->ocr should be
> used instead of host->ocr_avail.
> 
> Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
> Cc: Andy Green <andy@openmoko.com>
> Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
> ---

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
-- 
     -- 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.

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

* [PATCH] mmc: During unsafe resume, select the right volatge for the card
  2009-02-18 20:25 ` Pierre Ossman
@ 2009-02-25  9:58   ` Balaji Rao
  2009-03-08 13:41     ` Pierre Ossman
  0 siblings, 1 reply; 6+ messages in thread
From: Balaji Rao @ 2009-02-25  9:58 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: LKML, Andy Green, Andrew Morton

On Wed, Feb 18, 2009 at 09:25:15PM +0100, Pierre Ossman wrote:
> On Mon, 9 Feb 2009 18:58:08 +0530
> Balaji Rao <balajirrao@openmoko.org> wrote:
> 
> > When mmc_power_up is called during unsafe resume, host->ocr should be
> > used instead of host->ocr_avail.
> > 
> > Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
> > Cc: Andy Green <andy@openmoko.com>
> > Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
> > ---
> 
> 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.
 
Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
Cc: Andy Green <andy@openmoko.com>
Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3ad7f87..1e8de16 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -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);
 	}

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

* Re: [PATCH] mmc: During unsafe resume, select the right volatge for the card
  2009-02-25  9:58   ` [PATCH] mmc: During unsafe resume, select the right volatge for the card Balaji Rao
@ 2009-03-08 13:41     ` Pierre Ossman
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre Ossman @ 2009-03-08 13:41 UTC (permalink / raw)
  To: Balaji Rao; +Cc: LKML, Andy Green, Andrew Morton

On Wed, 25 Feb 2009 15:28:09 +0530
Balaji Rao <balajirrao@openmoko.org> wrote:

> On Wed, Feb 18, 2009 at 09:25:15PM +0100, Pierre Ossman wrote:
> > On Mon, 9 Feb 2009 18:58:08 +0530
> > Balaji Rao <balajirrao@openmoko.org> wrote:
> > 
> > > When mmc_power_up is called during unsafe resume, host->ocr should be
> > > used instead of host->ocr_avail.
> > > 
> > > Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
> > > Cc: Andy Green <andy@openmoko.com>
> > > Cc: Pierre Ossman <drzeus-mmc@drzeus.cx>
> > > ---
> > 
> > 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
-- 
     -- 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.

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

end of thread, other threads:[~2009-03-08 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-09 13:28 [PATCH] mmc: In mmc_power_up, use previously selected ocr if available Balaji Rao
2009-02-17 21:29 ` Andrew Morton
2009-02-18  2:57   ` Balaji Rao
2009-02-18 20:25 ` Pierre Ossman
2009-02-25  9:58   ` [PATCH] mmc: During unsafe resume, select the right volatge for the card Balaji Rao
2009-03-08 13:41     ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox