From: Sean Rhodes <sean@starlabs.systems>
To: Ulf Hansson <ulfh@kernel.org>
Cc: Ricky Wu <ricky_wu@realtek.com>,
Avri Altman <avri.altman@sandisk.com>,
Sean Rhodes <sean@starlabs.systems>,
Jisheng Zhang <jszhang@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Dan Carpenter <error27@gmail.com>,
Binbin Zhou <zhoubinbin@loongson.cn>,
linux-mmc@vger.kernel.org, Huacai Chen <chenhuacai@kernel.org>,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
gregkh@linuxfoundation.org, arnd@arndb.de,
ulf.hansson@linaro.org, adrian.hunter@intel.com,
rogerable@realtek.com, matthew.schwartz@linux.dev
Subject: [RFC PATCH 0/2] mmc: rtsx_usb_sdmmc: qualify card-detect on tray readers
Date: Wed, 13 May 2026 12:40:11 +0100 [thread overview]
Message-ID: <cover.1778672403.git.sean@starlabs.systems> (raw)
Hi Uffe, USB/cardreader folks,
Uffe suggested sending this as an RFC and adding the USB/cardreader side,
because this may need input on where the media qualification should live.
I previously sent an RFC for the USB/cardreader runtime-PM side of this
problem. That did not get USB/cardreader-side guidance on the detect
layering question; the only substantive feedback was that the MMC child
should already own runtime PM for a real inserted card. I have since
retested that, and it is correct: with real media inserted,
rtsx_usb_sdmmc holds runtime_usage=1 and the USB parent remains active
through runtime_active_kids=1.
The remaining failure is narrower: empty tray only. Raw SD_CD remains
asserted, the MMC core repeatedly probes non-existent media, and the
runtime-PM hierarchy does not settle.
This is an RFC for the Realtek RTS5129 tray-reader false-detect issue.
Short version: on these machines, raw SD_CD is not a reliable "card is
present" signal. It is asserted when the tray is inserted, even if the tray
contains no SD card.
That means the current driver reports card-present to the MMC core for an
empty tray. The MMC core then does what it should do: it tries to initialize
a card. The commands time out, no mmcblk device is created, but because
SD_CD remains asserted the detect path is entered again. In practice this
keeps rtsx_usb_sdmmc runtime-active and prevents the USB parent from
autosuspending.
I retested this on an RTS5129 reader:
- tray removed: no mmcblk device, rtsx_usb_sdmmc suspends, USB parent
suspends
- empty tray inserted: no mmcblk device, repeated CMD0/CMD8/CMD55/CMD1
probe loop, rtsx_usb_sdmmc remains active, USB parent remains active
- tray + SD card: mmcblk0 appears and reads correctly; the MMC child
holds runtime PM as expected
The old Realtek rts5139 staging driver did not treat raw tray/CD state as
sufficient. It qualified insertion by checking whether media actually
responded before reporting a card present. That approach works on this
hardware, and avoids papering over the issue in runtime PM.
I know the previous version put the validation directly in ->get_cd(), and
the objection was that MMC command probing does not belong there. I'm not
trying to ignore that feedback. The question for this RFC is the layering:
- if the only exposed hardware bit is "tray inserted", not "card present",
where should the Realtek-specific media qualification live?
- is an rts5139-style qualification acceptable in rtsx_usb_sdmmc if it is
kept out of the generic MMC core?
- or should the USB/cardreader parent expose a qualified media-present
state to the SD/MMC child?
This is intentionally copied to linux-usb and the char/misc/cardreader
maintainers, not just linux-mmc, because one possible answer is that the
USB/cardreader parent should expose a qualified media-present state rather
than having rtsx_usb_sdmmc compensate for raw SD_CD.
Patch 2 keeps the validation path in a known initial electrical state by
starting SD power-up at 3.3V, matching the old Realtek rts5139 driver. It is
included because the validation sequence must not inherit a previous 1.8V
state.
I have deliberately left the SDR/UHS rate patches out of this RFC. They are
separate capability work and just make this harder to review. This series is
only about making tray card-detect correct and stopping the empty-tray detect
loop.
Thanks,
Sean
Sean Rhodes (2):
mmc: rtsx_usb_sdmmc: avoid false card-detect on tray readers
mmc: rtsx_usb_sdmmc: start card power-up at 3.3V
drivers/mmc/host/rtsx_usb_sdmmc.c | 161 ++++++++++++++++++++++++++++--
1 file changed, 153 insertions(+), 8 deletions(-)
next reply other threads:[~2026-05-13 11:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 11:40 Sean Rhodes [this message]
2026-05-13 11:40 ` [RFC PATCH 1/2] mmc: rtsx_usb_sdmmc: avoid false card-detect on tray readers Sean Rhodes
2026-05-13 11:40 ` [RFC PATCH 2/2] mmc: rtsx_usb_sdmmc: start card power-up at 3.3V Sean Rhodes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1778672403.git.sean@starlabs.systems \
--to=sean@starlabs.systems \
--cc=adrian.hunter@intel.com \
--cc=arnd@arndb.de \
--cc=avri.altman@sandisk.com \
--cc=chenhuacai@kernel.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jszhang@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=matthew.schwartz@linux.dev \
--cc=nathan@kernel.org \
--cc=ricky_wu@realtek.com \
--cc=rogerable@realtek.com \
--cc=ulf.hansson@linaro.org \
--cc=ulfh@kernel.org \
--cc=zhoubinbin@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.