Writing a driver for a card reader controller - how?
Thiemo Nordenholz
listmember at thiemo.net
Wed Nov 23 09:21:05 GMT 2005
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
More information about the freebsd-hackers
mailing list