On Mon, Dec 19, 2005 at 02:08:58PM -0200, Arnaldo Carvalho de Melo wrote:
> On 12/19/05, John W. Linville <[EMAIL PROTECTED]> wrote:
> > On Mon, Dec 19, 2005 at 03:35:04PM +0100, Lennert Buytenhek wrote:
> > > On Mon, Dec 19, 2005 at 12:20:32PM -0200, Arnaldo Carvalho de Melo wrote:
> > >
> > > > @@ -633,7 +643,7 @@ static int __devinit sundance_probe1 (st
> > > >
> > > >     np->phys[0] = 1;                /* Default setting */
> > > >     np->mii_preamble_required++;
> > > > -   for (phy = 1; phy <= 32 && phy_idx < MII_CNT; phy++) {
> > > > +   for (phy = 0; phy < 32 && phy_idx < MII_CNT; phy++) {
> > > >             int mii_status = mdio_read(dev, phy, MII_BMSR);
> > > >             int phyx = phy & 0x1f;
> > > >             if (mii_status != 0xffff  &&  mii_status != 0x0000) {
> > >
> > > (Your PHY is at address 0?)  Can you add some debug here to see what
> > > happens in both cases (f.e.  print the returned MII_BMSR values for
> > > both 'start at 0' and 'start at 1')?  Presumably there's something
> > > about starting at 1 that gets your hardware confused, I'd like to know
> > > what that is..
> >
> > How about if you just ditch that hunk?  The "int phyx = phy & 0x1f"
> > line serves the purpose of making sure that phy addr 0 is still
> > accessed, just last instead of first.  Apparently this is some oral
> > wisdom passed-down from Don Becker relating to some phys not dealing
> > well w/ address 0 being accessed first.
> 
> humm, interesting explanation, I'll add a comment and make phy 0
> actually be read, as it is not being right now as we have:
> 
>                int mii_status = mdio_read(dev, phy, MII_BMSR);
>                int phyx = phy & 0x1f;
> 
> When we should have instead:
> 
>                int phyx = phy & 0x1f;
>                int mii_status = mdio_read(dev, phyx, MII_BMSR);
> 
> so that when phy, in the end of the (phy = 1; phy <= 32...) loop gets
> to 32 phyx gets to 0, i.e. we were reading at 32, when the intended
> read was for 0.

Ahhh...good catch!  It certainly would help to read the correct
register... :-)

John
-- 
John W. Linville
[EMAIL PROTECTED]
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to