Subject: Re: Myson MTD981 PHY driver
To: Peter Bex <airhead_zoom@crapmail.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-help
Date: 03/09/2002 19:28:50
On Fri, Mar 08, 2002 at 05:14:01AM -0800, Peter Bex wrote:
> Hello NetBSD people,
> 
> I have recently bought a 10/100 ethernet network card which isn't recognised by the kernel.
> After looking up the vendor (0x1516) and device (0x0803) IDs, I came to the conclusion I
> probably have to build my own driver for it.
> Of course, there's a driver disk shipped with this product which contains (oh, wonder) Linux and FreeBSD
> drivers. I think writing a driver won't be too much trouble with these and the datasheet to guide me.
> The network card turned out to be a Myson MTD981 (according to the vendor/device ID), sold by SafeWay.
> On Safeway's website they promote it as a Realtek card, though, which I find really strange!
> The shipped drivers are more generic, they are for Myson, Level 1 and some other cards. (I don't have access to
> my own computer right now so I can't enumerate them all)
> 
> Now these are some questions that turned up while browsing the kernel sources: How does the ukphy driver work?
> When I compile it into the kernel, it doesn't even initialise. How does the kernel know some device is a PHY?
> A PHY attaches to mii, which doesn't seem to attach to anything at all, but I thought everything
> has to be attached to netbsd. Shouldn't there be some kind of rule in the config file like:
> mii at pci? dev ? function ?

Well, this is implicit. The miibus attaches to a ethernet driver. For example
you have
tlp at pci
mii at tlp
ukphy at mii

The "mii at tlp" is not specified in the kernel config file, but in
sys/conf/files for each ethenet drivers that have a mii bus.

> 
> Now I must admit I'm a total newbie in the UNIX scene, but I was hoping you could take the time to
> help me out even if my questions are a little stupid.
> 
> Another thing, if I actually get started on the driver (I don't have much time so don't expect
> anything too soon :) where should I create it? The sys/pci dir's TODO file says most drivers should
> be more generic and relocated. Now can I just make a PCI driver which calls ukphy or another, mysonphy driver?

This really depends on your ethernet chip. If the chip includes a pci
interface, and can't be attached to something else than a PCI bus, then
put it in dev/pci/ (for example the if_tl driver). If the chip can be attached
different busses (for example the tlp driver, which can attach to eisa, pci
or cardbus) then the driver goes in dev/ic/, with different fron-ends
for each bus type in the bus subdir (e.g. cardbus/if_tlp_cardbus.c,
eisa/if_tlp_eisa.c and pci/if_tlp_pci.c for the tlp driver).


-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--