Realtek 5287 PCIe controller for memory card reader
April 28, 2015 3 Comments
Well, I finally got the memory card reader in my new Clevo W230SS laptop working, but, as is often the case with Linux, I’m not sure precisely which kernel configuration parameter or parameters are responsible.
By googling the device number given in the output from the lspci
command, I deduced that the memory card controller is the following PCIe device:
04:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. Device 5287 (rev 01)
The vendor ID for Realtek is 10ec
and the device ID is 5287
. By the way, PCIDatabase.com is a good resource if you need to research PCI devices.
I then rebuilt the kernel several times, changing various configuration parameters each time. One or more of them finally did the trick, but probably several are irrelevant. Anyway, below I summarise the current configuration.
$ uname -a
Linux clevow230ss 3.18.11-gentoo #20 SMP Tue Apr 28 05:48:42 BST 2015 x86_64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz GenuineIntel GNU/Linux
$ cat /usr/src/linux/.config | grep -i mmc
CONFIG_PCI_MMCONFIG=y
# Supported MMC/SDIO adapters
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_CLKGATE is not set
# MMC/SD/SDIO Card Drivers
CONFIG_MMC_BLOCK=m
CONFIG_MMC_BLOCK_MINORS=8
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_MMC_TEST is not set
# MMC/SD/SDIO Host Controller Drivers
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_RICOH_MMC=y
CONFIG_MMC_SDHCI_ACPI=m
CONFIG_MMC_SDHCI_PLTFM=m
CONFIG_MMC_WBSD=m
CONFIG_MMC_TIFM_SD=m
CONFIG_MMC_CB710=m
CONFIG_MMC_VIA_SDMMC=m
CONFIG_MMC_VUB300=m
CONFIG_MMC_USHC=m
CONFIG_MMC_USDHI6ROL0=m
CONFIG_MMC_REALTEK_PCI=m
As can be seen more clearly via menuconfig (see below), several of the Host Controller Drivers listed above are irrelevant because they are for other manufacturers’ controllers, not Realtek, but I have left them configured for the time being and will tidy up the configuration later.
--- MMC/SD/SDIO card support
[ ] MMC debugging
[ ] MMC host clock gating
*** MMC/SD/SDIO Card Drivers ***
<M> MMC block device driver
(8) Number of minors per block device
[*] Use bounce buffer for simple hosts
< > SDIO UART/GPS class support
< > MMC host test driver
*** MMC/SD/SDIO Host Controller Drivers ***
<M> Secure Digital Host Controller Interface support
<M> SDHCI support on PCI bus
[*] Ricoh MMC Controller Disabler
<M> SDHCI support for ACPI enumerated SDHCI controllers
<M> SDHCI platform and OF driver helper
<M> Winbond W83L51xD SD/MMC Card Interface support
<M> TI Flash Media MMC/SD Interface support
<M> ENE CB710 MMC/SD Interface support
<M> VIA SD/MMC Card Reader Driver
<M> VUB300 USB to SDIO/SD/MMC Host Controller support
<M> USB SD Host Controller (USHC) support
<M> Renesas USDHI6ROL0 SD/SDIO Host Controller support
<M> Realtek PCI-E SD/MMC Card Interface Driver
The card reader does not support the Sony Memory Stick format, so the configuration parameters mentioning ‘MEMSTICK
‘ that I selected may be irrelevant:
$ cat /usr/src/linux/.config | grep -i memstick
CONFIG_MEMSTICK=m
# CONFIG_MEMSTICK_DEBUG is not set
# CONFIG_MEMSTICK_UNSAFE_RESUME is not set
# CONFIG_MEMSTICK_TIFM_MS is not set
# CONFIG_MEMSTICK_JMICRON_38X is not set
# CONFIG_MEMSTICK_R592 is not set
CONFIG_MEMSTICK_REALTEK_PCI=m
I’m almost certain that CONFIG_MMC_REALTEK_PCI
needs to be selected, though:
$ cat /usr/src/linux/.config | grep -i realtek
CONFIG_NET_VENDOR_REALTEK=y
# CONFIG_SND_HDA_CODEC_REALTEK is not set
# CONFIG_USB_STORAGE_REALTEK is not set
CONFIG_MMC_REALTEK_PCI=m
CONFIG_MEMSTICK_REALTEK_PCI=m
I enabled some of the configuration parameters that mention ‘HOTPLUG
‘ because I came across an article regarding the Realtek RTS5209 PCIe card reader that enabled them:
$ cat /usr/src/linux/.config | grep -i hotplug
# CONFIG_MEMORY_HOTPLUG is not set
CONFIG_HOTPLUG_CPU=y
# CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set
# CONFIG_DEBUG_HOTPLUG_CPU0 is not set
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_HOTPLUG_PCI_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y
# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
I have no idea if the ‘Secure Digital Host Controller Interface’ is needed for the Realtek 5287, but I read some blogs and posts claiming it is needed for memory cards, so I selected it in the kernel configuration and included the module in /etc/conf.d/modules
:
$ cat /usr/src/linux/.config | grep -i sdhci
CONFIG_MMC_SDHCI=m
CONFIG_MMC_SDHCI_PCI=m
CONFIG_MMC_SDHCI_ACPI=m
CONFIG_MMC_SDHCI_PLTFM=m
I built the rts5208
module but, as that module is not loaded in my case (see the output of lsmod
further on), I assume it is actually irrelevant:
Device Drivers
---> Staging Drivers
---> Realtek PCI-E Card Reader RTS5208/5288 Support
$ cat /usr/src/linux/.config | grep -i rts5208
CONFIG_RTS5208=m
Below is the current output of the lsmod
command, showing which modules are actually loaded currently:
$ lsmod
Module Size Used by
nf_conntrack_ipv6 6211 4
nf_defrag_ipv6 22518 1 nf_conntrack_ipv6
nf_conntrack_ipv4 11296 8
nf_defrag_ipv4 1283 1 nf_conntrack_ipv4
xt_conntrack 3081 12
nf_conntrack_netbios_ns 1021 0
nf_conntrack_broadcast 1133 1 nf_conntrack_netbios_ns
nf_nat_ftp 1676 0
nf_nat 10540 1 nf_nat_ftp
nf_conntrack_ftp 6751 1 nf_nat_ftp
nf_conntrack 59239 8 nf_nat_ftp,nf_conntrack_netbios_ns,nf_nat,xt_conntrack,nf_conntrack_broadcast,nf_conntrack_ftp,nf_conntrack_ipv4,nf_conntrack_ipv6
sdhci_pci 10641 0
sdhci 22004 1 sdhci_pci
cifs 438492 0
mmc_block 25911 2
hidp 14125 0
rfcomm 32181 12
bnep 10116 2
fuse 76386 4
nvidia 8385213 33
ecb 1921 1
iwlmvm 143855 0
btusb 22292 0
bluetooth 281605 33 bnep,hidp,btusb,rfcomm
uvcvideo 71061 0
rtsx_pci_ms 5122 0
memstick 6256 1 rtsx_pci_ms
iwlwifi 75755 1 iwlmvm
r8169 67544 0
mii 3875 1 r8169
rtsx_pci_sdmmc 9905 0
rtsx_pci 26695 2 rtsx_pci_ms,rtsx_pci_sdmmc
videobuf2_vmalloc 2800 1 uvcvideo
videobuf2_memops 1799 1 videobuf2_vmalloc
videobuf2_core 34587 1 uvcvideo
mfd_core 3193 1 rtsx_pci
x86_pkg_temp_thermal 4567 0
And, finally, below you can see which modules I have explicitly specified to be loaded so far:
$ cat /etc/conf.d/modules
modules="r8169 nvidia agpgart fuse bnep rfcomm hidp uvcvideo cifs mmc_block sdhci-pci rtsx_pci"
Anyway, the important thing is that the laptop’s card reader is now working.