]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: core: Fixup support for writeback-cache for eMMC and SD
authorMichael Wu <michael@allwinnertech.com>
Thu, 31 Mar 2022 07:32:23 +0000 (15:32 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 4 Apr 2022 11:27:58 +0000 (13:27 +0200)
commit2d2297194c344daa541ad86d3fd1e0537d155ec7
tree08402b479f8f78572e79f923ce74d911bdd9e26d
parent66d03b8cf4b2877d6e19796bc5495af6d1768c09
mmc: core: Fixup support for writeback-cache for eMMC and SD

During the card initialization process, the mmc core checks whether the
eMMC/SD card supports an internal writeback-cache and then enables it
inside the card.

Unfortunately, this isn't according to what the mmc core reports to the
upper block layer. Instead, the writeback-cache support with REQ_FLUSH and
REQ_FUA, are being enabled depending on whether the host supports the CMD23
(MMC_CAP_CMD23) and whether an eMMC supports the reliable-write command.

This is wrong and it may also sound awkward. In fact, it's a remnant
from when both eMMC/SD cards didn't have dedicated commands/support to
control the internal writeback-cache. In other words, it was the best we
could do at that point in time.

To fix the problem, but also without breaking backwards compatibility,
let's align the REQ_FLUSH support with whether the writeback-cache became
successfully enabled - for both eMMC and SD cards.

Cc: stable@kernel.org
Fixes: 298e1e271844 ("mmc: core: Add cache control for eMMC4.5 device")
Fixes: bc80ad767cb7 ("mmc: core: Add support for cache ctrl for SD cards")
Depends-on: f1b951c981b4 ("mmc: block: Issue a cache flush only when it's enabled")
Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Michael Wu <michael@allwinnertech.com>
Link: https://lore.kernel.org/r/20220331073223.106415-1-michael@allwinnertech.com
[Ulf: Re-wrote the commit message]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/block.c