From: Pierre Ossman <drzeus@drzeus.cx>
To: rmk+lkml@arm.linux.org.uk, jordan.crouse@amd.com
Cc: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [MMC] Minimise protocol awareness in Au1x00 driver
Date: Sat, 07 Jan 2006 00:40:13 +0100 [thread overview]
Message-ID: <20060106234012.31480.88314.stgit@poseidon.drzeus.cx> (raw)
The Au1x00 MMC/SD driver currently contains switch statements based on
protocol opcodes, not on desired behaviour.
Unfortunately the AMD specification is not detailed enough to determine
how the controller will behave for the response settings. For now, it will
have to suffice to warn when we have an unknown response type.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
---
drivers/mmc/au1xmmc.c | 41 ++++++++++++++++++++++++-----------------
1 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c
index aaf0463..23cdcac 100644
--- a/drivers/mmc/au1xmmc.c
+++ b/drivers/mmc/au1xmmc.c
@@ -207,26 +207,33 @@ static int au1xmmc_send_command(struct a
case MMC_RSP_R3:
mmccmd |= SD_CMD_RT_3;
break;
+ default:
+ printk(KERN_ERR "%s: Unsupported response type (%x).\n",
+ mmc_hostname(host->mmc), cmd->flags);
+ return MMC_ERR_INVALID;
}
- switch(cmd->opcode) {
- case MMC_READ_SINGLE_BLOCK:
- case SD_APP_SEND_SCR:
- mmccmd |= SD_CMD_CT_2;
- break;
- case MMC_READ_MULTIPLE_BLOCK:
- mmccmd |= SD_CMD_CT_4;
- break;
- case MMC_WRITE_BLOCK:
- mmccmd |= SD_CMD_CT_1;
- break;
-
- case MMC_WRITE_MULTIPLE_BLOCK:
- mmccmd |= SD_CMD_CT_3;
- break;
- case MMC_STOP_TRANSMISSION:
+ if (host->mrq->data && (host->mrq->data->stop == cmd))
mmccmd |= SD_CMD_CT_7;
- break;
+ else if (!cmd->data)
+ mmccmd |= SD_CMD_CT_0;
+ else {
+ if (cmd->data->stop) {
+ if (cmd->data->flags & MMC_DATA_WRITE)
+ mmccmd |= SD_CMD_CT_3;
+ else
+ mmccmd |= SD_CMD_CT_4;
+ } else if (cmd->data->blocks == 1) {
+ if (cmd->data->flags & MMC_DATA_WRITE)
+ mmccmd |= SD_CMD_CT_1;
+ else
+ mmccmd |= SD_CMD_CT_2;
+ } else {
+ printk(KERN_ERR "%s: Multi-block transfer without "
+ "a stop command is not supported.\n",
+ mmc_hostname(host->mmc));
+ return MMC_ERR_INVALID;
+ }
}
au_writel(cmd->arg, HOST_CMDARG(host));
next reply other threads:[~2006-01-06 23:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-06 23:40 Pierre Ossman [this message]
2006-01-06 23:43 ` Pierre Ossman
2006-01-07 1:01 ` Jordan Crouse
2006-01-07 1:09 ` 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=20060106234012.31480.88314.stgit@poseidon.drzeus.cx \
--to=drzeus@drzeus.cx \
--cc=drzeus-list@drzeus.cx \
--cc=jordan.crouse@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®