Subject: Re: mii_attach(): where is the PHY?
To: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 06/30/2001 20:01:21
On Sat, Jun 30, 2001 at 07:21:58PM +0200, Emmanuel Dreyfus wrote:
> Hello
> 
> As some of you might know, the if_xi driver does not work with the
> Xircom REM56G100 card.
> 
> I had a look at the problem, and it is located in mii_attach(): it tries
> 32 locations, and it does not find any PHY. If always fails at this
> test:
> 
>       bmsr = (*mii->mii_readreg)(parent, ma.mii_phyno, MII_BMSR);
>       if (bmsr == 0 || bmsr == 0xffff ||
>           (bmsr & BMSR_MEDIAMASK) == 0) {
>          /* Assume no PHY at this address. */
>          continue;
>       }
> 
> If I comment out the continue and hence force ukphy to attach at this
> location, ukphy will not find any device either. I also tried to
> increase phyno to 256 instead of 32, no success.
> 
> The question is: how do I find where the PHY really is? Is there a
> method for that?

The method for that is the fragment code you quoted.
I guess the problem is in the method to access MII registers on this adapter.

> 
> There might be some usefull information to take from the Linux driver,
> because it works with theses cards. Attached is the part that seems
> revelant to me, if someone find something helpful in it, please tell me!
> 
> 
> /****************
>  * Initialize the Media-Independent-Interface
>  * Returns: True if we have a good MII
>  */
> static int
> init_mii(struct net_device *dev)
> {
>     local_info_t *local = dev->priv;
>     ioaddr_t ioaddr = dev->base_addr;
>     unsigned control, status, linkpartner;
>     int i; 
>         
>     status = mii_rd(ioaddr,  0, 1);
>     if ((status & 0xff00) != 0x7800)
>         return 0; /* No MII */

The relevant part here are mii_rd and mii_wr, I think.
Compare with xi_mdi_read() and xi_mdi_write() in the NetBSD driver.

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