LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture
@ 2015-01-26 12:04 Addy Ke
  2015-02-10  9:34 ` Olof Johansson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Addy Ke @ 2015-01-26 12:04 UTC (permalink / raw)
  To: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
	rdunlap, tgih.jun, jh80.chung, chris, ulf.hansson, dinguyen,
	heiko, olof, dianders, sonnyrao, amstan
  Cc: devicetree, linux-doc, linux-kernel, linux-mmc, linux-arm-kernel,
	linux-rockchip, zhenfu.fang, cf, lintao, chenfen, zyf, xjq,
	huangtao, zyw, yzq, hj, kever.yang, zhangqing, hl, Addy Ke

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.

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

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);
 				state = STATE_DATA_ERROR;
 				break;
 			}
@@ -1547,7 +1550,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);
 				state = STATE_DATA_ERROR;
 				break;
 			}
-- 
1.8.3.2



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

* Re: [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-01-26 12:04 [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture Addy Ke
@ 2015-02-10  9:34 ` Olof Johansson
  2015-02-11  3:03   ` Addy
  2015-02-19 22:39 ` Doug Anderson
  2015-02-20  2:55 ` [PATCH v2] " Addy Ke
  2 siblings, 1 reply; 8+ messages in thread
From: Olof Johansson @ 2015-02-10  9:34 UTC (permalink / raw)
  To: Addy Ke, Ulf Hansson
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Seungwon Jeon, Jaehoon Chung, Chris Ball,
	Dinh Nguyen, Heiko Stübner, Doug Anderson, Sonny Rao,
	amstan, devicetree, linux-doc, linux-kernel, linux-mmc,
	linux-arm-kernel, linux-rockchip, zhenfu.fang, Eddie Cai, lintao,
	chenfen, zyf, xjq, huangtao, Chris Zhong, yzq, hj, Kever Yang,
	zhangqing, hl

Hi Addy,

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.
>
> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.
>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>

The drawback of having so many people on your to: list on a patch is
that it's unclear who you want to review and merge it. Sometimes less
is more.

In this case, it seems appropriate to have Ulf do so. Ulf, ping? This
seems like a reasonable patch for 3.20 given that it fixes undesired
behavior.


-Olof

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

* Re: [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-02-10  9:34 ` Olof Johansson
@ 2015-02-11  3:03   ` Addy
  0 siblings, 0 replies; 8+ messages in thread
From: Addy @ 2015-02-11  3:03 UTC (permalink / raw)
  To: Olof Johansson, Ulf Hansson
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Seungwon Jeon, Jaehoon Chung, Chris Ball,
	Dinh Nguyen, Heiko Stübner, Doug Anderson, Sonny Rao,
	amstan, devicetree, linux-doc, linux-kernel, linux-mmc,
	linux-arm-kernel, linux-rockchip, zhenfu.fang, Eddie Cai, lintao,
	chenfen, zyf, xjq, huangtao, Chris Zhong, yzq, hj, Kever Yang,
	zhangqing, hl


On 2015/02月10日 17:34, Olof Johansson wrote:
> Hi Addy,
>
> 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.
>>
>> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.
>>
>> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> The drawback of having so many people on your to: list on a patch is
> that it's unclear who you want to review and merge it. Sometimes less
> is more.
I will remove some unnecessary mail address from list in the following 
patch.
Thank you.
>
> In this case, it seems appropriate to have Ulf do so. Ulf, ping? This
> seems like a reasonable patch for 3.20 given that it fixes undesired
> behavior.
>
>
> -Olof
>
>
>



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

* Re: [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-01-26 12:04 [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture Addy Ke
  2015-02-10  9:34 ` Olof Johansson
@ 2015-02-19 22:39 ` Doug Anderson
  2015-02-20  2:55 ` [PATCH v2] " Addy Ke
  2 siblings, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2015-02-19 22:39 UTC (permalink / raw)
  To: Addy Ke
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Randy Dunlap, Seungwon Jeon, Jaehoon Chung, Chris Ball,
	Ulf Hansson, Dinh Nguyen, Heiko Stübner, Olof Johansson,
	Sonny Rao, Alexandru Stan, devicetree, linux-doc, linux-kernel,
	linux-mmc, linux-arm-kernel, open list:ARM/Rockchip SoC...,
	zhenfu.fang, Eddie Cai, lintao, chenfen, zyf, Jianqun Xu,
	Tao Huang, Chris, 姚智情,
	Han Jiang, Kever Yang, zhangqing, Lin Huang, Alim Akhtar,
	Javier Martinez Canillas

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

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

