Writing a driver for a card reader controller - how?
doconnor at gsoft.com.au
Wed Nov 23 10:59:22 GMT 2005
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, 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.
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' -
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
> 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?
I would say you'd have to allocate some memory (probably low down) then write
it's address into those registers, then you will be able to read the card via
I've only hacked on ISA and PCI drivers and they aren't nearly as weird as
that hardware sounds ;)
Your next problem will be how to present the SD card to the OS.. Perhaps you
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
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20051123/98cd82df/attachment.bin
More information about the freebsd-hackers