Re: [RFC PATCH] mmc: dw_mmc: add status check before clock update

Javier Martinez Canillas
2015-02-12T16:53:56Z

Hello Andrzej,

On Wed, Feb 11, 2015 at 10:06 AM, Andrzej Hajda <a.hajda@samsung.com> wrote:
> On 02/11/2015 09:32 AM, Jaehoon Chung wrote:
>> On 02/11/2015 04:51 PM, Andrzej Hajda wrote:
>>> Hi,
>>>
>>> Thanks for comments.
>>>
>>> On 02/10/2015 03:54 PM, Alim Akhtar wrote:
>>>> Hi Andrzej,
>>>>
>>>> On Tue, Feb 10, 2015 at 7:59 PM, Andrzej Hajda <a.hajda@samsung.com> wrote:
>>>>> According to specs for version 250A, status register should be
>>>>> tested before clock update. Otherwise in case MMC card is missing
>>>>> mci_send_cmd timeouts and subsequent CTYPE registry write causes system hang.
>>>>> This behavior has been observed on Exynos5422/Odroid-XU3.

I've also observed the same behavior (mmc command send timing out and
system hang) on an Exynos5420 Peach Pit Chromebook and an Exynos5800
Peach Pi Chromebok which both have the same dw_mmc 250A IP version.

Unfortunately $subject doesn't seem to be enough since even with that
applied I got:

[ 4.264418] mmc_host mmc1: Timeout sending command (cmd 0x202000
arg 0x0 status 0x80202000)
[ 4.283988] random: nonblocking pool is initialized
[ 28.054406] INFO: rcu_sched detected stalls on CPUs/tasks:
[ 28.058412] 0: (5 ticks this GP) idle=65f/140000000000001/0
softirq=215/216 fqs=39
[ 28.066129] (detected by 1, t=4765 jiffies, g=-294, c=-295, q=2)
[ 28.072202] Task dump for CPU 0:
[ 28.075412] kworker/u16:0 R running 0 6 2 0x00000002
[ 28.081749] Workqueue: kmmcd mmc_rescan
[ 28.085570] [<c04c2698>] (__schedule) from [<00000000>] ( (null))
[ 28.091724] rcu_sched kthread starved for 796 jiffies!

>>>>>
>>>>> +static bool dw_mci_wait_busy(struct dw_mci *host)
>>>>> +{
>>>>> + unsigned long timeout;
>>>>> +
>>>>> + if (host->verid < DW_MMC_250A)
>>>>> + return true;
>>>>> +
>>>> I wonder this might be true for 240A as well.
>>> Odroid-U3 board with Exynos4412 and MMC 240A does not have this problem.
>>> On the other side busy check does not hurt it anyway.

This problem also does not happen on an Exynos5250 Snow Chromebook
which has a dw_mmc IP version 241A.

>> Which kernel version do you use?
>> I also have the exynos5422 board, but i didn't find the below error yet.
>> It doesn't relate with IP version.
>> If you share your environment, i can check with exynos5422 board.
>
> linux-next on odroid-xu3. With MMC card removed, booting from sdcard.
> Please also note that broken-cd quirk is on in dts.
>

I tested by trying to add wifi support to the Peach Pit/Pi Chromebooks
which have an SDIO wifi chip attached to mmc@12210000. This [0] is the
patch I've on top of linux-next fwiw.

>>
>> I'm not sure but this patch could be dropped.
>> Because this patch is just only checking whether card is busy or not.
>>
>> this patch(mmc:dw_mmc: fix bug that case 'timeout sending command') can cover your patch.
>
> I will test it.
>

I tested it and although the mentioned patch does fix the mmc commands
send timing out, now card detection seems to not be working since the
kernel keeps waiting for aiting for root device /dev/mmcblk1p4...

and the this error is shown:

[ 4.249434] dwmmc_exynos 12210000.mmc: Data busy (status 0x306)

So I tried the other patch from Addy's series "mmc: dw_mmc: Don't
start command while data busy" but it did not have an effect. I still
see the data busy error and the uSD card is not detected.

Best regards,
Javier

[0]: http://paste.debian.net/plain/145877