Realtek SD reader mounting problems under Linux (Mint/Ubuntu)

This is a solution to SD mounting problems of a Realtek RTS5209 card read.
This affects my new Sony Vaio (SVE151G) with Linux Mint 15 but the solution can be extended to other operating systems/PCs (Ubuntu for example, and some HP notebooks).

Basically, when a SD card is inserted nothing happens… The device is not mounted and DMESG command says something like:

mmc0: error -110 whilst initialising SD card

This is how I solved the problem… :

Compile the Driver

A solution is to download the driver from Realtek website. The README says that all you need to do is

1) make
2) make install
3) depmod
4) reboot your computer

In my case, by the way, the make command ended up with a bunch of errors similar to this one :

rtsx.c:916:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rtsx_probe’

The strange thing is that the same driver compiled well in a different PC…
The solution to this problem is to remove __devinit keywords from rtsx.c file.
Open the file with a text editor and modify lines 916, 1080 and 1107:

static void __devexit rtsx_remove(struct pci_dev *pci) => static void  rtsx_remove(struct pci_dev *pci)

static int __devinit rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) => static int  rtsx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

.remove = __devexit_p(rtsx_remove), => .remove = rtsx_remove,

It is not a really clean and elegant solution but, at least, it works: the driver compiles !

Load the module

(this part is copied by the comment of Adam D (ethnoe) in this bug launchpad page)

It the installation procedure succeed, you can load the module:

sudo modprobe rts_pstor

Now check lspci -v, you should see something like:

03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
        Subsystem: Hewlett-Packard Company Device 1893
        Flags: bus master, fast devsel, latency 0, IRQ 43
        Memory at f6800000 (32-bit, non-prefetchable) [size=4K]
        Capabilities: [40] Power Management version 3
        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
        Capabilities: [70] Express Endpoint, MSI 00
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [140] Device Serial Number 00-00-00-01-00-4c-e0-00
        Kernel driver in use: rtsx_pci
        Kernel modules: rts_pstor, rtsx_pci

It means, that kernel is still using the wrong driver rtsx_pci, and not the just compiled rts_pstor.
Unload rtsx_pci:

sudo modprobe -r rtsx_pci
sudo depmod -a

if it doesn’t work, unload the dependencies as well:

sudo modprobe -r rtsx_pci_sdmmc
sudo modprobe -r rtsx_pci_ms
sudo modprobe -r rtsx_pci
sudo depmod -a

Now reload rts_pstor:

sudo modprobe -r rts_pstor
sudo modprobe rts_pstor

The reader should work like a charm now. You should blacklist rtsx_pci, so it won’t load after reboot. Just add

blacklist rtsx_pci

to /etc/modprobe.d/blacklist.conf and run

sudo update-initramfs -u

16 thoughts on “Realtek SD reader mounting problems under Linux (Mint/Ubuntu)

  1. EX-CE-LEN-TE !! muy buen tutorial , hasta el ultimo detalle ! gracias !

    Excellent , good work ! , very detailes and self explained , thanks you so much for your time and effort

  2. I have a HP computer. I tried your method and it worked perfectly, but after reboot it wouldn’t work anymore, and now if i give the lspci -v command, the card reader isn’t even listed… What should I do to fix it and make it work permanently? Please help me!😦

  3. EDIT: It works, but only if I insert the card before booting. Is there a way to make it work without having to reboot everytime I insert an SD card? I don’t know if it is useful, but I didn’t download and install the rts_pstor driver from the Realtek website since it was already installed in Ubuntu 12.04.

  4. Hi Dainaccio. I’m Marco as well, but a different Marco with a different netbook (acer aspire one d270) with Mint 15 xfce on it but with the same problem as my omonimous.

    ovvero:

    Your solution works like a charm, but after reboot it stops working. And when I type:

    lspci -v

    i get the following :
    03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
    Subsystem: Acer Incorporated [ALI] Device 061f
    Flags: bus master, fast devsel, latency 0, IRQ 18
    Memory at 83001000 (32-bit, non-prefetchable) [size=4K]
    Capabilities: [40] Power Management version 3
    Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [70] Express Endpoint, MSI 00
    Capabilities: [100] Advanced Error Reporting
    Capabilities: [140] Device Serial Number 00-00-00-01-00-4c-e0-00

    so NO kernel driver at all.

    Any idea?

    Grazie anticipatamente.

    m

  5. Thank you very much. That solution works on Mint 15 KDE. I had to change source also I blacklisted wrong modules. Now it works.

  6. Thank you for your comments, they’re really apreciated !🙂

    To Marco (1 & 2): sorry now it’s my sister’s notebook… 1000 km far from me. I can’t help you…😦

  7. @SamizdataDotOrg I got the same error. To fix it, I deleted the line .proc_name = .proc_name on line 274 of rtsx.c. After that, unload the dependencies and reload rts_pstor.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s