forked from Imagelibrary/rtems
GRETH: forcing autonegotiation during PHY initialization
Looking at PHY Ctrl register without reseting it will give back old register content, that is not stable. Instead the PHY is reset and the autonogotiation capability is read out and started if present.
This commit is contained in:
@@ -328,14 +328,19 @@ greth_initialize_hardware (struct greth_softc *sc)
|
|||||||
phyaddr = sc->phyaddr;
|
phyaddr = sc->phyaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get phy control register default values */
|
/* reset PHY */
|
||||||
while ((phyctrl = read_mii(sc, phyaddr, 0)) & 0x8000) {}
|
write_mii(sc, phyaddr, 0, 0x8000);
|
||||||
|
|
||||||
/* reset PHY and wait for completion */
|
/* Wait for reset to complete and get default values */
|
||||||
write_mii(sc, phyaddr, 0, 0x8000 | phyctrl);
|
while ((phyctrl = read_mii(sc, phyaddr, 0)) & 0x8000) {}
|
||||||
|
|
||||||
|
/* If autonegotiation implemented we start it */
|
||||||
|
phystatus = read_mii(sc, phyaddr, 1);
|
||||||
|
if (phystatus & 0x0008) {
|
||||||
|
write_mii(sc, phyaddr, 0, phyctrl | 0x1200);
|
||||||
|
phyctrl = read_mii(sc, phyaddr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
while ((read_mii(sc, phyaddr, 0)) & 0x8000) {}
|
|
||||||
|
|
||||||
/* Check if PHY is autoneg capable and then determine operating mode,
|
/* Check if PHY is autoneg capable and then determine operating mode,
|
||||||
otherwise force it to 10 Mbit halfduplex */
|
otherwise force it to 10 Mbit halfduplex */
|
||||||
sc->gb = 0;
|
sc->gb = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user