On Thu, Jul 1, 2021 at 4:27 PM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote: > On Thu, 1 Jul 2021 at 00:33, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote: > > > It looks like there are some race conditions in the HW busy detection > > > path for mmci, which gets triggered by this eMMC card. > > (...) > > > Although, it's more optimal to receive an IRQ when busy on DAT0 is > > > de-asserted, rather than polling with ->card_busy(). Hence we also > > > have MMC_CAP_WAIT_WHILE_BUSY. > > > > Hmmmmm it kind of assumes that DAT0 will be de-asserted *before* > > we get a command response, never after. I think that is what the card > > is doing. If that is out-of-spec then we need to have a quirk like > > this but if it is legal behaviour, we rather need to fix the mmci driver. > > That's correct and this could very well be the reason why polling > works better for this case. > > On the other hand, I am still a bit puzzled why the mmci driver hangs, > waiting for the busy completion IRQ to be raised. > > I did some more inspection of the code in ux500_busy_complete() and > found that there may be a potential race condition. I tried to fix it > up, but I don't know if it really makes any difference. Can you please > test the below patch and see if it helps. I tested it and sadly it does not help :( The system hangs on CMD6 after CMD18 as before. It looks like this with my debug prints: [ 53.940399] mmc_host mmc2: start CMD13 arg 00010000 [ 53.940490] mmc_host mmc2: start CMD18 arg 0000d010 [ 53.940765] mmc_host mmc2: start CMD18 arg 0000d028 [ 53.941162] mmc_host mmc2: start CMD18 arg 0000d048 [ 53.941864] mmc_host mmc2: start CMD18 arg 0000d088 [ 53.943878] mmc_host mmc2: start CMD18 arg 0000d108 [ 53.946563] mmc_host mmc2: start CMD18 arg 00004810 [ 53.947174] mmc_host mmc2: start CMD18 arg 00015018 [ 53.947357] mmc_host mmc2: start CMD18 arg 0005e078 [ 53.947845] mmc2: modify EXT_CSD, index 179, value: 1, set 1, timing 0 [ 53.947875] mmc_host mmc2: start CMD6 arg 03b30101 [ 53.947937] mmc2 modify EXT_CSD completed (0) [ 53.947967] mmc_host mmc2: start CMD13 arg 00010000 [ 53.948059] mmc_host mmc2: start CMD18 arg 00001c70 [ 53.948364] mmc2: modify EXT_CSD, index 179, value: 0, set 1, timing 0 [ 53.948394] mmc_host mmc2: start CMD6 arg 03b30001 [ 53.948455] mmc2 modify EXT_CSD completed (0) [ 53.948486] mmc_host mmc2: start CMD13 arg 00010000 [ 53.948516] mmc_host mmc2: start CMD18 arg 00004ff8 [ 53.949005] mmc_host mmc2: start CMD18 arg 0005e010 [ 53.949340] mmc_host mmc2: start CMD18 arg 0005e028 [ 53.949707] mmc_host mmc2: start CMD18 arg 0005e048 [ 53.950378] mmc_host mmc2: start CMD18 arg 0005e088 [ 53.951812] mmc_host mmc2: start CMD18 arg 0005e108 [ 53.954589] mmc_host mmc2: start CMD18 arg 00015038 [ 53.955047] mmc2: modify EXT_CSD, index 179, value: 1, set 1, timing 0 [ 53.955078] mmc_host mmc2: start CMD6 arg 03b30101 [ 53.955169] mmc2 modify EXT_CSD completed (0) [ 53.955169] mmc_host mmc2: start CMD13 arg 00010000 [ 53.955627] mmc_host mmc2: start CMD18 arg 00001c30 [ 53.956115] mmc2: modify EXT_CSD, index 179, value: 0, set 1, timing 0 [ 53.956146] mmc_host mmc2: start CMD6 arg 03b30001 Here it hangs forever, this last CMD6 never completes. Yours, Linus Walleij