Skip to contentSkip to conversation

mmc: rtsx_pci_sdmmc: ignore broken write-protect on ThinkPad X260

PATCH In review Florian Maillard 2 participants 2 messages Aug 24 – Sep 10 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: rtsx_pci_sdmmc: ignore broken write-protect on ThinkPad X260

The Realtek RTS522A card reader in the Lenovo ThinkPad X260 (subsystem 17aa:504a) incorrectly reports inserted SD cards as write-protected.

This causes the MMC core to expose the card as read-only:

mmcblk0: mmc0:aaaa SN256 238 GiB (ro)

and /sys/block/mmcblk0/ro reports 1.

Setting MMC_CAP2_NO_WRITE_PROTECT makes the card writable again. Limit the quirk to the affected Lenovo subsystem.

Assisted-by ChatGPT:GPT-5.6 Sol
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +5 -0
index 8dfbc62f16..d25d4cb59b 100644
@@ -1425,6 +1425,11 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
 		mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
 	mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
 		MMC_CAP2_NO_SDIO;
+
+	if (pcr->pci->device == 0x522a &&
+	    pcr->pci->subsystem_vendor == PCI_VENDOR_ID_LENOVO &&
+	    pcr->pci->subsystem_device == 0x504a)
+		mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
 	mmc->max_current_330 = 400;
 	mmc->max_current_180 = 800;
 	mmc->ops = &realtek_pci_sdmmc_ops;

base-commit: 388b607d107c07aaade04c7f22f344cab6bdccd3

Signature · 1 line
2.47.3
#1 lore raw
Quoted 9 lines · Florian Maillard

The Realtek RTS522A card reader in the Lenovo ThinkPad X260 (subsystem 17aa:504a) incorrectly reports inserted SD cards as write-protected.

This causes the MMC core to expose the card as read-only:

mmcblk0: mmc0:aaaa SN256 238 GiB (ro)

Quoted 7 lines

and /sys/block/mmcblk0/ro reports 1.

Setting MMC_CAP2_NO_WRITE_PROTECT makes the card writable again. Limit the quirk to the affected Lenovo subsystem.

Assisted-by ChatGPT:GPT-5.6 Sol

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe

Quoted 27 lines
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/mmc/host/rtsx_pci_sdmmc.c +5 -0
index 8dfbc62f16..d25d4cb59b 100644
@@ -1425,6 +1425,11 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host)
                mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM;
        mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE |
                MMC_CAP2_NO_SDIO;
+
+       if (pcr->pci->device == 0x522a &&
+           pcr->pci->subsystem_vendor == PCI_VENDOR_ID_LENOVO &&
+           pcr->pci->subsystem_device == 0x504a)
+               mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
        mmc->max_current_330 = 400;
        mmc->max_current_180 = 800;
        mmc->ops = &realtek_pci_sdmmc_ops;

base-commit: 388b607d107c07aaade04c7f22f344cab6bdccd3 --
2.47.3