]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: mmc_spi: Enable stable writes
authorAndreas Koop <andreas.koop@zf.com>
Mon, 22 Jul 2019 04:03:06 +0000 (12:03 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 22 Jul 2019 13:31:00 +0000 (15:31 +0200)
commit527025db9fe5d9d7f7d75049138902722948d83c
tree22ee0c8dea60b73b418f2c420cbb90887de0618a
parent2bc6275cde99275357ff760d17ac7d290f8894e8
mmc: mmc_spi: Enable stable writes

While using the mmc_spi driver occasionally errors like this popped up:

mmcblk0: error -84 transferring data end_request: I/O error, dev mmcblk0, sector 581756

I looked on the Internet for occurrences of the same problem and came
across a helpful post [1]. It includes source code to reproduce the bug.
There is also an analysis about the cause. During transmission data in the
supplied buffer is being modified. Thus the previously calculated checksum
is not correct anymore.

After some digging I found out that device drivers are supposed to report
they need stable writes. To fix this I set the appropriate flag at queue
initialization if CRC checksumming is enabled for that SPI host.

[1]
https://groups.google.com/forum/#!msg/sim1/gLlzWeXGFr8/KevXinUXfc8J

Signed-off-by: Andreas Koop <andreas.koop@zf.com>
[shihpo: Rebase on top of v5.3-rc1]
Signed-off-by: ShihPo Hung <shihpo.hung@sifive.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
CC: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/queue.c