Writing a driver for a card reader controller - how?

Thiemo Nordenholz listmember at thiemo.net
Thu Nov 17 02:26:29 PST 2005


Hi there,

First of all, thanks for providing a -drivers list (it seems to be quite
new, isn't it?). Maybe this helps me getting into driver programming under
FreeBSD :-}

I am writing a device driver for a card reader controller which is installed
in my notebook, using the Winbond W83L518D chip.

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-drivers mailing list