Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Nov 2005 21:28:54 +1030
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        freebsd-hackers@freebsd.org
Cc:        Thiemo Nordenholz <listmember@thiemo.net>
Subject:   Re: Writing a driver for a card reader controller - how?
Message-ID:  <200511232128.56021.doconnor@gsoft.com.au>
In-Reply-To: <20051123092045.GA48216@mygiea.ham01.thiemo.net>
References:  <20051123092045.GA48216@mygiea.ham01.thiemo.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200511232128.56021.doconnor>