Re: rtsx_usb_sdmmc not detecting card insertion anymore

From: Ulf Hansson
Date: Tue Jun 27 2023 - 07:01:52 EST


+ Ricky WU, Kai Heng Feng, Oleksandr Natalenko

On Sat, 24 Jun 2023 at 22:39, Pascal Terjan <pterjan@xxxxxxxxx> wrote:
>
> Hi,
> I have an ASUS PN50 machine with a 0bda:0129 card reader. The card is
> not seen unless I reload the rtsx_usb_sdmmc module.

Thanks for reporting, let's see how we can move this forward.

I have looped in some of the people that has been involved in the
relevant changes for rtsx_usb. Let's see if they can help too.

>
> I found a Debian bug report for the same regression
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=993068 but nothing
> to see there.
>
> Trying to understand things I found
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4dad599b8b5d1ffc5ef12a2edb13d15d537202ba
> which seemed related, so I first tried to revert it and that worked.

Okay! That's certainly good information. Are you willing to help
running further debug testings?

Unless I mistaken, I think we should avoid doing a plain revert
(assuming we can find another option) as it will cause us to waste a
lot of energy instead.

>
> Assuming the description is correct and the rtsx USB driver runtime
> resumes the rtsx_usb_sdmmc device when it detects that a new card has
> been inserted, I assume this means it doesn't detect that a card was
> inserted and the problem would be in rtsx_usb rather than
> rtsx_usb_sdmmc.

There is also another interesting commit, which was also part of the
re-work of the rtsx_usb_sdmmc driver that you pointed to above.

commit 883a87ddf2f1 (misc: rtsx_usb: Use USB remote wakeup signaling
for card insertion detection")

>
> I am not sure how to debug this further, usbmon doesn't see anything
> when I insert the card.

If you are willing to run some tests, I suggest to add some debug prints in:
drivers/mmc/host/rtsx_usb_sdmmc.c
sdmmc_get_cd()
rtsx_usb_sdmmc_runtime_resume()
rtsx_usb_sdmmc_runtime_suspend()

sdmmc_get_cd() should be returning 1 when it finds that there is card
inserted, but of course the error path would be interesting too.

rtsx_usb_sdmmc_runtime_resume() may be called during probing of the
rtsx_usb_sdmmc driver. Beyond that point, it should also be called
when you insert an SD card. Just having a debug print in there should
help answer if that actually happens.

Kind regards
Uffe