1.\" 2.\" SPDX-License-Identifier: BSD-2-Clause 3.\" 4.\" Copyright (c) 2020 Henri Hennebert <hlh@restart.be> 5.\" All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. The name of the author may not be used to endorse or promote products 13.\" derived from this software without specific prior written permission. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25.\" SUCH DAMAGE. 26.\" 27.Dd May 26, 2025 28.Dt RTSX 4 29.Os 30.Sh NAME 31.Nm rtsx 32.Nd Realtek SD card reader 33.Sh SYNOPSIS 34To compile this driver into the kernel, place the following 35lines in the kernel configuration file: 36.Bd -ragged -offset indent 37.Cd device mmc 38.Cd device mmcsd 39.Cd device rtsx 40.Ed 41.Pp 42Alternatively, to load the driver as a module at boot time, 43place the following lines in 44.Xr loader.conf 5 : 45.Bd -literal -offset indent 46.Cd mmc_load="YES" 47.Cd mmcsd_load="YES" 48.Cd rtsx_load="YES" 49.Ed 50.Sh DESCRIPTION 51The 52.Nm 53driver provides support for Realtek SD card reader. 54Driver attaches mmc bus on card insertion and detaches it on card removing. 55.Sh HARDWARE 56The 57.Nm 58driver supports the following Realtek SD card readers: 59.Pp 60.Bl -bullet -compact 61.It 62RTS5209 63.It 64RTS5227 65.It 66RTS5229 67.It 68RTS522A 69.It 70RTS525A 71.It 72RTS5260 73.It 74RTL8411B 75.It 76RTS5249 (unverified) 77.It 78RTL8402 (unverified) 79.It 80RTL8411 (unverified) 81.El 82.Sh SEE ALSO 83.Xr mmc 4 , 84.Xr mmcsd 4 85.Rs 86.%T "SD Specifications, Part 2, SD Host Controller, Simplified Specification" 87.%T "SanDisk Secure Digital Card" 88.Re 89.Sh HISTORY 90The 91.Nm 92driver appeared in 93.Fx 13.0 94and was ported from 95.Ox 96with modifications found in Linux and 97.Nx . 98.Sh AUTHORS 99.An Henri Hennebert Aq Mt hlh@restart.be 100.An Gary Jennejohn Aq Mt gj@freebsd.org 101.An Jesper Schmitz Mouridsen Aq Mt jsm@FreeBSD.org 102.Sh CONTRIBUTORS 103.An Lutz Bichler Aq Mt Lutz.Bichler@gmail.com 104.Sh DEBUGGING INFORMATION 105.Em dev.rtsx.0.debug_mask 106can be set with the following masks: 107.Bl -bullet 108.It 1090x01 - to show the basic flow of the driver, 110.It 1110x02 - to trace the SD commands, 112.It 1130x04 - to trace the tuning phase. 114.El 115.Sh BUGS 116.Bl -bullet 117.It 118RTS522A on Lenovo T470p, card detection and read-only switch are reversed. 119This is solved by adding in 120.Em loader.conf(5) : 121.Bd -ragged 122.Cd dev.rtsx.0.inversion=1 123.Ed 124.Pp 125The driver tries to automate those exceptions. 126If this automation is wrong, it can be avoided by adding in 127.Em loader.conf(5) : 128.Bd -ragged 129.Cd dev.rtsx.0.inversion=0 130.Ed 131.It 132Mounting a filesystem with write access on a card write protected may involve a kernel crash. 133.It 134Suspend/Resume do not work under MMCCAM. 135.It 136For some chips (e.g. RTS5260) after 137.Cd devctl disable/enable 138or 139.Cd kldunload/kldload 140the driver can't detect a card correctly. 141.El 142