Ubuntu – Ubuntu 14.04 Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader isn’t working

14.04card-readerrealteksd card

I've read some other posts issuing this problem. But without an solution for exactly this problem.
I've installed Ubuntu 14.04 on my Lenovo T440s.

Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader isn't working on it.

After I pushed a SD Card into the slot, nothing happened.

# lspci

02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader (rev 01)
    Subsystem: Lenovo Device 220c
    Flags: fast devsel, IRQ 16
    Memory at f0500000 (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
    Capabilities: [150] Latency Tolerance Reporting
    Capabilities: [158] L1 PM Substates

# lshw
    *-pci:0
         Beschreibung: PCI bridge
         Produkt: Lynx Point-LP PCI Express Root Port 6
         Hersteller: Intel Corporation
         Physische ID: 1c
         Bus-Informationen: pci@0000:00:1c.0
         Version: e4
         Breite: 32 bits
         Takt: 33MHz
         Fähigkeiten: pci pciexpress msi pm normal_decode bus_master cap_list
         Konfiguration: driver=pcieport
         Ressourcen: irq:17 memory:f0500000-f05fffff
       *-generic UNGEFORDERT
            Beschreibung: Unassigned class
            Produkt: RTS5227 PCI Express Card Reader
            Hersteller: Realtek Semiconductor Co., Ltd.
            Physische ID: 0
            Bus-Informationen: pci@0000:02:00.0
            Version: 01
            Breite: 32 bits
            Takt: 33MHz
            Fähigkeiten: pm msi pciexpress cap_list
            Konfiguration: latency=0
            Ressourcen: memory:f0500000-f0500fff

greetz

Best Answer

working on MSI GE60 I've got a Realtek Semiconductor Co., Ltd. RTS5227 working on windows but not in linux mint (based on ubuntu).

ATTENTION / IMPORTANT :

use this method can possibly induce the device to not recognize the card reader after a reboot. I've not understood yet what's going on but the device seems not able to enumerate on pci bus. I fixed that by cold boot on windows (with official driver).

I found some tutorials for rts5209 and tried to adapt them :

https://vidyut.net/realtek-sd-card-reader-working-ubuntu/

http://dainaccio.wordpress.com/2013/07/14/realtek-sd-reader-mounting-problems-under-linux-mintubuntu/#more-836

I took the sources for RTS5229 from realtek website (PCIE RTS5229 card reader driver for Linux) : no more than 2 links in my message, tutorials seems more important --> google

then I had do do a little more code modification than in the linked tutorials in rtcx.c in order to build without error : comment the declaration of proc_info in the rtsx_host_template initialization line 206.

(before)
.proc_info = proc_info, 

(after)
//.proc_info = proc_info,

once I get through this I built the driver and try to go with it, but obviously the link between driver and hardware was not there.

So I took the name of my device and try to modify the code in order to have the right device name. Go in the first lines (55) of rtsx.h and adapt the definition of the device name to your need :

(before)
#define CR_DRIVER_NAME "rts5229"

(after)
#define CR_DRIVER_NAME "rts5227"

After what I modified the target of the Makefile :

(before)
TARGET_MODULE := rts5229

(after)
TARGET_MODULE := rts5227

after what

make clean
make
sudo make install
sudo depmod
sudo modprobe rts5227

verify that your device is not using rtsx_pci module (lspci -v) if its the case you need to use the Dainaccio way to fix that (near the end of second tutorial).

when your module is correctly loaded a ls /dev should show you a new interface (for me /dev/sdb) :D

In fact that's not really clean.The thing is there should be a lot more understanding of the difference between the 2 card reader version and a lot more understanding of the driver to make that work fine.

The driver is basically functional, you can mount / unmount partition, write and read on the card, insertion and removal is detected. I have not tested the automount. But anyway a lspci -v with the driver working will show you that this solution is not clean : the peripheral class is not recognized so others values I think. By a brief look in the code I also saw many reference hard-coded to rts5229. they could be some work to be done...

anyway, have a nice day !

~~~~~

Related Question