linux-mips
[Top] [All Lists]

[PATCH] mmc: au1xmmc command types check from data flags

To: Pierre Ossman <drzeus@drzeus.cx>
Subject: [PATCH] mmc: au1xmmc command types check from data flags
From: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Date: Fri, 11 May 2007 19:29:48 +0900
Cc: yoichi_yuasa@tripeaks.co.jp, linux-mips@linux-mips.org
In-reply-to: <4643FD2B.8020103@drzeus.cx>
Organization: TriPeaks Corporation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070511125919.350c53a8.yoichi_yuasa@tripeaks.co.jp> <4643F57C.5060409@drzeus.cx> <200705110516.l4B5GMQJ053603@mbox33.po.2iij.net> <4643FD2B.8020103@drzeus.cx>
Sender: linux-mips-bounce@linux-mips.org
On Fri, 11 May 2007 07:20:43 +0200
Pierre Ossman <drzeus@drzeus.cx> wrote:

> Yoichi Yuasa wrote:
> > 
> > The commands of au1xmmc controller are different from standard commands. 
> > au1xmmc_send_command() convert standard commands to local commands for 
> > au1xmmc host controller,
> > and send local commands to controller.
> > 
> 
> A quick glance at the code seems to suggest it's specifying the type of 
> command.
> And it should be able to figure that out in a more generic way.

Ok, I updated the patch for au1xmmc.c .

This patch has changed command types check from data flags.

MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
SEND_STOP() is used for MMC_STOP_TRANSMISSION.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/drivers/mmc/host/au1xmmc.c 
mips/drivers/mmc/host/au1xmmc.c
--- mips-orig/drivers/mmc/host/au1xmmc.c        2007-05-11 10:27:01.068483750 
+0900
+++ mips/drivers/mmc/host/au1xmmc.c     2007-05-11 19:13:11.426283750 +0900
@@ -189,7 +189,7 @@ static void au1xmmc_tasklet_finish(unsig
 static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
                                struct mmc_command *cmd)
 {
-
+       unsigned int flags;
        u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
 
        switch (mmc_resp_type(cmd)) {
@@ -213,24 +213,17 @@ static int au1xmmc_send_command(struct a
                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:
-               mmccmd |= SD_CMD_CT_7;
-               break;
+       flags = cmd->data->flags;
+       if (flags & MMC_DATA_READ) {
+               if (flags & MMC_DATA_MULTI)
+                       mmccmd |= SD_CMD_CT_4;
+               else
+                       mmccmd |= SD_CMD_CT_2;
+       } else if (flags & MMC_DATA_WRITE) {
+               if (flags & MMC_DATA_MULTI)
+                       mmccmd |= SD_CMD_CT_3;
+               else
+                       mmccmd |= SD_CMD_CT_1;
        }
 
        au_writel(cmd->arg, HOST_CMDARG(host));

<Prev in Thread] Current Thread [Next in Thread>