From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 23 10:59:22 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 EE22516A41F for ; Wed, 23 Nov 2005 10:59:21 +0000 (GMT) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id F11C743D69 for ; Wed, 23 Nov 2005 10:59:05 +0000 (GMT) (envelope-from doconnor@gsoft.com.au) Received: from inchoate.gsoft.com.au (ppp134-41.lns2.adl2.internode.on.net [59.167.134.41]) (authenticated bits=0) by cain.gsoft.com.au (8.13.4/8.13.4) with ESMTP id jANAx17r001190 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Wed, 23 Nov 2005 21:29:02 +1030 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: freebsd-hackers@freebsd.org Date: Wed, 23 Nov 2005 21:28:54 +1030 User-Agent: KMail/1.8.2 References: <20051123092045.GA48216@mygiea.ham01.thiemo.net> In-Reply-To: <20051123092045.GA48216@mygiea.ham01.thiemo.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1328395.4xea69S2zZ"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200511232128.56021.doconnor@gsoft.com.au> X-Spam-Score: 0.05 () FORGED_RCVD_HELO X-Scanned-By: MIMEDefang 2.51 on 203.31.81.10 Cc: Thiemo Nordenholz Subject: Re: 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 10:59:22 -0000 --nextPart1328395.4xea69S2zZ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wed, 23 Nov 2005 19:50, Thiemo Nordenholz wrote: > 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, a= nd > 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. It looks really weird to me.. I can't imagine it's _really_ at 0x0 :) Looking at your page I think you should try attaching to the ISA 'version' = =2D=20 you should be able to key off it's PnP entry I think. I don't know if there is extra magic with the acpi 'bus' though, or what it= =20 really means.. > Now, as far as I understand the datasheet for the controller, I have to u= se > 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? I would say you'd have to allocate some memory (probably low down) then wri= te=20 it's address into those registers, then you will be able to read the card v= ia=20 that address. I've only hacked on ISA and PCI drivers and they aren't nearly as weird as= =20 that hardware sounds ;) Your next problem will be how to present the SD card to the OS.. Perhaps yo= u=20 can present it as a block device I guess. > 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 =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --nextPart1328395.4xea69S2zZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (FreeBSD) iD8DBQBDhEtv5ZPcIHs/zowRAgk2AKCnIwfCG4K6N+7gtLF1abTcba7dLQCgjZZV KoZs719cOfTFmHzOBQOy8d4= =pkZD -----END PGP SIGNATURE----- --nextPart1328395.4xea69S2zZ--