All of lore.kernel.org
 help / color / mirror / Atom feed
* + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
@ 2009-09-13 22:45 akpm
  2009-09-20  3:03 ` Chris Ball
  2010-03-05 22:25 ` Albert Herranz
  0 siblings, 2 replies; 8+ messages in thread
From: akpm @ 2009-09-13 22:45 UTC (permalink / raw)
  To: mm-commits; +Cc: albert_herranz, linux-mmc


The patch titled
     sdio: recognize io card without powercycle
has been added to the -mm tree.  Its filename is
     sdio-recognize-io-card-without-powercycle.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: sdio: recognize io card without powercycle
From: Albert Herranz <albert_herranz@yahoo.es>

SDIO Simplified Specification V2.00 states that it is strongly recommended
that the host executes either a power reset or issues a CMD52 (I/O Reset)
to re-initialize an I/O only card or the I/O portion of a combo card. 
Additionally, the CMD52 must be issued first because it cannot be issued
after a CMD0.

With this patch the Nintendo Wii SDIO-based WLAN card is detected after a
system reset, without requiring a complete system powercycle.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mmc/core/core.c     |    1 
 drivers/mmc/core/sdio_ops.c |   36 ++++++++++++++++++++++++++++------
 drivers/mmc/core/sdio_ops.h |    1 
 3 files changed, 32 insertions(+), 6 deletions(-)

diff -puN drivers/mmc/core/core.c~sdio-recognize-io-card-without-powercycle drivers/mmc/core/core.c
--- a/drivers/mmc/core/core.c~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/core.c
@@ -1073,6 +1073,7 @@ void mmc_rescan(struct work_struct *work
 	mmc_claim_host(host);
 
 	mmc_power_up(host);
+		sdio_reset(host);
 	mmc_go_idle(host);
 
 	mmc_send_if_cond(host, host->ocr_avail);
diff -puN drivers/mmc/core/sdio_ops.c~sdio-recognize-io-card-without-powercycle drivers/mmc/core/sdio_ops.c
--- a/drivers/mmc/core/sdio_ops.c~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/sdio_ops.c
@@ -67,13 +67,13 @@ int mmc_send_io_op_cond(struct mmc_host 
 	return err;
 }
 
-int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
-	unsigned addr, u8 in, u8* out)
+static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
+	unsigned addr, u8 in, u8 *out)
 {
 	struct mmc_command cmd;
 	int err;
 
-	BUG_ON(!card);
+	BUG_ON(!host);
 	BUG_ON(fn > 7);
 
 	/* sanity check */
@@ -90,11 +90,11 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	cmd.arg |= in;
 	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
 
-	err = mmc_wait_for_cmd(card->host, &cmd, 0);
+	err = mmc_wait_for_cmd(host, &cmd, 0);
 	if (err)
 		return err;
 
-	if (mmc_host_is_spi(card->host)) {
+	if (mmc_host_is_spi(host)) {
 		/* host driver already reported errors */
 	} else {
 		if (cmd.resp[0] & R5_ERROR)
@@ -106,7 +106,7 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	}
 
 	if (out) {
-		if (mmc_host_is_spi(card->host))
+		if (mmc_host_is_spi(host))
 			*out = (cmd.resp[0] >> 8) & 0xFF;
 		else
 			*out = cmd.resp[0] & 0xFF;
@@ -115,6 +115,13 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	return 0;
 }
 
+int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
+	unsigned addr, u8 in, u8 *out)
+{
+	BUG_ON(!card);
+	return mmc_io_rw_direct_host(card->host, write, fn, addr, in, out);
+}
+
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz)
 {
@@ -182,3 +189,20 @@ int mmc_io_rw_extended(struct mmc_card *
 	return 0;
 }
 
+int sdio_reset(struct mmc_host *host)
+{
+	int ret;
+	u8 abort;
+
+	/* SDIO Simplified Specification V2.0, 4.4 Reset for SDIO */
+
+	ret = mmc_io_rw_direct_host(host, 0, 0, SDIO_CCCR_ABORT, 0, &abort);
+	if (ret)
+		abort = 0x08;
+	else
+		abort |= 0x08;
+
+	ret = mmc_io_rw_direct_host(host, 1, 0, SDIO_CCCR_ABORT, abort, NULL);
+	return ret;
+}
+
diff -puN drivers/mmc/core/sdio_ops.h~sdio-recognize-io-card-without-powercycle drivers/mmc/core/sdio_ops.h
--- a/drivers/mmc/core/sdio_ops.h~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/sdio_ops.h
@@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	unsigned addr, u8 in, u8* out);
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
+int sdio_reset(struct mmc_host *host);
 
 #endif
 
