1926ce35aSJung-uk Kim.\" 2926ce35aSJung-uk Kim.\" Copyright (c) 2020 Henri Hennebert <hlh@restart.be> 3926ce35aSJung-uk Kim.\" All rights reserved. 4926ce35aSJung-uk Kim.\" 5926ce35aSJung-uk Kim.\" Redistribution and use in source and binary forms, with or without 6926ce35aSJung-uk Kim.\" modification, are permitted provided that the following conditions 7926ce35aSJung-uk Kim.\" are met: 8926ce35aSJung-uk Kim.\" 1. Redistributions of source code must retain the above copyright 9926ce35aSJung-uk Kim.\" notice, this list of conditions and the following disclaimer. 10926ce35aSJung-uk Kim.\" 2. The name of the author may not be used to endorse or promote products 11926ce35aSJung-uk Kim.\" derived from this software without specific prior written permission. 12926ce35aSJung-uk Kim.\" 13926ce35aSJung-uk Kim.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14926ce35aSJung-uk Kim.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15926ce35aSJung-uk Kim.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16926ce35aSJung-uk Kim.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17926ce35aSJung-uk Kim.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18926ce35aSJung-uk Kim.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19926ce35aSJung-uk Kim.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20926ce35aSJung-uk Kim.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21926ce35aSJung-uk Kim.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22926ce35aSJung-uk Kim.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23926ce35aSJung-uk Kim.\" SUCH DAMAGE. 24926ce35aSJung-uk Kim.\" 25*8290c144SHenri Hennebert.Dd April 26, 2022 26926ce35aSJung-uk Kim.Dt RTSX 4 27926ce35aSJung-uk Kim.Os 28926ce35aSJung-uk Kim.Sh NAME 29926ce35aSJung-uk Kim.Nm rtsx 30926ce35aSJung-uk Kim.Nd Realtek SD card reader 31926ce35aSJung-uk Kim.Sh SYNOPSIS 32926ce35aSJung-uk KimTo compile this driver into the kernel, place the following 33926ce35aSJung-uk Kimlines in the kernel configuration file: 34926ce35aSJung-uk Kim.Bd -ragged -offset indent 35*8290c144SHenri Hennebert.Cd device mmc 36*8290c144SHenri Hennebert.Cd device mmcsd 37*8290c144SHenri Hennebert.Cd device rtsx 38926ce35aSJung-uk Kim.Ed 39926ce35aSJung-uk Kim.Pp 40926ce35aSJung-uk KimAlternatively, to load the driver as a module at boot time, 41926ce35aSJung-uk Kimplace the following lines in 42926ce35aSJung-uk Kim.Xr loader.conf 5 : 43926ce35aSJung-uk Kim.Bd -literal -offset indent 44*8290c144SHenri Hennebert.Cd mmc_load="YES" 45*8290c144SHenri Hennebert.Cd mmcsd_load="YES" 46*8290c144SHenri Hennebert.Cd rtsx_load="YES" 47926ce35aSJung-uk Kim.Ed 48926ce35aSJung-uk Kim.Sh DESCRIPTION 49926ce35aSJung-uk KimThe 50926ce35aSJung-uk Kim.Nm 51926ce35aSJung-uk Kimdriver provides support for Realtek SD card reader. 52926ce35aSJung-uk KimDriver attaches mmc bus on card insertion and detaches it on card removing. 53926ce35aSJung-uk Kim.Sh HARDWARE 54926ce35aSJung-uk KimThe 55926ce35aSJung-uk Kim.Nm 56926ce35aSJung-uk Kimdriver supports different specification compatible chips. 57926ce35aSJung-uk KimThe following chips have been verified to work: 58926ce35aSJung-uk Kim.Pp 59926ce35aSJung-uk Kim.Bl -bullet -compact 60926ce35aSJung-uk Kim.It 61926ce35aSJung-uk KimRTS5209 62926ce35aSJung-uk Kim.It 63926ce35aSJung-uk KimRTS5227 64926ce35aSJung-uk Kim.It 65926ce35aSJung-uk KimRTS5229 66926ce35aSJung-uk Kim.It 67926ce35aSJung-uk KimRTS522A 68926ce35aSJung-uk Kim.It 69926ce35aSJung-uk KimRTS525A 70926ce35aSJung-uk Kim.It 71577130e5SHenri HennebertRTS5260 72577130e5SHenri Hennebert.It 73926ce35aSJung-uk KimRTL8411B 74926ce35aSJung-uk Kim.El 75926ce35aSJung-uk Kim.Pp 76926ce35aSJung-uk KimIt should also work for: 77926ce35aSJung-uk Kim.Pp 78926ce35aSJung-uk Kim.Bl -bullet -compact 79926ce35aSJung-uk Kim.It 80926ce35aSJung-uk KimRTS5249 81926ce35aSJung-uk Kim.It 82926ce35aSJung-uk KimRTL8402 83926ce35aSJung-uk Kim.It 84926ce35aSJung-uk KimRTL8411 85926ce35aSJung-uk Kim.El 86926ce35aSJung-uk Kim.Sh SEE ALSO 87926ce35aSJung-uk Kim.Xr mmc 4 , 88926ce35aSJung-uk Kim.Xr mmcsd 4 89926ce35aSJung-uk Kim.Rs 90926ce35aSJung-uk Kim.%T "SD Specifications, Part 2, SD Host Controller, Simplified Specification" 91926ce35aSJung-uk Kim.%T "SanDisk Secure Digital Card" 92926ce35aSJung-uk Kim.Re 93926ce35aSJung-uk Kim.Sh HISTORY 94926ce35aSJung-uk KimThe 95926ce35aSJung-uk Kim.Nm 96926ce35aSJung-uk Kimdriver was ported from 97926ce35aSJung-uk Kim.Ox 98926ce35aSJung-uk Kimwith modifications found in Linux and 99926ce35aSJung-uk Kim.Nx . 100926ce35aSJung-uk Kim.Sh AUTHORS 101926ce35aSJung-uk Kim.An Henri Hennebert Aq Mt hlh@restart.be 102926ce35aSJung-uk Kim.An Gary Jennejohn Aq Mt gj@freebsd.org 103926ce35aSJung-uk Kim.An Jesper Schmitz Mouridsen Aq Mt jsm@FreeBSD.org 104926ce35aSJung-uk Kim.Sh CONTRIBUTORS 105926ce35aSJung-uk Kim.An Lutz Bichler Aq Mt Lutz.Bichler@gmail.com 106577130e5SHenri Hennebert.Sh DEBUGGING INFORMATION 107577130e5SHenri Hennebert.Em dev.rtsx.0.debug_mask 108577130e5SHenri Hennebertcan be set with the following masks: 109926ce35aSJung-uk Kim.Bl -bullet 110926ce35aSJung-uk Kim.It 111577130e5SHenri Hennebert0x01 - to show the basic flow of the driver, 112577130e5SHenri Hennebert.It 113577130e5SHenri Hennebert0x02 - to trace the SD commands, 114577130e5SHenri Hennebert.It 115577130e5SHenri Hennebert0x04 - to trace the tuning phase. 116577130e5SHenri Hennebert.El 117577130e5SHenri Hennebert.Sh BUGS 118577130e5SHenri Hennebert.Bl -bullet 119926ce35aSJung-uk Kim.It 1209d3bc163SHenri HennebertRTS522A on Lenovo T470p, card detection and read-only switch are reversed. 1219d3bc163SHenri HennebertThis is solved by adding in 122926ce35aSJung-uk Kim.Em loader.conf(5) : 123926ce35aSJung-uk Kim.Bd -ragged 124926ce35aSJung-uk Kim.Cd dev.rtsx.0.inversion=1 125926ce35aSJung-uk Kim.Ed 1269d3bc163SHenri Hennebert.Pp 1279d3bc163SHenri HennebertThe driver tries to automate those exceptions. 1289d3bc163SHenri HennebertIf this automation is wrong, it can be avoided by adding in 1299d3bc163SHenri Hennebert.Em loader.conf(5) : 1309d3bc163SHenri Hennebert.Bd -ragged 1319d3bc163SHenri Hennebert.Cd dev.rtsx.0.inversion=0 1329d3bc163SHenri Hennebert.Ed 133926ce35aSJung-uk Kim.It 134926ce35aSJung-uk KimMounting a filesystem with write access on a card write protected may involve a kernel crash. 135926ce35aSJung-uk Kim.It 136926ce35aSJung-uk KimSuspend/Resume do not work under MMCCAM. 137*8290c144SHenri Hennebert.It 138*8290c144SHenri HennebertFor some chips (e.g. RTS5260) after 139*8290c144SHenri Hennebert.Cd devctl disable/enable 140*8290c144SHenri Hennebertor 141*8290c144SHenri Hennebert.Cd kldunload/kldload 142*8290c144SHenri Hennebertthe driver can't detect a card correctly. 143926ce35aSJung-uk Kim.El 144