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.\" 25926ce35aSJung-uk Kim.\" $FreeBSD$ 26926ce35aSJung-uk Kim.\" 27*8290c144SHenri Hennebert.Dd April 26, 2022 28926ce35aSJung-uk Kim.Dt RTSX 4 29926ce35aSJung-uk Kim.Os 30926ce35aSJung-uk Kim.Sh NAME 31926ce35aSJung-uk Kim.Nm rtsx 32926ce35aSJung-uk Kim.Nd Realtek SD card reader 33926ce35aSJung-uk Kim.Sh SYNOPSIS 34926ce35aSJung-uk KimTo compile this driver into the kernel, place the following 35926ce35aSJung-uk Kimlines in the kernel configuration file: 36926ce35aSJung-uk Kim.Bd -ragged -offset indent 37*8290c144SHenri Hennebert.Cd device mmc 38*8290c144SHenri Hennebert.Cd device mmcsd 39*8290c144SHenri Hennebert.Cd device rtsx 40926ce35aSJung-uk Kim.Ed 41926ce35aSJung-uk Kim.Pp 42926ce35aSJung-uk KimAlternatively, to load the driver as a module at boot time, 43926ce35aSJung-uk Kimplace the following lines in 44926ce35aSJung-uk Kim.Xr loader.conf 5 : 45926ce35aSJung-uk Kim.Bd -literal -offset indent 46*8290c144SHenri Hennebert.Cd mmc_load="YES" 47*8290c144SHenri Hennebert.Cd mmcsd_load="YES" 48*8290c144SHenri Hennebert.Cd rtsx_load="YES" 49926ce35aSJung-uk Kim.Ed 50926ce35aSJung-uk Kim.Sh DESCRIPTION 51926ce35aSJung-uk KimThe 52926ce35aSJung-uk Kim.Nm 53926ce35aSJung-uk Kimdriver provides support for Realtek SD card reader. 54926ce35aSJung-uk KimDriver attaches mmc bus on card insertion and detaches it on card removing. 55926ce35aSJung-uk Kim.Sh HARDWARE 56926ce35aSJung-uk KimThe 57926ce35aSJung-uk Kim.Nm 58926ce35aSJung-uk Kimdriver supports different specification compatible chips. 59926ce35aSJung-uk KimThe following chips have been verified to work: 60926ce35aSJung-uk Kim.Pp 61926ce35aSJung-uk Kim.Bl -bullet -compact 62926ce35aSJung-uk Kim.It 63926ce35aSJung-uk KimRTS5209 64926ce35aSJung-uk Kim.It 65926ce35aSJung-uk KimRTS5227 66926ce35aSJung-uk Kim.It 67926ce35aSJung-uk KimRTS5229 68926ce35aSJung-uk Kim.It 69926ce35aSJung-uk KimRTS522A 70926ce35aSJung-uk Kim.It 71926ce35aSJung-uk KimRTS525A 72926ce35aSJung-uk Kim.It 73577130e5SHenri HennebertRTS5260 74577130e5SHenri Hennebert.It 75926ce35aSJung-uk KimRTL8411B 76926ce35aSJung-uk Kim.El 77926ce35aSJung-uk Kim.Pp 78926ce35aSJung-uk KimIt should also work for: 79926ce35aSJung-uk Kim.Pp 80926ce35aSJung-uk Kim.Bl -bullet -compact 81926ce35aSJung-uk Kim.It 82926ce35aSJung-uk KimRTS5249 83926ce35aSJung-uk Kim.It 84926ce35aSJung-uk KimRTL8402 85926ce35aSJung-uk Kim.It 86926ce35aSJung-uk KimRTL8411 87926ce35aSJung-uk Kim.El 88926ce35aSJung-uk Kim.Sh SEE ALSO 89926ce35aSJung-uk Kim.Xr mmc 4 , 90926ce35aSJung-uk Kim.Xr mmcsd 4 91926ce35aSJung-uk Kim.Rs 92926ce35aSJung-uk Kim.%T "SD Specifications, Part 2, SD Host Controller, Simplified Specification" 93926ce35aSJung-uk Kim.%T "SanDisk Secure Digital Card" 94926ce35aSJung-uk Kim.Re 95926ce35aSJung-uk Kim.Sh HISTORY 96926ce35aSJung-uk KimThe 97926ce35aSJung-uk Kim.Nm 98926ce35aSJung-uk Kimdriver was ported from 99926ce35aSJung-uk Kim.Ox 100926ce35aSJung-uk Kimwith modifications found in Linux and 101926ce35aSJung-uk Kim.Nx . 102926ce35aSJung-uk Kim.Sh AUTHORS 103926ce35aSJung-uk Kim.An Henri Hennebert Aq Mt hlh@restart.be 104926ce35aSJung-uk Kim.An Gary Jennejohn Aq Mt gj@freebsd.org 105926ce35aSJung-uk Kim.An Jesper Schmitz Mouridsen Aq Mt jsm@FreeBSD.org 106926ce35aSJung-uk Kim.Sh CONTRIBUTORS 107926ce35aSJung-uk Kim.An Lutz Bichler Aq Mt Lutz.Bichler@gmail.com 108577130e5SHenri Hennebert.Sh DEBUGGING INFORMATION 109577130e5SHenri Hennebert.Em dev.rtsx.0.debug_mask 110577130e5SHenri Hennebertcan be set with the following masks: 111926ce35aSJung-uk Kim.Bl -bullet 112926ce35aSJung-uk Kim.It 113577130e5SHenri Hennebert0x01 - to show the basic flow of the driver, 114577130e5SHenri Hennebert.It 115577130e5SHenri Hennebert0x02 - to trace the SD commands, 116577130e5SHenri Hennebert.It 117577130e5SHenri Hennebert0x04 - to trace the tuning phase. 118577130e5SHenri Hennebert.El 119577130e5SHenri Hennebert.Sh BUGS 120577130e5SHenri Hennebert.Bl -bullet 121926ce35aSJung-uk Kim.It 1229d3bc163SHenri HennebertRTS522A on Lenovo T470p, card detection and read-only switch are reversed. 1239d3bc163SHenri HennebertThis is solved by adding in 124926ce35aSJung-uk Kim.Em loader.conf(5) : 125926ce35aSJung-uk Kim.Bd -ragged 126926ce35aSJung-uk Kim.Cd dev.rtsx.0.inversion=1 127926ce35aSJung-uk Kim.Ed 1289d3bc163SHenri Hennebert.Pp 1299d3bc163SHenri HennebertThe driver tries to automate those exceptions. 1309d3bc163SHenri HennebertIf this automation is wrong, it can be avoided by adding in 1319d3bc163SHenri Hennebert.Em loader.conf(5) : 1329d3bc163SHenri Hennebert.Bd -ragged 1339d3bc163SHenri Hennebert.Cd dev.rtsx.0.inversion=0 1349d3bc163SHenri Hennebert.Ed 135926ce35aSJung-uk Kim.It 136926ce35aSJung-uk KimMounting a filesystem with write access on a card write protected may involve a kernel crash. 137926ce35aSJung-uk Kim.It 138926ce35aSJung-uk KimSuspend/Resume do not work under MMCCAM. 139*8290c144SHenri Hennebert.It 140*8290c144SHenri HennebertFor some chips (e.g. RTS5260) after 141*8290c144SHenri Hennebert.Cd devctl disable/enable 142*8290c144SHenri Hennebertor 143*8290c144SHenri Hennebert.Cd kldunload/kldload 144*8290c144SHenri Hennebertthe driver can't detect a card correctly. 145926ce35aSJung-uk Kim.El 146