_

Patches currently in -mm which might be from albert_herranz@yahoo.es are

linux-next.patch
sdio-recognize-io-card-without-powercycle.patch
sdio-pass-whitelisted-cis-funce-tuples-to-sdio-drivers.patch


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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2009-09-13 22:45 + sdio-recognize-io-card-without-powercycle.patch added to -mm tree akpm
@ 2009-09-20  3:03 ` Chris Ball
  2009-09-20  3:16   ` Andrew Morton
  2010-03-05 22:25 ` Albert Herranz
  1 sibling, 1 reply; 8+ messages in thread
From: Chris Ball @ 2009-09-20  3:03 UTC (permalink / raw)
  To: akpm; +Cc: albert_herranz, linux-mmc

Hi Andrew,

On Sun, Sep 13, 2009 at 03:45:04PM -0700, akpm@linux-foundation.org wrote:
> +++ a/drivers/mmc/core/core.c
> @@ -1073,6 +1073,7 @@ void mmc_rescan(struct work_struct *work
>  	mmc_claim_host(host);
>  
>  	mmc_power_up(host);
> +		sdio_reset(host);
>  	mmc_go_idle(host);

Looks like this hunk gained an extra tab on the way into -mm.

Thanks,

-- 
Chris Ball   <cjb@laptop.org>

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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2009-09-20  3:03 ` Chris Ball
@ 2009-09-20  3:16   ` Andrew Morton
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2009-09-20  3:16 UTC (permalink / raw)
  To: Chris Ball; +Cc: albert_herranz, linux-mmc

On Sun, 20 Sep 2009 04:03:13 +0100 Chris Ball <cjb@laptop.org> wrote:

> Hi Andrew,
> 
> On Sun, Sep 13, 2009 at 03:45:04PM -0700, akpm@linux-foundation.org wrote:
> > +++ a/drivers/mmc/core/core.c
> > @@ -1073,6 +1073,7 @@ void mmc_rescan(struct work_struct *work
> >  	mmc_claim_host(host);
> >  
> >  	mmc_power_up(host);
> > +		sdio_reset(host);
> >  	mmc_go_idle(host);
> 
> Looks like this hunk gained an extra tab on the way into -mm.
> 

yup, thanks, fixed.  A leftover from reject-fixing, I assume.

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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2009-09-13 22:45 + sdio-recognize-io-card-without-powercycle.patch added to -mm tree akpm
  2009-09-20  3:03 ` Chris Ball
@ 2010-03-05 22:25 ` Albert Herranz
  2010-03-05 22:39   ` Andrew Morton
  1 sibling, 1 reply; 8+ messages in thread
From: Albert Herranz @ 2010-03-05 22:25 UTC (permalink / raw)
  To: akpm; +Cc: linux-mmc

akpm@linux-foundation.org wrote:
> The patch titled
>      sdio: recognize io card without powercycle
> has been added to the -mm tree.  Its filename is
>      sdio-recognize-io-card-without-powercycle.patch
> 

Sorry, disregard my previous message. I replied to the wrong mail.
I meant _this_ patch: sdio-recognize-io-card-without-powercycle.patch

So... Now yes :)

Hi,

Are there any objections to this patch?

It's been in -mm now for nearly 6 months. AFAIK there's no report against it, and it fixes problems for at least 2 drivers:
- the Nintendo Wii SDHCI controller (for which the patch was cooked)
- the Silex's SX-SDWAG SDIO Wi-Fi card (http://marc.info/?l=linux-mmc&m=126624571025203)

