public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [MMC] Minimise protocol awareness in Au1x00 driver
@ 2006-01-06 23:40 Pierre Ossman
  2006-01-06 23:43 ` Pierre Ossman
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Ossman @ 2006-01-06 23:40 UTC (permalink / raw)
  To: rmk+lkml, jordan.crouse; +Cc: Pierre Ossman, linux-kernel

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));


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-01-07  1:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-06 23:40 [PATCH] [MMC] Minimise protocol awareness in Au1x00 driver Pierre Ossman
2006-01-06 23:43 ` Pierre Ossman
2006-01-07  1:01   ` Jordan Crouse
2006-01-07  1:09     ` Pierre Ossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox