Fix Memory Card Errors in O2 Micro SD/MMC Card Reader on Thinkpads
Some micro SD cards fail to list their partitions and filesystems on Thinkpads with the O2 Micro SD card reader. This is apparently due to a bug/quirk in the Linux Kernel 4.4+. See here.
Verify that you have an O2 Micro, Inc. Micro SD card reader:$> lspci
03:00.0 SD Host controller: O2 Micro, Inc. SD/MMC Card Reader Controller (rev 01)
Try the temporary fix:
sudo rmmod sdhci_pci
sudo rmmod sdhci
sudo modprobe sdhci debug_quirks2="0x80000000"
sudo modprobe sdhci_pci
Try to use the micro SD card now.
If it works, make the fix permanent:
- Create file:
sudo vi /etc/modprobe.d/sdhci.conf
- Paste content:
options sdhci debug_quirks2="0x80000000"
- Regenerate initrd:
sudo update-initramfs -u -k all
- Reboot, or:
sudo rmmod sdhci-pci sdhci
sudo modprobe sdhci
sudo modprobe sdhci-pci
Background
I decided to get a larger micro SD card for my phone. I wanted to use the existing card as a swappable boot disk for the Renegade: setting up a btrfs
raid1 across two old USB drives. Current Linux Kernel on the micro SD has known btrfs issues, so I chose to have a separate instance. I have an ansible
playbook for the whole setup. Sounds easy enough?
Two very confusing things happened:
- Phone's microSD card (Samsung EVO) shows up as a single large partition with an
Unknown
filesystem. Any sort of read/write operation fails.
Nuking all data including partition table with:dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=32
....results in:dd: error writing '/dev/mmcblk0': Input/output error
Messages in dmesg
may even give you the impression that it's a card corruption issue. But since this card worked fine in my phone, I had some confidence that this was a card-reader issue. A Windows machine confirmed my suspicion.
[ 138.088577] print_req_error: I/O error, dev mmcblk0, sector 0
[ 138.141797] mmc0: Tuning timeout, falling back to fixed sampling clock
[ 138.141857] print_req_error: I/O error, dev mmcblk0, sector 1
[ 138.195188] mmc0: Tuning timeout, falling back to fixed sampling clock
[ 138.195252] print_req_error: I/O error, dev mmcblk0, sector 2
[ 138.251798] mmc0: Tuning timeout, falling back to fixed sampling clock
[ 138.251866] print_req_error: I/O error, dev mmcblk0, sector 6
[ 138.252500] Buffer I/O error on dev mmcblk0, logical block 0, async page read
2. Brand new microSD card is dead on arrival. The card, purchased from Flipkart, has scratches and appears used. Does not work in any laptop or phone. Any attempt to format fails.