6

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

5 Answers5

2

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 !

~~~~~

Adam
  • 487
  • 1
  • 3
  • 10
T. Delizy
  • 21
  • 1
2

Upstream rtsx_pci manages the card reader.

Still Something is wrong as I had to unload then reload the driver for it to work:

# modprobe -r rtsx_pci
# modprobe rtsx_pci

PS: I have not yet reported (or even checked the issue was already reported) to upstream. I hope to do it soon though feel free to beat me at that (the onyl requirement is to have hardware that reproduce the bug).

Here on Thinkpad Yoga S1 which also ship this device:

# lspci

05:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader (rev 01)
Subsystem: Lenovo Device 2217
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 75
Region 0: Memory at f0400000 (32-bit, non-prefetchable) [size=4K]
Capabilities: [40] Power Management version 3
    Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=375mA PME(D0-,D1+,D2+,D3hot+,D3cold+)
    Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Address: 00000000fee0f00c  Data: 41e2
Capabilities: [70] Express (v2) Endpoint, MSI 00
    DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
    DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
        RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
        MaxPayload 128 bytes, MaxReadReq 512 bytes
    DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
    LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s unlimited, L1 <64us
        ClockPM+ Surprise- LLActRep- BwNot-
    LnkCtl: ASPM L1 Enabled; RCB 64 bytes Disabled- CommClk-
        ExtSynch- ClockPM+ AutWidDis- BWInt- AutBWInt-
    LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
    DevCap2: Completion Timeout: Not Supported, TimeoutDis+, LTR+, OBFF Via message/WAKE#
    DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR+, OBFF Disabled
    LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
         Compliance De-emphasis: -6dB
    LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
         EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
Capabilities: [100 v2] Advanced Error Reporting
    UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
    UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
    CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
    CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
    AERCap: First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
Capabilities: [140 v1] Device Serial Number 00-00-00-01-00-4c-e0-00
Capabilities: [150 v1] Latency Tolerance Reporting
    Max snoop latency: 71680ns
    Max no snoop latency: 71680ns
Capabilities: [158 v1] L1 PM Substates
    L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1+ ASPM_L1.2+ ASPM_L1.1+ L1_PM_Substates+
          PortCommonModeRestoreTime=60us PortTPowerOnTime=60us
Kernel driver in use: rtsx_pci
1

it was the rts_pstor driver on my Debian system. took two rmmod/modprobe cycles to get it to work.

  • I confirm this works under Debian Stretch with a Lenovo T440s. Follow these instructions https://github.com/chrisnew/rts_pstor to build the rts_pstor module manually. It wasn't available by default on my Debian system. – Fred Schoen Oct 29 '17 at 15:08
0

I've tried above solution, but it doesn't worked on my Lenovo T540p and Linux Mint Mate 14.04 LTS. I've studied the kernel sources (header) and didn't find any solution. So I downloaded the stable kernel 19.1 from http://www.kernel.org and found in /usr/src/linux_19.1/drivers/mfd/ a file called rts5227.c. This file can be found since kernel version 3.9 and above.

I've decided to compile the new kernel incl. the original .config by using

make oldconfig
make menuconfig

Then I left the menuconfig after saving current configuration and compiled the kernel and modules:

make

To install modules:

sudo make modules_install

To install the new kernel and update Grub2

sudo make install

When everything is ready, reboot system (I had to reboot twice, 'cause first reboot ended up in the shell of initramfs (didn't find "dev by uuid"))

Now you should see your SD card inserted in SD slot. I have a PCIe USB 3.0 card in the PCIe slot and it is working now.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
-1

You can try following code for enable rtsx_pci module on boot.

echo "rtsx_pci" | sudo tee -a /etc/modules
Butterfly
  • 111