Realtek RTS5209 PCI-E Card Reader only work if card is inserted before boot

gentoohardwarekernelrealteksd card

Hardware Info

  • Laptop Model: Sony Vaio Pro 13
  • Problematic Hardware: Bulti-in Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader

Problem description

Here is the problem, if I boot with my SD card inserted into the card reader, my Gentoo correctly load kernel module and detected SD card, assigned it to /dev/mmcblk0 according to dmesg output, XFCE also show an SD icon on desktop so I could mount it without any problem.

But if I boot without any SD card in card reader instead, and insert SD card after boot nothing happened. No SD card been detected, dmesg shows nothing.

Since SystemRescueCD (which is also based on Gentoo) correctly work as expected (boot without SD card inserted, insert SD card after boot, SystemResuceCD could detected it correctly and assign it to /dev/mmcblock0. So I guess I must miss some configuration on my Gentoo.

What have I tried

I tried to compare lsmod output from both configuration, and found if I boot with SD card inserted, the following additional kernel module will be loaded.

rtsx_pci_sdmmc         13679  0
rtsx_pci_ms             7218  0
mmc_core               91689  2 mmc_block,rtsx_pci_sdmmc
memstick                6896  1 rtsx_pci_ms
rtsx_pci               31487  2 rtsx_pci_ms,rtsx_pci_sdmmc 

I also confirmed these module been loaded after I insert my SD card into card reader when I using SystemRescueCD.

I also tried load these module manually on my Gentoo system, but nothing happens after I load them, no new print out in dmesg, still no SD card been detected.

lspci output

00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 09)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 09)
00:14.0 USB controller: Intel Corporation 8 Series USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation 8 Series HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation 8 Series HD Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 3 (rev e4)
00:1c.3 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 4 (rev e4)
00:1c.4 PCI bridge: Intel Corporation 8 Series PCI Express Root Port 6 (rev e4)
00:1d.0 USB controller: Intel Corporation 8 Series USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 8 Series LPC Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 8 Series SMBus Controller (rev 04)
01:00.0 Network controller: Intel Corporation Wireless 7260 (rev 6b)
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5209 PCI Express Card Reader (rev 01)
03:00.0 SATA controller: Samsung Electronics Co Ltd XP941 PCIe SSD (rev 01) 

Kernel configuration

  1. Everything inside MMC/SD/SDIO card support (except MMC debugging / MMC host clock gating / MMC host test driver) is compiled as kernel module.
  2. CONFIG_MEMSTICK=m
  3. CONFIG_MEMSTICK_REALTEK_PCI=m

I'm totally stuck and have no idea what next step should I take to fix this problem, where should I check now?

Best Answer

Figure out that I should enable the following kernel configurtion:

CONFIG_HOTPLUG_PCIE=y
CONFIG_HOTPLUG_PCI=y
CONFIG_HOTPLUG_PCI_ACPI=y

After added these three configuration based to my old config, everything is working as expected.

Related Question