Make pcn_miibus_readreg() latch onto the first PHY that it finds (as

a result of mii_phy_probe()) and use that rather than hardcoding a
constant. The hardcoded way was too specific to the particular card
I had and caused PHY probing to fail on at least one laptop with a
built-in AMD chip.

Reported by: rjk@grauel.com (Richard J Kuhns)
This commit is contained in:
Bill Paul 2000-09-22 03:49:12 +00:00
parent bdf3d8b954
commit 325931c901
2 changed files with 5 additions and 1 deletions

View File

@ -238,13 +238,16 @@ static int pcn_miibus_readreg(dev, phy, reg)
sc = device_get_softc(dev);
if (phy >= 30)
if (sc->pcn_phyaddr && phy > sc->pcn_phyaddr)
return(0);
pcn_bcr_write(sc, PCN_BCR_MIIADDR, reg | (phy << 5));
val = pcn_bcr_read(sc, PCN_BCR_MIIDATA) & 0xFFFF;
if (val == 0xFFFF)
return(0);
sc->pcn_phyaddr = phy;
return(val);
}

View File

@ -453,6 +453,7 @@ struct pcn_softc {
device_t pcn_miibus;
u_int8_t pcn_unit;
u_int8_t pcn_link;
u_int8_t pcn_phyaddr;
int pcn_if_flags;
int pcn_type;
struct pcn_list_data *pcn_ldata;