From: Pierre Ossman <drzeus-list@drzeus.cx>
To: linux-kernel@vger.kernel.org, Russell King <rmk+lkml@arm.linux.org.uk>
Subject: [PATCH 3/3] MMC compatibility fix - OCR mask
Date: Sat, 18 Sep 2004 12:00:16 +0200 [thread overview]
Message-ID: <414C0730.3020503@drzeus.cx> (raw)
[-- Attachment #1: Type: text/plain, Size: 217 bytes --]
This patch avoids using a emtpy OCR mask for the initial power up. Since
some cards do not like a one bit-mask a routine has been added which
grows the mask to three bits (one extra bit on each side) if necessary.
[-- Attachment #2: mmc-ocr.patch --]
[-- Type: text/x-patch, Size: 1072 bytes --]
Index: linux-wbsd/drivers/mmc/mmc.c
===================================================================
--- linux-wbsd/drivers/mmc/mmc.c (revision 63)
+++ linux-wbsd/drivers/mmc/mmc.c (revision 64)
@@ -300,6 +300,31 @@
return ocr;
}
+/*
+ * Calculate a OCR mask to use for initial scanning.
+ * All zeroes and all ones cannot be used with some cards.
+ * Just on bit cannot be used either so extend the OCR
+ * if needed.
+ */
+
+static u32 mmc_select_scan_ocr(struct mmc_host *host)
+{
+ u32 ocr;
+
+ ocr = host->ocr_avail;
+
+ /* Check if we have more than one bit */
+ if (ocr & (ocr << 1))
+ return ocr;
+ if (ocr & (ocr >> 1))
+ return ocr;
+
+ /* Extend the mask to surrounding bits */
+ ocr |= (ocr << 1) | (ocr >> 1);
+
+ return ocr;
+}
+
static void mmc_decode_cid(struct mmc_cid *cid, u32 *resp)
{
memset(cid, 0, sizeof(struct mmc_cid));
@@ -589,7 +614,9 @@
mmc_power_up(host);
- err = mmc_send_op_cond(host, 0, &ocr);
+ ocr = mmc_select_scan_ocr(host);
+
+ err = mmc_send_op_cond(host, ocr, &ocr);
if (err != MMC_ERR_NONE)
return;
next reply other threads:[~2004-09-18 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-18 10:00 Pierre Ossman [this message]
2004-09-18 10:43 ` [PATCH 3/3] MMC compatibility fix - OCR mask Russell King
2004-09-18 11:06 ` Pierre Ossman
2004-09-18 11:21 ` Russell King
2004-09-18 11:30 ` Pierre Ossman
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=414C0730.3020503@drzeus.cx \
--to=drzeus-list@drzeus.cx \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/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.