From: "andrzej zaborowski" <balrog@zabor.org>
To: omap-linux <linux-omap-open-source@linux.omap.com>
Subject: [PATCH] fix MMC response types
Date: Fri, 24 Mar 2006 21:37:34 +0100 [thread overview]
Message-ID: <fb249edb0603241237l5854cc04k@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
Previously the MMC/SD protocol layer didn't provide command and
response types to mmc_omap_start_command(). In 2.6.16 it does and the
hack that tries to find the correct command/response types based on
flags is no longer needed.
This matters particularly for response types because for command types
this hack worked fine, while it failed to give correct response type
for some SD commands such as CMD3 (in most cases this caused no big
problems because the size of the response matched).
Regards,
Andrzej
--
balrog 2oo6
Dear Outlook users: Please remove me from your address books
http://www.newsforge.com/article.pl?sid=03/08/21/143258
[-- Attachment #2: omap-mmcsd.patch --]
[-- Type: application/octet-stream, Size: 1991 bytes --]
diff -pNaur linux-omap-2.6-orig/drivers/mmc/omap.c linux-omap-2.6/drivers/mmc/omap.c
--- linux-omap-2.6-orig/drivers/mmc/omap.c 2006-03-22 17:44:41.000000000 +0000
+++ linux-omap-2.6/drivers/mmc/omap.c 2006-03-22 21:34:36.000000000 +0000
@@ -185,39 +185,38 @@ mmc_omap_start_command(struct mmc_omap_h
host->hw_bus_mode = host->bus_mode;
}
- if (!(cmd->flags & MMC_RSP_PRESENT))
- resptype = 0; /* Resp 0 */
-
- if (cmd->flags & MMC_RSP_136)
- resptype = 2; /* Resp 2 */
- else {
- if (host->bus_mode == MMC_BUSMODE_OPENDRAIN)
- resptype = 3; /* Resp 3 */
- else
- resptype = 1; /* Resp 1, Resp 1b */
+ switch (mmc_resp_type(cmd)) {
+ case MMC_RSP_NONE:
+ /* Response type 0 */
+ break;
+ case MMC_RSP_R1:
+ case MMC_RSP_R1B:
+ resptype = 1;
+ break;
+ case MMC_RSP_R2:
+ resptype = 2;
+ break;
+ case MMC_RSP_R3:
+ resptype = 3;
+ break;
+ case MMC_RSP_R6:
+ resptype = 6;
+ break;
}
- /* Protocol layer does not provide command type, but our hardware
- * needs it!
- * any data transfer means adtc type (but that information is not
- * in command structure, so we flagged it into host struct.)
- * However, telling bc, bcr and ac apart based on response is
- * not foolproof:
- * CMD0 = bc = resp0 CMD15 = ac = resp0
- * CMD2 = bcr = resp2 CMD10 = ac = resp2
- *
- * Resolve to best guess with some exception testing:
- * resp0 -> bc, except CMD15 = ac
- * rest are ac, except if opendrain
- */
- if (host->data) {
+ switch (cmd->flags & MMC_CMD_MASK) {
+ case MMC_CMD_AC:
+ cmdtype = OMAP_MMC_CMDTYPE_AC;
+ break;
+ case MMC_CMD_ADTC:
cmdtype = OMAP_MMC_CMDTYPE_ADTC;
- } else if (resptype == 0 && cmd->opcode != 15) {
+ break;
+ case MMC_CMD_BC:
cmdtype = OMAP_MMC_CMDTYPE_BC;
- } else if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) {
+ break;
+ case MMC_CMD_BCR:
cmdtype = OMAP_MMC_CMDTYPE_BCR;
- } else {
- cmdtype = OMAP_MMC_CMDTYPE_AC;
+ break;
}
cmdreg = cmd->opcode | (resptype << 8) | (cmdtype << 12);
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
next reply other threads:[~2006-03-24 20:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-24 20:37 andrzej zaborowski [this message]
2006-03-27 12:46 ` [PATCH] fix MMC response types Carlos Aguiar
2006-03-27 20:04 ` andrzej zaborowski
2006-03-28 20:59 ` Carlos Aguiar
2006-03-29 23:29 ` lamikr
2006-03-31 17:35 ` lamikr
-- strict thread matches above, loose matches on Subject: below --
2006-03-27 12:56 Carlos Aguiar
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=fb249edb0603241237l5854cc04k@mail.gmail.com \
--to=balrog@zabor.org \
--cc=balrogg@gmail.com \
--cc=linux-omap-open-source@linux.omap.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox