]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: core: Add discard support to sd
authorAvri Altman <avri.altman@wdc.com>
Tue, 26 Feb 2019 15:10:24 +0000 (17:10 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 28 Feb 2019 08:16:12 +0000 (09:16 +0100)
commitd37309140d4d76b7935f21b19b24c77ba563c009
treee92d2e8012ac4753e98ad828a9d8d6f96fb969c8
parent4811146d0fe6e5d00473dd9888b7ffd51673acb6
mmc: core: Add discard support to sd

SD spec v5.1 adds discard support. The flows and commands are similar to
mmc, so just set the discard arg in CMD38.

A host which supports DISCARD shall check if the DISCARD_SUPPORT (b313)
is set in the SD_STATUS register.  If the card does not support discard,
the host shall not issue DISCARD command, but ERASE command instead.

Post the DISCARD operation, the card may de-allocate the discarded
blocks partially or completely. So the host mustn't make any assumptions
concerning the content of the discarded region. This is unlike ERASE
command, in which the region is guaranteed to contain either '0's or
'1's, depends on the content of DATA_STAT_AFTER_ERASE (b55) in the scr
register.

One more important difference compared to ERASE is the busy timeout
which we will address on the next patch.

Signed-off-by: Avri Altman <avri.altman@wdc.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/core.c
drivers/mmc/core/sd.c
include/linux/mmc/sd.h