* [PATCH RFC 1/3] sdio: recognize io card without powercycle
@ 2009-09-07 18:46 Albert Herranz
2009-09-07 18:55 ` Michael Buesch
0 siblings, 1 reply; 5+ messages in thread
From: Albert Herranz @ 2009-09-07 18:46 UTC (permalink / raw)
To: bcm43xx-dev; +Cc: linux-mmc, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 12 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0116-sdio-recognize-io-card-without-powercycle.patch --]
[-- Type: text/x-patch; name="0116-sdio-recognize-io-card-without-powercycle.patch", Size: 3949 bytes --]
From 5c97462ae9188524faa0c57fa8b5bf8e9e0c125c Mon Sep 17 00:00:00 2001
From: Albert Herranz <albert_herranz@yahoo.es>
Date: Tue, 18 Aug 2009 21:06:32 +0200
Subject: [PATCH] sdio: recognize io card without powercycle
SDIO Simplified Specification (at least 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 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>
---
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 --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index d84c880..c768f70 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -890,6 +890,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 --git a/drivers/mmc/core/sdio_ops.c b/drivers/mmc/core/sdio_ops.c
index 4eb7825..14d3204 100644
--- a/drivers/mmc/core/sdio_ops.c
+++ b/drivers/mmc/core/sdio_ops.c
@@ -67,13 +67,13 @@ int mmc_send_io_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
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 *card, int write, unsigned fn,
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 *card, int write, unsigned fn,
}
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 *card, int write, unsigned fn,
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 *card, int write, unsigned fn,
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 --git a/drivers/mmc/core/sdio_ops.h b/drivers/mmc/core/sdio_ops.h
index e2e74b0..9b546c7 100644
--- a/drivers/mmc/core/sdio_ops.h
+++ b/drivers/mmc/core/sdio_ops.h
@@ -17,6 +17,7 @@ int mmc_io_rw_direct(struct mmc_card *card, int write, unsigned fn,
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
--
1.6.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH RFC 1/3] sdio: recognize io card without powercycle
2009-09-07 18:46 [PATCH RFC 1/3] sdio: recognize io card without powercycle Albert Herranz
@ 2009-09-07 18:55 ` Michael Buesch
2009-09-07 18:59 ` Chris Ball
0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2009-09-07 18:55 UTC (permalink / raw)
To: Albert Herranz; +Cc: bcm43xx-dev, linux-mmc, linux-wireless
On Monday 07 September 2009 20:46:58 Albert Herranz wrote:
>
>
Please submit this to the SDIO maintainer.
--
Greetings, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 1/3] sdio: recognize io card without powercycle
2009-09-07 18:55 ` Michael Buesch
@ 2009-09-07 18:59 ` Chris Ball
2009-09-07 19:05 ` Michael Buesch
0 siblings, 1 reply; 5+ messages in thread
From: Chris Ball @ 2009-09-07 18:59 UTC (permalink / raw)
To: Michael Buesch; +Cc: Albert Herranz, bcm43xx-dev, linux-mmc, linux-wireless
Hi Michael,
> Please submit this to the SDIO maintainer.
MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
S: Orphan
L: linux-mmc@vger.kernel.org
F: drivers/mmc/
F: include/linux/mmc/
So, these patches are in the right place.
- Chris.
--
Chris Ball <cjb@laptop.org>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 1/3] sdio: recognize io card without powercycle
2009-09-07 18:59 ` Chris Ball
@ 2009-09-07 19:05 ` Michael Buesch
2009-09-07 19:10 ` Ehud Gavron
0 siblings, 1 reply; 5+ messages in thread
From: Michael Buesch @ 2009-09-07 19:05 UTC (permalink / raw)
To: Chris Ball; +Cc: Albert Herranz, bcm43xx-dev, linux-mmc, linux-wireless
On Monday 07 September 2009 20:59:45 Chris Ball wrote:
> Hi Michael,
>
> > Please submit this to the SDIO maintainer.
>
> MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
> S: Orphan
> L: linux-mmc@vger.kernel.org
> F: drivers/mmc/
> F: include/linux/mmc/
>
> So, these patches are in the right place.
So who is going to pick it up? Just sending them to a random list is not
going to magically merge them into the kernel.
--
Greetings, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH RFC 1/3] sdio: recognize io card without powercycle
2009-09-07 19:05 ` Michael Buesch
@ 2009-09-07 19:10 ` Ehud Gavron
0 siblings, 0 replies; 5+ messages in thread
From: Ehud Gavron @ 2009-09-07 19:10 UTC (permalink / raw)
To: Michael Buesch
Cc: Chris Ball, linux-wireless, Albert Herranz, linux-mmc,
bcm43xx-dev
Michael Buesch wrote:
> On Monday 07 September 2009 20:59:45 Chris Ball wrote:
>
>> Hi Michael,
>>
>> > Please submit this to the SDIO maintainer.
>>
>> MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
>> S: Orphan
>> L: linux-mmc@vger.kernel.org
>> F: drivers/mmc/
>> F: include/linux/mmc/
>>
>> So, these patches are in the right place.
>>
>
> So who is going to pick it up? Just sending them to a random list is not
> going to magically merge them into the kernel.
>
>
This wouldn't happen if you were more human.
Did you see Stefanik crying at the bottom the stairway last night?
E
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-07 19:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07 18:46 [PATCH RFC 1/3] sdio: recognize io card without powercycle Albert Herranz
2009-09-07 18:55 ` Michael Buesch
2009-09-07 18:59 ` Chris Ball
2009-09-07 19:05 ` Michael Buesch
2009-09-07 19:10 ` Ehud Gavron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).