From owner-freebsd-hackers@freebsd.org Sun Jun 3 07:40:12 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 845E3F77201 for ; Sun, 3 Jun 2018 07:40:12 +0000 (UTC) (envelope-from raul.palomaki@gmail.com) Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com [IPv6:2a00:1450:4010:c07::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF5E676384 for ; Sun, 3 Jun 2018 07:40:11 +0000 (UTC) (envelope-from raul.palomaki@gmail.com) Received: by mail-lf0-x22e.google.com with SMTP id u4-v6so20572628lff.3 for ; Sun, 03 Jun 2018 00:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8o0Pq3Bq6/hq3EP5xZjiGLPm23xhwaOLHN3/muw+2Uw=; b=LqSK6UaODW/hX1xtVA87dQLBLEbK2z4wTlZP9Dtqvz1rvm2jgJpJ9TlkjO3Ma90p/O sgaPEjMUgZwpcMPANnEttpTu25VAmvlxruwI+5Ffh6kRsnyhYIDfdBVvYaw/F+YDdZtQ vbNG8C7DaAA+T1G8IBFMZUCKfFOr2PTM6JoQE5TL561g3wZzGkaCzt0tmq8clKBRNFu0 68NgW9lLOeHUwGU7Tf3STN725DGFddgnkJlj5XKo9xQvYsg4ND5DTaS3pIm/h+cIrKPg Espa3uKbAQDw4xdl8oKWEcPZ9fBhtPY2wdUQmrhAsPhm/O8oF7DVXE+54HNs1ubS20oG 0Vvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=8o0Pq3Bq6/hq3EP5xZjiGLPm23xhwaOLHN3/muw+2Uw=; b=aiQ1F9ITjYWPUk0OjJGBs5ImjuSR5PsBKn/ZCTmMWPi8ywyAzYpH2g1MpSBbMBxdJZ jJlPYpdnYxiAsSEZcpQvC1nhwN2RBCOnqXEscxidNvPcOI10YsU/mP2ErJGOQYVtbZLO LAOMYaZZRV+rePNhR6cNmZY7vrrC1myoSo3TOw6a7XqAm3bVkLfiA0J8AM48aFdGQ9Qz SgO8uMuybc2a/p9JqnLBEv6oc0Tfs+d9ECWdiGxB8Nz4KEGR484V4jUj10d0ewCceGuz 9Oz9DUSNel9J+KB6GFHCws0zNm9d2kleBT7BjayWEWk8ALI3CuH+s+whiVB1/FNqUfll M8qg== X-Gm-Message-State: APt69E127WNnrWN9K/a7TNGz6+unyDV4PJtf/BV7iOeedtzPt7bQzrzl zqIPQUs/qS5oAtH3lGJNYZKLKseb X-Google-Smtp-Source: ADUXVKLp8aN5ux4FlUIAlfByr51/cpnK5m+bUjI58JR++osPnLjFYow1asqzzDkEXtdTAHx59RdvvA== X-Received: by 2002:a19:7602:: with SMTP id c2-v6mr577495lff.59.1528011610078; Sun, 03 Jun 2018 00:40:10 -0700 (PDT) Received: from tardis (dc376zynwcb3---v08zzy-3.rev.dnainternet.fi. [2001:14ba:15f7:aa01:7210:6fff:fe3e:e528]) by smtp.gmail.com with ESMTPSA id j15-v6sm9143220lji.89.2018.06.03.00.40.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Jun 2018 00:40:09 -0700 (PDT) Sender: Raul Becker Date: Sun, 3 Jun 2018 10:40:19 +0300 From: Raul Becker To: Eric van Gyzen Cc: Warner Losh , "freebsd-hackers@freebsd.org" Subject: Re: Realtek RTS525A SD card reader Message-ID: <20180603074017.jtrn3ykz6ngumdje@tardis> References: <20180401034514.t4idseuyg53gap7g@tardis> <22ca4f05-3e3a-114d-ef95-d974541ee6d8@vangyzen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22ca4f05-3e3a-114d-ef95-d974541ee6d8@vangyzen.net> User-Agent: NeoMutt/20180323 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2018 07:40:12 -0000 Hi, yes, thanks for the quick list on what needs to be done! This helped me a ton as well as the arch-handbook. I got the probe to match my device (for now) and attach that initializes the the device as you suggested with freebsd bus resources. It even detects on kldload presence of a sdcard in the slot and reports it in dmesg log. :) But this is still far from anything usable. Just wanted ask if there is any risk that I end up destroying my sd-card device? Like there are some functions in the rtsx driver where the voltages are being changed and also clock hz too. I dont haven't included those functions that do voltage and clock changes yet. -- Raul Becker On Mon, Apr 02, 2018 at 09:39:19AM -0500, Eric van Gyzen wrote: > 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