Thanks,
Albert


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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2010-03-05 22:25 ` Albert Herranz
@ 2010-03-05 22:39   ` Andrew Morton
  2010-03-16 20:25     ` Pierre Ossman
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2010-03-05 22:39 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linux-mmc, Pierre Ossman

On Fri, 05 Mar 2010 23:25:54 +0100
Albert Herranz <albert_herranz@yahoo.es> wrote:

> akpm@linux-foundation.org wrote:
> > The patch titled
> >      sdio: recognize io card without powercycle
> > has been added to the -mm tree.  Its filename is
> >      sdio-recognize-io-card-without-powercycle.patch
> > 
> 
> Sorry, disregard my previous message. I replied to the wrong mail.
> I meant _this_ patch: sdio-recognize-io-card-without-powercycle.patch
> 
> So... Now yes :)
> 
> Hi,
> 
> Are there any objections to this patch?
> 
> It's been in -mm now for nearly 6 months. AFAIK there's no report against it, and it fixes problems for at least 2 drivers:
> - the Nintendo Wii SDHCI controller (for which the patch was cooked)
> - the Silex's SX-SDWAG SDIO Wi-Fi card (http://marc.info/?l=linux-mmc&m=126624571025203)
> 

I have a note here to check with Pierre, who said

: I had problems with cards already in the idle state crashing when I
: sent them a reset. I suggest a big round of testing before merging this.

I guess there's no more testing we can do so I'll merge it?

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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2010-03-05 22:39   ` Andrew Morton
@ 2010-03-16 20:25     ` Pierre Ossman
  2010-03-16 20:54       ` Nicolas Pitre
  0 siblings, 1 reply; 8+ messages in thread
From: Pierre Ossman @ 2010-03-16 20:25 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Albert Herranz, linux-mmc

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Fri, 5 Mar 2010 14:39:49 -0800
Andrew Morton <akpm@linux-foundation.org> wrote:

> 
> I have a note here to check with Pierre, who said
> 
> : I had problems with cards already in the idle state crashing when I
> : sent them a reset. I suggest a big round of testing before merging this.
> 
> I guess there's no more testing we can do so I'll merge it?

Sounds reasonable. Although the question is if anyone has -mm on a
system which lacks slot power control. :)

Rgds
-- 
     -- Pierre Ossman

  WARNING: This correspondence is being monitored by FRA, a
  Swedish intelligence agency. Make sure your server uses
  encryption for SMTP traffic and consider using PGP for
  end-to-end encryption.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
  2010-03-16 20:25     ` Pierre Ossman
@ 2010-03-16 20:54       ` Nicolas Pitre
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2010-03-16 20:54 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: Andrew Morton, Albert Herranz, linux-mmc

On Tue, 16 Mar 2010, Pierre Ossman wrote:

> On Fri, 5 Mar 2010 14:39:49 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> > 
> > I have a note here to check with Pierre, who said
> > 
> > : I had problems with cards already in the idle state crashing when I
> > : sent them a reset. I suggest a big round of testing before merging this.
> > 
> > I guess there's no more testing we can do so I'll merge it?
> 
> Sounds reasonable. Although the question is if anyone has -mm on a
> system which lacks slot power control. :)

I can positively tell you those do exist.


Nicolas

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

* + sdio-recognize-io-card-without-powercycle.patch added to -mm tree
@ 2009-09-11  3:40 akpm
  0 siblings, 0 replies; 8+ messages in thread
From: akpm @ 2009-09-11  3:40 UTC (permalink / raw)
  To: mm-commits; +Cc: albert_herranz, linux-mmc


The patch titled
     sdio: recognize io card without powercycle
has been added to the -mm tree.  Its filename is
     sdio-recognize-io-card-without-powercycle.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: sdio: recognize io card without powercycle
From: Albert Herranz <albert_herranz@yahoo.es>

SDIO Simplified Specification V2.00 states that it is strongly recommended
that the host executes either a power reset or issues a CMD52 (I/O Reset)
to re-initialize an I/O only card or the I/O portion of a combo card. 
Additionally, the CMD52 must be issued first because it cannot be issued
after a CMD0.

With this patch the Nintendo Wii SDIO-based WLAN card is detected after a
system reset, without requiring a complete system powercycle.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/mmc/core/core.c     |    1 
 drivers/mmc/core/sdio_ops.c |   36 ++++++++++++++++++++++++++++------
 drivers/mmc/core/sdio_ops.h |    1 
 3 files changed, 32 insertions(+), 6 deletions(-)

