From owner-freebsd-hackers@freebsd.org Sun Apr 1 03:45:16 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 97F8CF784AF for ; Sun, 1 Apr 2018 03:45:16 +0000 (UTC) (envelope-from raul.palomaki@gmail.com) Received: from mail-lf0-x234.google.com (mail-lf0-x234.google.com [IPv6:2a00:1450:4010:c07::234]) (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 F24C086F23 for ; Sun, 1 Apr 2018 03:45:15 +0000 (UTC) (envelope-from raul.palomaki@gmail.com) Received: by mail-lf0-x234.google.com with SMTP id a22-v6so16803808lfg.9 for ; Sat, 31 Mar 2018 20:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:mime-version :content-disposition:in-reply-to:user-agent; bh=BLULDcum1wXIJIt5wqw5ApXIPkmV41PS8vGdDdN3owo=; b=O0+ZCCE9MIIi54chhb7hwW86K1HON/fpUfIESDKDewUjBVrxC4qIJxElFjUVuYsSqo CKX0/V2OthKM8kk7oUQX3pC6p6kRRZsgOZiRqQk35NR0KnCX7g42xI6VL7sN5CJAFBuW 0FoYBxhdQEyjCWP1GvDqE+e3va94oO3QApCJn9N2ZJqN/Q/HJd/dpf8qDhKOpABHorrs NO7QWw71iL0ylydW9rojKfUDYEslBu7EAxlZ0/aTzTOBltwXaISsJsN2erSv5R6DKUZt Z2l013nS/H069GOyua3wZ5Rl++cpAJ+JgqpP3khRCzZYbC6jPh/MPAfKj52X6hzhsfaj cstw== 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:subject:message-id :mime-version:content-disposition:in-reply-to:user-agent; bh=BLULDcum1wXIJIt5wqw5ApXIPkmV41PS8vGdDdN3owo=; b=GU6FYsvHvnmUtTMlsvi/5t9Z6hdOoNg/UtmK7CbWUFv1mk1ocrHXe8ffQdt2FDZp0q /xQRJK0WBLohVyAYG/mpPTTHXL51lStUmmgnhR0WLjkZlYFen74L/v+vWW3xTkK60102 FY3ANN8sLdZi5Pch8lAsbXLGNJUgTRsgP/VX82RgkCcRzjIBuhO/+4PSFmQ6b+4V443c DSZyTG2f0BuLkQLdVerzsI53BWvDUf/D93J/swh6XWk9NUjbD7xHjLc4/txWtjDRdLzj EuqM1aRmkyt17Q2z/iLLtGE14VLPpf0ardRpOZETpYLc1WNNNr6e4xXZXxnmhgMOhlsf cztg== X-Gm-Message-State: ALQs6tAKQnwB0htuyN6sMipLUfFYODYXoSrQ9QFSJGb06VvgfsWmvqVe AoEt5qSwNiGAYGuuSb19H4YJV+d8 X-Google-Smtp-Source: AIpwx48p32K3euk0NYbRSRF2xO8wJxDppFxOWvv2dt25qX79AUKtwhpb5W289IalwLyZ8CF35Wz7Dg== X-Received: by 10.46.56.6 with SMTP id f6mr3012636lja.4.1522554313860; Sat, 31 Mar 2018 20:45:13 -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 i125sm162180lji.26.2018.03.31.20.45.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 20:45:13 -0700 (PDT) Sender: Raul Becker Date: Sun, 1 Apr 2018 06:45:15 +0300 From: raul.becker@iki.fi To: freebsd-hackers@freebsd.org Subject: Re: Realtek RTS525A SD card reader Message-ID: <20180401034514.t4idseuyg53gap7g@tardis> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171208 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: Sun, 01 Apr 2018 03:45:16 -0000 Hi, I somehow got the same idea just recently that it would be a fun learning experi ence to try to port rtsx from OpenBSD to FreeBSD and getting at the same time mo re familiar with C. I practically have zero experience in writing drivers. But I think that the relevant OpenBSD driver files are rtsx.c rtsxvar.h and rtsx reg.h. Browsing through the FreeBSD src/sys/dev directories for any of the curre ct drivers to see how the drivers are meant to be implemented in FreeBSD I found src/sys/dev/sdhci as a possible candidate. There are already driver modules for the sdhci.c which are atleast sdhci_pci.c, sdhci_fdt.c and sdhci_acpi.c. They a ll follow same organization where in the end they map the DEVMETHODs what the sd hci expects to get I believe. The sdhci_pci.c was abit overwhelming with all the quirks so I thought that maybe rtsx driver could be instead a separate driver m odule like sdhci_rtsx.c for example. This separation I think would be helpful es pecially when not too familiar with C and because it looks of like the task does not seem to be that straight forward to do either. The other mmc drivers are mo stly spread out and many are for arm boards. It would be sweet if someone could confirm that src/sys/dev/sdhci is a good loca tion where to try to implement a driver module and/or point at the right(er) dir ection. My device: none2@pci0:2:0:0: class=0xff0000 card=0x221417aa chip=0x522710ec rev=0x01 hdr=0x00 vendor = 'Realtek Semiconductor Co., Ltd.' device = 'RTS5227 PCI Express Card Reader' -- Raul Becker p.s. I hope this time I got the In-Reply-To header right.