All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@csr.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mmc@vger.kernel.org, "David Vrabel" <david.vrabel@csr.com>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Subject: [PATCH] mmc: avoid getting CID on SDIO-only cards
Date: Wed, 18 Aug 2010 17:29:04 +0000	[thread overview]
Message-ID: <1282152544-21275-1-git-send-email-david.vrabel@csr.com> (raw)

The introduction of support for SD combo cards breaks the initialization
of all CSR SDIO chips. The GO_IDLE (CMD0) in mmc_sd_get_cid() causes
CSR chips to be reset (this is non-standard behavior).

When initializing an SDIO card check for a combo card by using the
memory present bit in the R4 response to IO_SEND_OP_COND (CMD5).  This
avoids the call to mmc_sd_get_cid() on an SDIO-only card.

Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
---
Andrew, this is a regression in 2.6.36-rc1.  Please queue for 2.6.36 if
Michał acks it.
---
 drivers/mmc/core/sdio.c  |    8 +++++---
 include/linux/mmc/sdio.h |    2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index bd2755e..cc34523 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -362,11 +362,13 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 		goto err;
 	}
 
-	err = mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid);
-
-	if (!err) {
+	if (ocr & R4_MEMORY_PRESENT) {
 		card->type = MMC_TYPE_SD_COMBO;
 
+		err = mmc_sd_get_cid(host, host->ocr & ocr, card->raw_cid);
+		if (err)
+			goto remove;
+
 		if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
 		    memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
 			mmc_remove_card(card);
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 329a8fa..245cdac 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,8 @@
  *      [8:0] Byte/block count
  */
 
+#define R4_MEMORY_PRESENT (1 << 27)
+
 /*
   SDIO status in R5
   Type
-- 
1.6.3.3


             reply	other threads:[~2010-08-18 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-18 17:29 David Vrabel [this message]
2010-08-19 12:07 ` [PATCH] mmc: avoid getting CID on SDIO-only cards Michał Mirosław

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282152544-21275-1-git-send-email-david.vrabel@csr.com \
    --to=david.vrabel@csr.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.