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