Ubuntu – SD card doesn’t work well under Ubuntu, but does well under Windows

14.04dual-bootsd cardstoragewindows 7

I own a laptop with a built-in card reader. For the past year or so, I've been coping with a curious problem that seems more software related than hardware.

I run a dual-boot of Windows 7 and Ubuntu 14.04, both 64-bit. Under Windows, the SD card works just fine. It runs somewhat slow, but it always manages to complete without errors.

Under Ubuntu, it suddenly stops, and I get these messages when I type dmesg in a terminal:

[12535.092927] mmcblk0: mmc0:b368 SD    1.88 GiB 
[12535.096167]  mmcblk0: p1
[12653.904243] mmc0: Timeout waiting for hardware interrupt.
[12653.904974] mmcblk0: error -110 transferring data, sector 158279, nr 1024, cmd response 0x900, card status 0xc00
[12663.930682] mmc0: Timeout waiting for hardware interrupt.
[12663.930823] end_request: I/O error, dev mmcblk0, sector 158279
[12663.930838] end_request: I/O error, dev mmcblk0, sector 158287
[12663.930845] end_request: I/O error, dev mmcblk0, sector 158295
[12663.930852] end_request: I/O error, dev mmcblk0, sector 158303
[12663.930858] end_request: I/O error, dev mmcblk0, sector 158311
[12663.930864] end_request: I/O error, dev mmcblk0, sector 158319
[12663.930871] end_request: I/O error, dev mmcblk0, sector 158327
[12663.930877] end_request: I/O error, dev mmcblk0, sector 158335
[12663.930883] end_request: I/O error, dev mmcblk0, sector 158343
[12663.930889] end_request: I/O error, dev mmcblk0, sector 158351
[12673.957122] mmc0: Timeout waiting for hardware interrupt.
[12674.002269] mmcblk0: error -110 transferring data, sector 159303, nr 1024, cmd response 0x900, card status 0xc00

This happens with any SD card of any storage size, and it will happen at any time while transferring, especially with large files or large amounts of files. I have right-clicked on the SD card icon on my Ubuntu panel and clicked Safely remove before ejecting the SD, and have even reformatted the SD so that it was free of errors, but it still gives me problems. My USB flash drives are formatted in the same format (FAT32) as the SD card, and they all work fine. Why can Windows read/write to my card well and not Ubuntu?


Output oflspci (card readers only):

02:00.0 Ethernet controller: Broadcom Corporation NetLink BCM57785 Gigabit Ethernet PCIe (rev 10)
02:00.1 SD Host controller: Broadcom Corporation BCM57765/57785 SDXC/MMC Card Reader (rev 10)
02:00.2 System peripheral: Broadcom Corporation BCM57765/57785 MS Card Reader (rev 10)
02:00.3 System peripheral: Broadcom Corporation BCM57765/57785 xD-Picture Card Reader (rev 10)

Best Answer

I don't have your hardware, but had similar issues with Broadcom and their drivers. Very frustrating. That aside, this may well be worth a shot:

  1. Create a file and write this string into it options sdhci debug_quirks=0x40:

    sudo sh -c 'echo options sdhci debug_quirks=0x40 >> /etc/modprobe.d/sdhci-pci.conf'
    
  2. Now reboot, or reload the module:

    sudo modprobe -r sdhci-pci sdhci
    sudo modprobe sdhci-pci
    

The bug tracker mentioned that it may not give you full speed, but it's worth a try.

(From https://bugzilla.kernel.org/show_bug.cgi?id=73241 and http://www.linuxtechtips.com/2013/08/sd-mmc-ms-pro-card-reader-not-working.html)