Bug 204003

Summary: RTS5229 built in card reader not detected after Linux 5.0.x
Product: Drivers Reporter: josiahspore
Component: MMC/SDAssignee: drivers_mmc-sd
Status: NEW ---    
Severity: high CC: david.lindstrom, scott
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 5.1.x, 5.2.x, 5.3.x Tree: Mainline
Regression: Yes
Attachments: kernel dmesg
cat of /proc/modules when stuck on initramfs
cpu info
lsmod on Manjaro
lspci -vvv on Manjaro
MMC trace on SD card insertion, kernel 5.0.13
MMC trace on SD card insertion, kernel 5.2.2

Description josiahspore 2019-06-27 04:32:51 UTC
Intel NUC NUC6CAYB's card reader acts is not detected after Linux 5.0.x. Everything is currently working just fine on 5.0.21 but I can't use anything higher because my system is installed on a sdcard. Anything higher than 5.0 causes my system to hang on finding root.
Comment 1 josiahspore 2019-06-27 04:33:19 UTC
Created attachment 283451 [details]
kernel dmesg
Comment 2 josiahspore 2019-06-27 04:34:17 UTC
Created attachment 283453 [details]
cat of /proc/modules when stuck on initramfs
Comment 3 josiahspore 2019-06-27 04:34:45 UTC
Created attachment 283455 [details]
cpu info
Comment 4 josiahspore 2019-06-27 04:35:32 UTC
Created attachment 283457 [details]
lsmod on Manjaro
Comment 5 josiahspore 2019-06-27 04:36:03 UTC
Created attachment 283459 [details]
lspci -vvv on Manjaro
Comment 6 josiahspore 2019-06-27 17:20:33 UTC
Another thing to add is that 5.1-rc1 is where the bug started.
Comment 7 David Lindstrom 2019-07-23 13:41:06 UTC
This bug is also present on the Intel NUC7CJYH board, which uses the RTS5229 PCI Express Card reader.
Kernel >= 5.1 fails to detect any SD card. Nothing shows up when running lsblk.

Also tried 
# udevadm monitor

while inserting a card. Still no output.
Downgrading the kernel to < 5.1 solves the problem.

I did a tracing of kernel mmc events on kernel 5.0.13 and 5.2.2, whilst inserting a card, see the attachments. 
According to the trace, all mmc requests return cmd_err=-110 on kernel 5.2.2.
Comment 8 David Lindstrom 2019-07-23 13:45:53 UTC
Created attachment 283931 [details]
MMC trace on SD card insertion, kernel 5.0.13

SD card is detected correctly on kernel 5.0.13
Obtained using:

echo 1 >  /sys/kernel/debug/tracing/events/mmc/enable 
cat /sys/kernel/debug/tracing/trace_pipe > mmc_trace.txt
Comment 9 David Lindstrom 2019-07-23 13:48:16 UTC
Created attachment 283933 [details]
MMC trace on SD card insertion, kernel 5.2.2

SD card is not detected on kernel 5.2.2
Obtained using:

echo 1 >  /sys/kernel/debug/tracing/events/mmc/enable 
cat /sys/kernel/debug/tracing/trace_pipe > mmc_trace.txt

Mmc requests return cmd_err -110
Comment 10 josiahspore 2019-10-07 06:25:47 UTC
Did a git bisect and found the culprit.

bede03a579b3b4a036003c4862cc1baa4ddc351f is the first bad commit
commit bede03a579b3b4a036003c4862cc1baa4ddc351f
Author: RickyWu <ricky_wu@realtek.com>
Date:   Tue Feb 19 20:49:58 2019 +0800

    misc: rtsx: Enable OCP for rts522a rts524a rts525a rts5260
    this enables and adds OCP function for Realtek A series cardreader chips
    and fixes some OCP flow in rts5260.c
    Signed-off-by: RickyWu <ricky_wu@realtek.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

:040000 040000 65bfdc473b7b85cb423ff528309fc92d73eae5b4 1292d8564f678027d0e5c77550e37d696b134b28 M	drivers

Just revert that and you'll be golden.

So somehow OCP got enabled for rts5229 unless a means rts522x. I guess they need to make sure its not enabled for 5229.
Comment 11 josiahspore 2019-10-07 06:32:35 UTC
I wounder if this has anything to do with that not working.
[    2.614469] mmc0: cannot verify signal voltage switch
Comment 12 Scott Brown 2020-05-17 18:51:25 UTC
Condition described in this bug is still present on NUC7PJYH with Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader. Now on kernel version 5.6.12.

The title is a bit misleading as the reader is detected in e.g. lspci, just card insertion doesn't cause anything to happen, nothing in dmesg, nothing in lsblk, as described above.

There was apparently commit bede03a579b3b4a036003c4862cc1baa4ddc351f singled out above. Is no one working on reverting this for the RTS5229? Can we get this assigned?