2015-02-20 02:56:18

by addy ke

[permalink] [raw]
Subject: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture

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 <[email protected]>
---
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


2015-02-20 21:43:19

by Doug Anderson

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture

Addy,

On Thu, Feb 19, 2015 at 6:55 PM, Addy Ke <[email protected]> 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 <[email protected]>
> ---
> 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 <[email protected]>

On rk3288 on a 3.14 kernel w/ lotsa backports:
Tested-by: Doug Anderson <[email protected]>

2015-02-25 18:18:01

by Javier Martinez Canillas

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture

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 <[email protected]>

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 <[email protected]>

Best regards,
Javier

2015-02-27 07:11:15

by Jaehoon Chung

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: dw_mmc: fix bug that cause mmc_test failture

Hi,

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

Acked-by: Jaehoon Chung <[email protected]>

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 <[email protected]>
>
> 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 <[email protected]>
>
> Best regards,
> Javier
>