A patch to compile the official realtek driver for RTS5227/5229 for linux 4.4.0 -> 4.7.0
Shell
Switch branches/tags
Nothing to show
Latest commit e0e064a Mar 26, 2017 @astyonax compiled for linux 4.10.2
Permalink
Failed to load latest commit information.
README.md compiled for linux 4.10.2 Mar 26, 2017
patch_linux_4.4.0.diff Done? Jan 21, 2016
run.sh proposed a way to solve the suspend issue Aug 13, 2016

README.md

Realtek SD/MMC card reader RTS5227/5229

The default driver in the ubuntu kernel for the Realtek card reader RTS5227 or RTS5229 does not work for all sd card.

Common symptoms are:

$lspci
...
Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5227 PCI Express Card Reader (rev 01)
...

$dmesg
...
[  251.004521] mmc0: cannot verify signal voltage switch
[  251.307113] mmc0: error -110 whilst initialising SD card
[  253.683004] mmc0: card never left busy state
[  253.683015] mmc0: error -110 whilst initialising SD card
[  256.062977] mmc0: card never left busy state
[  256.062988] mmc0: error -110 whilst initialising SD card
...

Often, some SD cards do not work with the default driver (in my case rtsx_pci). Not all cards trigger this error, but one of mine does (HAMA SDHC 16GB, class 10).

Patched driver

Official drivers can be downloaded from the Realtek website, but require some changes to compile in new kernels.

As I do not think I can distribute the realtek code, here I added the patch to compile the driver in Ubuntu 15.10/16.04.

I tested the compilation on:

  • Linux 4.10.2
  • Linux 4.9.0
  • Linux 4.7.0
  • Linux 4.6.3
  • Linux 4.4.0
  • Linux 4.3.3

NOTA BENE:

  1. I know nothing of how drivers work, I simply tried to correct the few compilation errors.
  2. Although everything seems to work fine in my machine, I do not guarantee that the changes I've done will not blow up your machine.

Usage

Sort of automatic

  1. Clone this repo
  2. Cd in the repo folder
  3. Unpack the drivers you get from Realtek (link [4])
  4. Cd in the drivers folder
  5. Type $bash ../run.sh, give root pw when asked

Manual

  1. Clone this repo & cd in the repo folder
  2. Download the driver source code from the Realtek website (Google or see link [4])
  3. Unpack and apply the patch: $ patch -i patch_linux_4.4.0.diff
  4. Compile and install: $ make && sudo make install && sudo depmod -a
  5. Try it. See link [2]
  6. Blacklist the default driver. In my case:
# echo 'blacklist rtsx_pci' >> /etc/modprobe.d/blacklist.conf
# update-initramfs -u
  1. Unload the module before suspend
echo SUSPEND_MODULES="rts5227" | sudo tee -a /etc/pm/config.d/modules

Relevant websites

Some changes to the code are peculiar of Linux 4.4, but many others were already reported:

  1. http://askubuntu.com/questions/473848/ubuntu-14-04-realtek-semiconductor-co-ltd-rts5227-pci-express-card-reader-isn
  2. https://abhinavgupta2812.wordpress.com/2014/01/28/getting-a-realtek-sd-card-reader-to-work-on-linux-tried-and-tested-on-debian/
  3. https://bbs.archlinux.org/viewtopic.php?id=124139

Link to the Realtek driver page for RTS5229 (I have RTS5227 but it seems to be working fine):

  1. http://www.realtek.com/Downloads/downloadsView.aspx?Langid=1&PNid=15&PFid=25&Level=4&Conn=3&DownTypeID=3&GetDown=false#2