Bug 217625 - Card no longer detected on 0bda:0129 if inserted after rtsx_usb_sdmmc is loaded
Summary: Card no longer detected on 0bda:0129 if inserted after rtsx_usb_sdmmc is loaded
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: MMC/SD (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: drivers_mmc-sd
Depends on:
Reported: 2023-07-02 11:45 UTC by Pascal Terjan
Modified: 2023-10-25 03:22 UTC (History)
2 users (show)

See Also:
Kernel Version:
Regression: No
Bisected commit-id:

Boot logs (199.04 KB, text/plain)
2023-07-02 11:45 UTC, Pascal Terjan
Boot logs (133.68 KB, text/plain)
2023-10-16 20:23 UTC, Pascal Terjan

Description Pascal Terjan 2023-07-02 11:45:18 UTC
Associated thread at  https://lore.kernel.org/lkml/CA+CX+bjcvbtW2Wto1XF1dKcAbpGGisdyHAGHX12v3TchhLbKtg@mail.gmail.com/

Creating this ticket to attach larger logs, as dmesg has already rotated when boot completes I extracted kernel logs from journalctl instead
Comment 1 Pascal Terjan 2023-07-02 11:45:49 UTC
Created attachment 304528 [details]
Boot logs
Comment 2 Kai-Heng Feng 2023-07-10 05:22:17 UTC
(In reply to Pascal Terjan from comment #1)
> Created attachment 304528 [details]
> Boot logs

Was the log collected after card got inserted?
Comment 3 Vasiliy Kovalev 2023-10-05 08:22:37 UTC
Most likely, the power saving of usb devices is disabled (usbcore.autosuspend=-1)
Check like this:
$ cat /sys/module/usbcore/parameters/autosuspend

(returns any negative number - means disabled)

In order for the detection of connected cards to work correctly for this chip, it is necessary to create a rule for enabling power saving:

sudo cat << EOF > /etc/udev/rules.d/10-RTS5129-autosuspend.rules
ACTION=="add" \
, ATTR{idProduct}=="0129" \
, ATTR{idVendor}=="0bda" \
, ATTR{power/autosuspend_delay_ms}="2" \
, ATTR{power/control}="on"

Comment 4 Pascal Terjan 2023-10-09 19:16:23 UTC
This doesn't seem to be the problem:

[pterjan@pn50 ~]$ cat /sys/module/usbcore/parameters/autosuspend
[pterjan@pn50 ~]$ cat /sys/bus/usb/devices/4-4/power/autosuspend
[pterjan@pn50 ~]$ cat /sys/bus/usb/devices/4-4/power/control 
Comment 5 Kai-Heng Feng 2023-10-16 01:40:08 UTC
Please add kernel parameter `usbcore.dyndbg`, reboot, reproduce the issue and attach dmesg here.

We may still need to poll the cards for special cases.
Comment 6 Pascal Terjan 2023-10-16 20:23:23 UTC
Created attachment 305235 [details]
Boot logs

Sorry I had missed the question in comment #2

I see no logs entries for that device when inserting the card, adding new logs when I also reload the module and it gets detected.

Inserted the card around ~100s after boot, then after nothing happened reloaded the module around ~140s after boot, and it got detected
Comment 7 Pascal Terjan 2023-10-16 20:27:45 UTC
I afterwards ejected the card and then I finally got a single log entry for that usb device:

[  660.951499] usb 4-4: kworker/0:0 timed out on ep2in len=0/8
[  660.952989] mmc0: card 59b4 removed
Comment 8 Kai-Heng Feng 2023-10-25 03:22:12 UTC
Please also add 'log_buf_len=16M' to kernel parameter so the message won't get truncated.

Please also attach `lsusb -t` and `sudo lspci -vv` here, thanks!

Note You need to log in before you can comment on or make changes to this bug.