diff -puN drivers/mmc/core/core.c~sdio-recognize-io-card-without-powercycle drivers/mmc/core/core.c
--- a/drivers/mmc/core/core.c~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/core.c
@@ -1073,6 +1073,7 @@ void mmc_rescan(struct work_struct *work
 	mmc_claim_host(host);
 
 	mmc_power_up(host);
+	sdio_go_idle(host);
 	mmc_go_idle(host);
 
 	mmc_send_if_cond(host, host->ocr_avail);
diff -puN drivers/mmc/core/sdio_ops.c~sdio-recognize-io-card-without-powercycle drivers/mmc/core/sdio_ops.c
--- a/drivers/mmc/core/sdio_ops.c~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/sdio_ops.c
@@ -67,13 +67,13 @@ int mmc_send_io_op_cond(struct mmc_host 
 	return err;
 }
 
-int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
-	unsigned addr, u8 in, u8* out)
+static int mmc_io_rw_direct_host(struct mmc_host *host, int write, unsigned fn,
+	unsigned addr, u8 in, u8 *out)
 {
 	struct mmc_command cmd;
 	int err;
 
-	BUG_ON(!card);
+	BUG_ON(!host);
 	BUG_ON(fn > 7);
 
 	/* sanity check */
@@ -90,11 +90,11 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	cmd.arg |= in;
 	cmd.flags = MMC_RSP_SPI_R5 | MMC_RSP_R5 | MMC_CMD_AC;
 
-	err = mmc_wait_for_cmd(card->host, &cmd, 0);
+	err = mmc_wait_for_cmd(host, &cmd, 0);
 	if (err)
 		return err;
 
-	if (mmc_host_is_spi(card->host)) {
+	if (mmc_host_is_spi(host)) {
 		/* host driver already reported errors */
 	} else {
 		if (cmd.resp[0] & R5_ERROR)
@@ -106,7 +106,7 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	}
 
 	if (out) {
-		if (mmc_host_is_spi(card->host))
+		if (mmc_host_is_spi(host))
 			*out = (cmd.resp[0] >> 8) & 0xFF;
 		else
 			*out = cmd.resp[0] & 0xFF;
@@ -115,6 +115,13 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	return 0;
 }
 
+int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
+	unsigned addr, u8 in, u8 *out)
+{
+	BUG_ON(!card);
+	return mmc_io_rw_direct_host(card->host, write, fn, addr, in, out);
+}
+
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz)
 {
@@ -182,3 +189,20 @@ int mmc_io_rw_extended(struct mmc_card *
 	return 0;
 }
 
+int sdio_go_idle(struct mmc_host *host)
+{
+	int ret;
+	u8 abort;
+
+	/* SDIO Simplified Specification V2.0, 4.4 Reset for SDIO */
+
+	ret = mmc_io_rw_direct_host(host, 0, 0, SDIO_CCCR_ABORT, 0, &abort);
+	if (ret)
+		abort = 0x08;
+	else
+		abort |= 0x08;
+
+	ret = mmc_io_rw_direct_host(host, 1, 0, SDIO_CCCR_ABORT, abort, NULL);
+	return ret;
+}
+
diff -puN drivers/mmc/core/sdio_ops.h~sdio-recognize-io-card-without-powercycle drivers/mmc/core/sdio_ops.h
--- a/drivers/mmc/core/sdio_ops.h~sdio-recognize-io-card-without-powercycle
+++ a/drivers/mmc/core/sdio_ops.h
@@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *ca
 	unsigned addr, u8 in, u8* out);
 int mmc_io_rw_extended(struct mmc_card *card, int write, unsigned fn,
 	unsigned addr, int incr_addr, u8 *buf, unsigned blocks, unsigned blksz);
+int sdio_go_idle(struct mmc_host *host);
 
 #endif
 
_

Patches currently in -mm which might be from albert_herranz@yahoo.es are

linux-next.patch
sdio-recognize-io-card-without-powercycle.patch
sdio-pass-unknown-cis-tuples-to-sdio-drivers.patch


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

end of thread, other threads:[~2010-03-16 20:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-13 22:45 + sdio-recognize-io-card-without-powercycle.patch added to -mm tree akpm
2009-09-20  3:03 ` Chris Ball
2009-09-20  3:16   ` Andrew Morton
2010-03-05 22:25 ` Albert Herranz
2010-03-05 22:39   ` Andrew Morton
2010-03-16 20:25     ` Pierre Ossman
2010-03-16 20:54       ` Nicolas Pitre
  -- strict thread matches above, loose matches on Subject: below --
2009-09-11  3:40 akpm

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.