mmc: core: Set read only for SD cards with permanent write protect bit
authorSeunghui Lee <sh043.lee@samsung.com>
Mon, 22 Feb 2021 08:31:56 +0000 (17:31 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 May 2021 08:40:15 +0000 (10:40 +0200)
commitc66b0d5e24034493f9deff22f24d414a2289ac1b
tree1f2e94ae640107632a6caf460e0a81e97eccff35
parent57859c635490c487380752d0db7fdb4e057f1e13
mmc: core: Set read only for SD cards with permanent write protect bit

commit 917a5336f2c27928be270226ab374ed0cbf3805d upstream.

Some of SD cards sets permanent write protection bit in their CSD register,
due to lifespan or internal problem. To avoid unnecessary I/O write
operations, let's parse the bits in the CSD during initialization and mark
the card as read only for this case.

Signed-off-by: Seunghui Lee <sh043.lee@samsung.com>
Link: https://lore.kernel.org/r/20210222083156.19158-1-sh043.lee@samsung.com
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/sd.c