2014-11-12 03:55:58

by NeilBrown

[permalink] [raw]
Subject: [PATCH 0/2] mmc: core: power-on sdio card correctly.

These two patches replace my previous patch
[PATCH 2/2] mmc: core: reset sdio card properly on resume.

The only change is to use host->card->ocr instead of
host->ocr_avail, as recommend by Ulf.

These restore my libertas wifi device properly on system
resume.

(I'm still hoping for a reply to my other patch:
[PATCH 1/2] mmc: core: allow a reset gpio to be configured.
)

Thanks,
NeilBrown

---

NeilBrown (2):
mmc: core: use card->ocr when negotiating voltage setting in mmc_sdio_power_restore
mmc: core: reset sdio card properly on resume.


drivers/mmc/core/sdio.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

--
Signature


2014-11-12 03:56:05

by NeilBrown

[permalink] [raw]
Subject: [PATCH 1/2] mmc: core: use card->ocr when negotiating voltage setting in mmc_sdio_power_restore

As we are restoring power to a known card, it makes sense to use
the 'ocr' value known for the card rather than the generic one
for the host interface.
This matches the use of card->ocr passed to mmc_power_up in
mmc_sdio_runtime_resume (just before mmc_sdio_power_restore is
called), and the value passed to mmc_sdio_init_card() a little
later in mmc_sdio_power_restore().

Suggested-by: Ulf Hansson <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
---
drivers/mmc/core/sdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index e636d9e99e4a..3c0f07961fab 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1028,7 +1028,7 @@ static int mmc_sdio_power_restore(struct mmc_host *host)

sdio_reset(host);
mmc_go_idle(host);
- mmc_send_if_cond(host, host->ocr_avail);
+ mmc_send_if_cond(host, host->card->ocr);

ret = mmc_send_io_op_cond(host, 0, NULL);
if (ret)

2014-11-12 03:56:14

by NeilBrown

[permalink] [raw]
Subject: [PATCH 2/2] mmc: core: reset sdio card properly on resume.

mmc_sdio_power_restore() calls
mmc_send_if_cond(host, host->card->ocr);

ret = mmc_send_io_op_cond(host, 0, NULL);

between mmc_go_idle() and mmc_sdio_init_card().
mmc_sdio_resume() needs to as well, else my libertas sdio wifi
device doesn't resume properly from suspend.

Signed-off-by: NeilBrown <[email protected]>
---
drivers/mmc/core/sdio.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 3c0f07961fab..da927c61bf47 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -981,8 +981,12 @@ static int mmc_sdio_resume(struct mmc_host *host)
if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) {
sdio_reset(host);
mmc_go_idle(host);
- err = mmc_sdio_init_card(host, host->card->ocr, host->card,
- mmc_card_keep_power(host));
+ mmc_send_if_cond(host, host->card->ocr);
+ err = mmc_send_io_op_cond(host, 0, NULL);
+ if (!err)
+ err = mmc_sdio_init_card(host, host->card->ocr,
+ host->card,
+ mmc_card_keep_power(host));
} else if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) {
/* We may have switched to 1-bit mode during suspend */
err = sdio_enable_4bit_bus(host->card);

2014-11-12 08:27:36

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 0/2] mmc: core: power-on sdio card correctly.

On 12 November 2014 04:55, NeilBrown <[email protected]> wrote:
> These two patches replace my previous patch
> [PATCH 2/2] mmc: core: reset sdio card properly on resume.
>
> The only change is to use host->card->ocr instead of
> host->ocr_avail, as recommend by Ulf.
>
> These restore my libertas wifi device properly on system
> resume.
>
> (I'm still hoping for a reply to my other patch:
> [PATCH 1/2] mmc: core: allow a reset gpio to be configured.

Working on a reply. Get back to you soon. :-)

> )
>
> Thanks,
> NeilBrown
>
> ---
>
> NeilBrown (2):
> mmc: core: use card->ocr when negotiating voltage setting in mmc_sdio_power_restore
> mmc: core: reset sdio card properly on resume.

Thanks! Applied for next!

Kind regards
Uffe

>
>
> drivers/mmc/core/sdio.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> --
> Signature
>