From owner-freebsd-hackers@freebsd.org Mon Apr 2 14:39:34 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0CF9F6E5D0 for ; Mon, 2 Apr 2018 14:39:33 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id 9BDEF81357 for ; Mon, 2 Apr 2018 14:39:32 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from blue.vangyzen.net (173-28-118-115.client.mchsi.com [173.28.118.115]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 4BAC35646B; Mon, 2 Apr 2018 09:39:26 -0500 (CDT) Subject: Re: Realtek RTS525A SD card reader To: Warner Losh , raul.becker@iki.fi Cc: "freebsd-hackers@freebsd.org" References: <20180401034514.t4idseuyg53gap7g@tardis> From: Eric van Gyzen Message-ID: <22ca4f05-3e3a-114d-ef95-d974541ee6d8@vangyzen.net> Date: Mon, 2 Apr 2018 09:39:19 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2018 14:39:34 -0000 On 04/01/2018 02:06, Warner Losh wrote: > The interface you want to look for is the mmcbr_if.m inteface. In sdhci, > these routines implement the mmc interface: > sdhci_pci.c: DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), > sdhci_pci.c: DEVMETHOD(mmcbr_switch_vccq, sdhci_generic_switch_vccq), > sdhci_pci.c: DEVMETHOD(mmcbr_tune, sdhci_generic_tune), > sdhci_pci.c: DEVMETHOD(mmcbr_retune, sdhci_generic_retune), > sdhci_pci.c: DEVMETHOD(mmcbr_request, sdhci_generic_request), > sdhci_pci.c: DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), > sdhci_pci.c: DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), > sdhci_pci.c: DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), > > rtsz will almost certainly need it's own versions of these routines (which > is why I suggest having your own driver will be simpler: otherwise each of > these routines would be if (rtsz) do_rtsz_stuff(); else do_sdhci_stuff(); > which won't end well and would be uncomittable to FreeBSD. You can see how > other chips implement these methods by grepping for them in the tree. You > may not need a tune/retune if rtsz doesn't support the latest, fastest > cards, for example. Switch vccq may not be needed either. update_ios will > be needed, and request is needed. Acquire and release host may be able to > be done as a dummy routine if there's only one slot. > > I know this is a super-quick gloss of what needs to be done. This mmc part was helpful, since I know nothing about this interface. Thanks! Eric