[PATCH] [MMC] Minimise protocol awareness in Au1x00 driver

From: Pierre Ossman
Date: Fri Jan 06 2006 - 18:39:08 EST


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@xxxxxxxxx>
---

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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/