LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Addy Ke <addy.ke@rock-chips.com>
Cc: "Rob Herring" <robh+dt@kernel.org>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Seungwon Jeon" <tgih.jun@samsung.com>,
	"Jaehoon Chung" <jh80.chung@samsung.com>,
	"Chris Ball" <chris@printf.net>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Dinh Nguyen" <dinguyen@altera.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Olof Johansson" <olof@lixom.net>,
	"Sonny Rao" <sonnyrao@chromium.org>,
	"Alexandru Stan" <amstan@chromium.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"zhenfu.fang" <zhenfu.fang@rock-chips.com>,
	"Eddie Cai" <cf@rock-chips.com>, lintao <lintao@rock-chips.com>,
	chenfen <chenfen@rock-chips.com>, zyf <zyf@rock-chips.com>,
	"Jianqun Xu" <xjq@rock-chips.com>,
	"Tao Huang" <huangtao@rock-chips.com>, Chris <zyw@rock-chips.com>,
	姚智情 <yzq@rock-chips.com>, "Han Jiang" <hj@rock-chips.com>,
	"Kever Yang" <kever.yang@rock-chips.com>,
	zhangqing <zhangqing@rock-chips.com>,
	"Lin Huang" <hl@rock-chips.com>,
	"Alim Akhtar" <alim.akhtar@gmail.com>,
	"Javier Martinez Canillas" <javier.martinez@collabora.co.uk>
Subject: Re: [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture
Date: Thu, 19 Feb 2015 14:39:53 -0800	[thread overview]
Message-ID: <CAD=FV=Xxoo=HGhLad4pr=TKN7sWQ5Pzai=dGGvUUZe173DhLOA@mail.gmail.com> (raw)
In-Reply-To: <1422273849-29773-1-git-send-email-addy.ke@rock-chips.com>

Addy,

Your subject needs work.  It should at least touch on what the bug
was.  Please use a subject more like:
  mmc: dw_mmc: fix mmc_test by not sending abort for DRTO / EBE errors

On Mon, Jan 26, 2015 at 4:04 AM, Addy Ke <addy.ke@rock-chips.com> wrote:
> The STOP command can terminate a data transfer between a memory card and
> mmc controller.
>
> As show in Synopsys DesignWare Cores Mobile Stroage Host Databook:
> Data timeout and Data end-bit error will terminate further data transfer
> by mmc controller. So we should not send abort command to terminate a
> data transfer again if we got DRTO and EBE interrupt.

OK, I see this in the section "Error Detection".

Looking at the section titled "Error Handling" in the version of the
databook I see it suggesting "STOP or ABORT" in the case of Data
Errors which might include "end bit not found".  In another section
(the Card Interface Unit (CIU) section) it talks about the data end
bit error and suggests issuing the stop/abort command.

...that being said, it does appear that you're right that we don't
want to send an abort in the EBE case since it appears necessary to
fully fix mmc_test...

> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.

I didn't find this to be the case.  I asked Alexandru to
double-confirm for me and he agrees, it doesn't fix mmc_test.
Probably because your code is broken.  See below.


> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> ---
>  drivers/mmc/host/dw_mmc.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 4d2e3c2..4bd7df1 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1520,7 +1520,10 @@ static void dw_mci_tasklet_func(unsigned long priv)
>                         if (test_and_clear_bit(EVENT_DATA_ERROR,
>                                                &host->pending_events)) {
>                                 dw_mci_stop_dma(host);
> -                               send_stop_abort(host, data);
> +                               if (data->stop ||
> +                                   !(host->data_status & SDMMC_INT_DRTO) ||
> +                                   !(host->data_status & SDMMC_INT_EBE))
> +                                       send_stop_abort(host, data);

Your concept appears right, but your code is totally wrong.  Let's
imagine that data->stop is NULL so your check matters.  Now:

DRTO is set, EBE is set: you won't send stop abort
DRTO is set, EBE is _not_ set: you _will_ send stop aborft
DRTO is _not_ set, EBE is set: you _will_ send stop aborft

I can fix this with:

-                                   !(host->data_status & SDMMC_INT_DRTO) ||
-                                   !(host->data_status & SDMMC_INT_EBE))
+                                   !(host->data_status & (SDMMC_INT_DRTO |
+                                                          SDMMC_INT_EBE)))

When I do that then mmc_test is working much better.  Note that is
appears that both EBE and DRTO are necessary here.  Can you please
respin?  Please make sure to include Addy and Javier on your patch as
they may be able to do some extra testing.

-Doug

  parent reply	other threads:[~2015-02-19 22:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 12:04 Addy Ke
2015-02-10  9:34 ` Olof Johansson
2015-02-11  3:03   ` Addy
2015-02-19 22:39 ` Doug Anderson [this message]
2015-02-20  2:55 ` [PATCH v2] " Addy Ke
2015-02-20 21:43   ` Doug Anderson
2015-02-25 18:17   ` Javier Martinez Canillas
2015-02-27  7:11     ` Jaehoon Chung

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='CAD=FV=Xxoo=HGhLad4pr=TKN7sWQ5Pzai=dGGvUUZe173DhLOA@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=addy.ke@rock-chips.com \
    --cc=alim.akhtar@gmail.com \
    --cc=amstan@chromium.org \
    --cc=cf@rock-chips.com \
    --cc=chenfen@rock-chips.com \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@altera.com \
    --cc=galak@codeaurora.org \
    --cc=heiko@sntech.de \
    --cc=hj@rock-chips.com \
    --cc=hl@rock-chips.com \
    --cc=huangtao@rock-chips.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=javier.martinez@collabora.co.uk \
    --cc=jh80.chung@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=lintao@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=sonnyrao@chromium.org \
    --cc=tgih.jun@samsung.com \
    --cc=ulf.hansson@linaro.org \
    --cc=xjq@rock-chips.com \
    --cc=yzq@rock-chips.com \
    --cc=zhangqing@rock-chips.com \
    --cc=zhenfu.fang@rock-chips.com \
    --cc=zyf@rock-chips.com \
    --cc=zyw@rock-chips.com \
    --subject='Re: [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).