Re: rtsx_usb_sdmmc not detecting card insertion anymore

From: Pascal Terjan
Date: Tue Jun 27 2023 - 16:29:20 EST


On Tue, 27 Jun 2023 at 14:23, Kai-Heng Feng <kai.heng.feng@xxxxxxxxxxxxx> wrote:
>
> On Tue, Jun 27, 2023 at 7:01 PM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
> >
> > + 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.
>
> Adding kernel parameter "usbcore.dyndbg" can also help, it will print
> out what's going on at USB side.

Nothing happens for that device (4-4), I only get others (1, 2, 3, 5,
7) waking up repeatedly:

[ 316.890285] usb usb7: usb auto-resume
[ 316.890322] hub 7-0:1.0: hub_resume
[ 316.912386] hub 7-0:1.0: state 7 ports 2 chg 0000 evt 0000
[ 316.912460] hub 7-0:1.0: hub_suspend
[ 316.912470] usb usb7: bus auto-suspend, wakeup 1
[ 316.912595] usb usb5: usb auto-resume
[ 316.912624] hub 5-0:1.0: hub_resume
[ 316.934386] hub 5-0:1.0: state 7 ports 2 chg 0000 evt 0000
[ 316.934460] hub 5-0:1.0: hub_suspend
[ 316.934471] usb usb5: bus auto-suspend, wakeup 1
[ 316.934595] usb usb3: usb auto-resume
[ 316.934609] hub 3-0:1.0: hub_resume
[ 316.956385] hub 3-0:1.0: state 7 ports 2 chg 0000 evt 0000
[ 316.956456] hub 3-0:1.0: hub_suspend
[ 316.956466] usb usb3: bus auto-suspend, wakeup 1
[ 316.956540] usb usb2: usb auto-resume
[ 316.956553] hub 2-0:1.0: hub_resume
[ 316.956576] hub 2-0:1.0: state 7 ports 2 chg 0000 evt 0000
[ 316.956594] hub 2-0:1.0: hub_suspend
[ 316.956600] usb usb2: bus auto-suspend, wakeup 1
[ 316.956626] usb usb1: usb auto-resume
[ 316.956662] hub 1-0:1.0: hub_resume
[ 316.956679] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000
[ 316.956697] hub 1-0:1.0: hub_suspend
[ 316.956703] usb usb1: bus auto-suspend, wakeup 1

The only time I get a log for it is when I reload the module with the
card in, and then eject the card:

[ 278.743368] usb 4-4: kworker/15:1 timed out on ep2in len=0/8