* [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-01-26 12:04 [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture Addy Ke
  2015-02-10  9:34 ` Olof Johansson
  2015-02-19 22:39 ` Doug Anderson
@ 2015-02-20  2:55 ` Addy Ke
  2015-02-20 21:43   ` Doug Anderson
  2015-02-25 18:17   ` Javier Martinez Canillas
  2 siblings, 2 replies; 8+ messages in thread
From: Addy Ke @ 2015-02-20  2:55 UTC (permalink / raw)
  To: ulf.hansson, jh80.chung, olof, heiko
  Cc: javier.martinez, huangtao, lintao, cf, linux-rockchip, linux-mmc,
	linux-kernel, linux-arm-kernel, Addy Ke

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.

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

Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
---
Changes in v2:
- DRTO and EBE are both set, should not send abort command too,
  suggested by Doug Anderson. 

 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..a27048a 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 |
+							   SDMMC_INT_EBE)))
+					send_stop_abort(host, data);
 				state = STATE_DATA_ERROR;
 				break;
 			}
@@ -1547,7 +1550,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 |
+							   SDMMC_INT_EBE)))
+					send_stop_abort(host, data);
 				state = STATE_DATA_ERROR;
 				break;
 			}
-- 
1.8.3.2



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

* Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-02-20  2:55 ` [PATCH v2] " Addy Ke
@ 2015-02-20 21:43   ` Doug Anderson
  2015-02-25 18:17   ` Javier Martinez Canillas
  1 sibling, 0 replies; 8+ messages in thread
From: Doug Anderson @ 2015-02-20 21:43 UTC (permalink / raw)
  To: Addy Ke
  Cc: Ulf Hansson, Jaehoon Chung, Olof Johansson, Heiko Stübner,
	Javier Martinez Canillas, Tao Huang, lintao, Eddie Cai,
	open list:ARM/Rockchip SoC...,
	linux-mmc, linux-kernel, linux-arm-kernel

Addy,

On Thu, Feb 19, 2015 at 6:55 PM, 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.
>
> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.
>
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> ---
> Changes in v2:
> - DRTO and EBE are both set, should not send abort command too,
>   suggested by Doug Anderson.
>
>  drivers/mmc/host/dw_mmc.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

I also suggested that you change the subject to "mmc: dw_mmc: fix
mmc_test by not sending abort for DRTO / EBE errors" which you didn't
do.  ...I guess that's not critical.  Perhaps Jaehoon (who is
collecting patches for Ulf now I think) can adjust the subject when he
applies.

In any case, v2 fixes my problems and seems OK to me.

Reviewed-by: Doug Anderson <dianders@chromium.org>

On rk3288 on a 3.14 kernel w/ lotsa backports:
Tested-by: Doug Anderson <dianders@chromium.org>

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

* Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture
  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
  1 sibling, 1 reply; 8+ messages in thread
From: Javier Martinez Canillas @ 2015-02-25 18:17 UTC (permalink / raw)
  To: Addy Ke, ulf.hansson, jh80.chung, olof, heiko
  Cc: huangtao, lintao, cf, linux-rockchip, linux-mmc, linux-kernel,
	linux-arm-kernel

Hello Addy,

On 02/20/2015 03:55 AM, Addy Ke 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:

s/Stroage/Storage but maybe Ulf can amend the typo when applying?

> 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.
> 
> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.
> 
> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>

I did not run all the tests listed in /sys/kernel/debug/mmc*/*/testlist
because some of them will overwrite the data in my card but at least
the read ones completed successfully and $subject does not cause a
regression in the Exynos5250 Snow, Exynos5420 Peach Pit and Exynos5800
Peach Pi Chromebooks where I tested it.

Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Best regards,
Javier

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

* Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture
  2015-02-25 18:17   ` Javier Martinez Canillas
@ 2015-02-27  7:11     ` Jaehoon Chung
  0 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2015-02-27  7:11 UTC (permalink / raw)
  To: Javier Martinez Canillas, Addy Ke, ulf.hansson, olof, heiko
  Cc: huangtao, lintao, cf, linux-rockchip, linux-mmc, linux-kernel,
	linux-arm-kernel

Hi,

I will apply into my-tree after change the subject and fix typo.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

On 02/26/2015 03:17 AM, Javier Martinez Canillas wrote:
> Hello Addy,
> 
> On 02/20/2015 03:55 AM, Addy Ke 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:
> 
> s/Stroage/Storage but maybe Ulf can amend the typo when applying?
> 
>> 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.
>>
>> After this patch, all mmc_test cases can pass on RK3288-Pink2 board.
>>
>> Signed-off-by: Addy Ke <addy.ke@rock-chips.com>
> 
> I did not run all the tests listed in /sys/kernel/debug/mmc*/*/testlist
> because some of them will overwrite the data in my card but at least
> the read ones completed successfully and $subject does not cause a
> regression in the Exynos5250 Snow, Exynos5420 Peach Pit and Exynos5800
> Peach Pi Chromebooks where I tested it.
> 
> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
> 
> Best regards,
> Javier
> 


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

end of thread, other threads:[~2015-02-27  7:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 12:04 [PATCH] mmc: dw_mmc: fix bug that cause mmc_test failture Addy Ke
2015-02-10  9:34 ` Olof Johansson
2015-02-11  3:03   ` Addy
2015-02-19 22:39 ` Doug Anderson
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

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