mmc: core: Add support for cache ctrl for SD cards
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 11 May 2021 10:13:59 +0000 (12:13 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 14 Jun 2021 11:57:38 +0000 (13:57 +0200)
commit130206a615a9831a65e186484a5a332f9f6d29c8
tree01f0ca845b0b686d463180fb942b4f84fdc90577
parent34dd3ccccab0b93ebdf7ecde138814d121f72e98
mmc: core: Add support for cache ctrl for SD cards

In SD spec v6.x the SD function extension registers for performance
enhancements were introduced. As a part of this an optional internal cache
on the SD card, can be used to improve performance.

The let the SD card use the cache, the host needs to enable it and manage
flushing of the cache, so let's add support for this.

Note that for an SD card supporting the cache it's mandatory for it, to
also support the poweroff notification feature. According to the SD spec,
if the cache has been enabled and a poweroff notification is sent to the
card, that implicitly also means that the card should flush its internal
cache. Therefore, dealing with cache flushing for REQ_OP_FLUSH block
requests is sufficient.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20210511101359.83521-1-ulf.hansson@linaro.org
drivers/mmc/core/mmc_ops.c
drivers/mmc/core/mmc_ops.h
drivers/mmc/core/sd.c
include/linux/mmc/card.h