RTSX(4)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’³ RTSX(4) β€” Realtek SD card reader, but make it understood

okay bestie, so this is a kernel interfaces manual page for rtsx(4), and it's genuinely not that deep once I explain it. you got this πŸ’–


✨ NAME ✨

rtsx β€” the Realtek SD card reader driver. that's it. that's the whole vibe.


🌸 SYNOPSIS 🌸

so like, you want this bad boy inside your kernel? then drop these lines into the kernel configuration file, no cap:

device mmc
device mmcsd
device rtsx

or, alternatively, if you'd rather load it as a module at boot time β€” which, honestly, is giving ✨main character energy✨ β€” you put these into loader.conf(5):

mmc_load="YES"
mmcsd_load="YES"
rtsx_load="YES"

πŸŽ€ DESCRIPTION πŸŽ€

the rtsx driver provides support for the Realtek SD card reader. the way it works is genuinely so clean: the driver attaches the mmc bus on card insertion and detaches it on card removal. in and out, periodt. πŸ¦‹


πŸ‘‘ HARDWARE πŸ‘‘

the rtsx driver supports the following Realtek SD card readers, and I'm listing every single one because we don't skip:

  • RTS5209
  • RTS5227
  • RTS5229
  • RTS522A
  • RTS525A
  • RTS5260
  • RTL8411B
  • RTS5249 (unverified)
  • RTL8402 (unverified)
  • RTL8411 (unverified)
the three marked (unverified) are literally the original page saying "unverified" β€” I'm just the messenger, bestie πŸ’…

πŸ”— SEE ALSO πŸ”—

  • mmc(4)
  • mmcsd(4)
  • SD Specifications, Part 2, SD Host Controller, Simplified Specification
  • SanDisk Secure Digital Card

like, go read those if you want the full lore 🧚


πŸ¦‹ HISTORY πŸ¦‹

the rtsx driver appeared in FreeBSD 13.0 and was ported from OpenBSD with modifications found in Linux and NetBSD. so it's basically a collab across four operating systems β€” iconic behavior honestly 🌈


πŸ’œ AUTHORS πŸ’œ

shoutout to the people who actually built this:

  • Henri Hennebert <hlh@restart.be>
  • Gary Jennejohn <gj@freebsd.org>
  • Jesper Schmitz Mouridsen <jsm@FreeBSD.org>

🫢 CONTRIBUTORS 🫢

and one more legend:

  • Lutz Bichler <Lutz.Bichler@gmail.com>

πŸ”₯ DEBUGGING INFORMATION πŸ”₯

so if something's acting cursed, dev.rtsx.0.debug_mask can be set with the following masks β€” pick your fighter:

  • 0x01 β€” to show the basic flow of the driver,
  • 0x02 β€” to trace the SD commands,
  • 0x04 β€” to trace the tuning phase.

ngl this is genuinely such a cute little feature, iykyk πŸ“


πŸ’€ BUGS πŸ’€

okay. this is the part where you sit down and take notes, because some of this is actually scary 😭

  • RTS522A on Lenovo T470p: card detection and read-only switch are reversed. this is solved by adding in loader.conf(5):
dev.rtsx.0.inversion=1

the driver tries to automate those exceptions. if this automation is wrong, it can be avoided by adding in loader.conf(5):

dev.rtsx.0.inversion=0
  • Mounting a filesystem with write access on a card that's write protected may involve a kernel crash. yeah. a crash. like actually. be careful 🚨
  • Suspend/Resume do not work under MMCCAM. not great, not terrible, but definitely not great.
  • For some chips (e.g. RTS5260), after devctl disable/enable or kldunload/kldload, the driver can't detect a card correctly. so, something something, it gets confused. πŸ™ˆ

and that's the whole page, bestie!! no skipped flags, no skipped warnings, no skipped emails β€” we kept it all πŸ’–

this iconic little writeup came from the Debian edition of the manual, dated May 26, 2025, and it's filed under RTSX(4) in the Kernel Interfaces Manual β€” go forth and read your SD cards πŸŽ€βœ¨

πŸ“¦ where this page comes from