From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 23 09:21:05 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B036216A41F for ; Wed, 23 Nov 2005 09:21:05 +0000 (GMT) (envelope-from nz@thiemo.net) Received: from excalibur.ronald.org (excalibur.ronald.org [83.120.8.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F06543D5E for ; Wed, 23 Nov 2005 09:20:59 +0000 (GMT) (envelope-from nz@thiemo.net) Received: from styx.ham01.thiemo.net (port-212-202-20-213.dynamic.qsc.de [212.202.20.213]) by excalibur.ronald.org (8.12.10/8.12.10) with ESMTP id jAN9Kvls020311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 23 Nov 2005 10:20:58 +0100 (CET) Received: from mygiea.ham01.thiemo.net (localhost [127.0.0.1]) by styx.ham01.thiemo.net (8.13.3/8.13.3) with ESMTP id jAN9Kj7t048307 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 23 Nov 2005 10:20:45 +0100 (CET) Received: (from thiemo@localhost) by mygiea.ham01.thiemo.net (8.13.3/8.13.3/Submit) id jAN9Kjkl048302 for freebsd-hackers@freebsd.org; Wed, 23 Nov 2005 10:20:45 +0100 (CET) Date: Wed, 23 Nov 2005 10:20:45 +0100 From: Thiemo Nordenholz To: freebsd-hackers@freebsd.org Message-ID: <20051123092045.GA48216@mygiea.ham01.thiemo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Writing a driver for a card reader controller - how? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2005 09:21:05 -0000 Hi there, (Trying here now after no response on -drivers... If nothing happens here, I guess I'll stop bothering you.) I am writing a device driver for a card reader controller which is installed in my notebook, using the Winbond W83L518D chip. It's FreeBSD 6.0-STABLE running there now, though I started programming under 5.4-R, and the symptoms have not changed since then. However, when I attach it, it seems to allocate the resources port 0-0x7 irq 0 drq 4 on acpi0 which seems strange to me -- accessing registers in the respective SYS_RES_IOPORT seems to work, though. Now, as far as I understand the datasheet for the controller, I have to use another I/O port to access the SD card itself, to check if one is there, and finally to access it. How I do this, though, I have no idea. The datasheet lists two configuration registers that "select SD Card interface base address on 8-byte boundary" - but will my driver have to program an address into those registers? Does the bus framework somehow handle this? Does even BIOS do this? Or will I have to write one driver for the controller, have that act as a bus driver, and attach some SD card driver to that one? Maybe someone is willing to spend some time having a look at the datasheet and what I have done so far, and give me a little (or larger) clue-up... In return, I promise to write some documentation about how I have done it once it is ready, just in case someone else faces similar problems. A pointer to some driver programming documentation I have missed so far would be just as nice, of course. So far, I have tried using fdc and ppc as a guideline (after having found the spkr driver to be a bit too simple), and I _think_ I am doing just as those drivers do probing and resource allocation, but somehow they work, and mine does not. Link to the datasheet and some more description of what I have done so far (including my current state of source code) are at http://projects.thiemo.net/WbcrDriver Many thanks, and best regards, Thiemo -- Query a PGP key server (e.g. http://www.pgp.net/) for my public key 41068629. Strange sender address? Please see http://www.thiemo.net/misc/list-mail.shtml