linux-mips
[Top] [All Lists]

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

To: Manuel Lauss <mano@roarinelk.homelinux.net>
Subject: Re: [PATCH] mmc: au1xmmc command types check from data flags
From: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Date: Fri, 11 May 2007 20:27:58 +0900
Cc: yoichi_yuasa@tripeaks.co.jp, drzeus@drzeus.cx, linux-mips@linux-mips.org
In-reply-to: <20070511110702.GA16041@roarinelk.homelinux.net>
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> <20070511192948.38937fd0.yoichi_yuasa@tripeaks.co.jp> <20070511110702.GA16041@roarinelk.homelinux.net>
Sender: linux-mips-bounce@linux-mips.org
Hi,

On Fri, 11 May 2007 13:07:02 +0200
Manuel Lauss <mano@roarinelk.homelinux.net> wrote:

> Hi Yoichi,
> 
> > --- 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
> > @@ -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;
>               ^^^^^^^^
> This line oopses the driver on my Au1200
> ->data can be NULL

Thank you testing the patch.

I don't have a db1200.
Please test new one.

> 
> > +   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;
> >     }
> 
> what about SD_CMD_CT_7?

MMC_STOP_TRANSMISSION is never passed to au1xmmc_send_command().
We don't need to care SD_CMD_CT_7 here.

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 20:15:50.358847000 
+0900
+++ mips/drivers/mmc/host/au1xmmc.c     2007-05-11 20:20:36.804748750 +0900
@@ -187,9 +187,8 @@ static void au1xmmc_tasklet_finish(unsig
 }
 
 static int au1xmmc_send_command(struct au1xmmc_host *host, int wait,
-                               struct mmc_command *cmd)
+                               struct mmc_command *cmd, unsigned int flags)
 {
-
        u32 mmccmd = (cmd->opcode << SD_CMD_CI_SHIFT);
 
        switch (mmc_resp_type(cmd)) {
@@ -213,24 +212,16 @@ 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;
+       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));
@@ -665,6 +656,7 @@ static void au1xmmc_request(struct mmc_h
 {
 
        struct au1xmmc_host *host = mmc_priv(mmc);
+       unsigned int flags = 0;
        int ret = MMC_ERR_NONE;
 
        WARN_ON(irqs_disabled());
@@ -677,11 +669,12 @@ static void au1xmmc_request(struct mmc_h
 
        if (mrq->data) {
                FLUSH_FIFO(host);
+               flags = mrq->data->flags;
                ret = au1xmmc_prepare_data(host, mrq->data);
        }
 
        if (ret == MMC_ERR_NONE)
-               ret = au1xmmc_send_command(host, 0, mrq->cmd);
+               ret = au1xmmc_send_command(host, 0, mrq->cmd, flags);
 
        if (ret != MMC_ERR_NONE) {
                mrq->cmd->error = ret;



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