RE: [BUG] mmc: core: adjust polling interval for CMD1

From: Huijin Park
Date: Thu Mar 03 2022 - 07:16:46 EST


Hi, sorry for the late reply.
I guess the problem occurs depending on the eMMC model.
Because I tested again and there was no problem.
The eMMC model used for the test are as follows.
(THGBMJG6C1LBAIL, KLM8G1GETF-B041)
Anyway I guess the cause is interval time.
I wrote a debug patch assuming that the reason was that some mmc models
could not process CMD1 delivered at short intervals.
I copied the polling function and adds interval minimum time parameter.
I set the minimum time to 1ms. You can adjust it.
Please test if there is no problem with the debug patch.

>Hi,
>
>> Am 02.03.2022 um 09:20 schrieb Jean Rene Dawin <jdawin@xxxxxxxxxxxxxxxxxxxxx>:
>>
>> Ulf Hansson wrote on Tue 1/03/22 14:38:
>>> On Thu, 17 Feb 2022 at 21:12, H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
>>>>
>>>
>>> From: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
>>> Date: Tue, 1 Mar 2022 14:24:21 +0100
>>> Subject: [PATCH] mmc: core: Extend timeout to 2s for MMC_SEND_OP_COND
>>>
>>> It looks like the timeout for the MMC_SEND_OP_COND (CMD1) might have become
>>> a bit too small due to recent changes. Therefore, let's extend it to 2s,
>>> which is probably more inline with its previous value, to fix the reported
>>> timeout problems.
>>>
>>> While at it, let's add a define for the timeout value, rather than using
>>> a hard-coded value for it.
>>>
>>> Reported-by: Jean Rene Dawin <jdawin@xxxxxxxxxxxxxxxxxxxxx>
>>> Reported-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
>>> Cc: Huijin Park <huijin.park@xxxxxxxxxxx>
>>> Fixes: 76bfc7ccc2fa ("mmc: core: adjust polling interval for CMD1")
>>> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
>>> ---
>>> drivers/mmc/core/mmc_ops.c | 4 +++-
>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
>>> index d63d1c735335..1f57174b3cf3 100644
>>> --- a/drivers/mmc/core/mmc_ops.c
>>> +++ b/drivers/mmc/core/mmc_ops.c
>>> @@ -21,6 +21,7 @@
>>>
>>> #define MMC_BKOPS_TIMEOUT_MS (120 * 1000) /* 120s */
>>> #define MMC_SANITIZE_TIMEOUT_MS (240 * 1000) /* 240s */
>>> +#define MMC_OP_COND_TIMEOUT_MS 2000 /* 2s */
>>>
>>> static const u8 tuning_blk_pattern_4bit[] = {
>>> 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc,
>>> @@ -232,7 +233,8 @@ int mmc_send_op_cond(struct mmc_host *host, u32
>>> ocr, u32 *rocr)
>>> cmd.arg = mmc_host_is_spi(host) ? 0 : ocr;
>>> cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R3 | MMC_CMD_BCR;
>>>
>>> - err = __mmc_poll_for_busy(host, 1000, &__mmc_send_op_cond_cb, &cb_data);
>>> + err = __mmc_poll_for_busy(host, MMC_OP_COND_TIMEOUT_MS,
>>> + &__mmc_send_op_cond_cb, &cb_data);
>>> if (err)
>>> return err;
>>>
>>> --
>>> 2.25.1
>>
>> Hi,
>>
>> thanks. But testing with this patch still gives the same errors:
>>
>> [ 52.259940] mmc1: Card stuck being busy! __mmc_poll_for_busy
>> [ 52.273380] mmc1: error -110 doing runtime resume
>>
>> and the system gets stuck eventually.
>
>Same result from my tests.
>
>BR and thanks,
>Nikolaus