*/
int miiphy_speed(const char *devname, unsigned char addr)
{
- u16 bmcr, anlpar;
+ u16 bmcr, anlpar, adv;
#if defined(CONFIG_PHY_GIGE)
u16 btsr;
printf("PHY AN speed");
goto miiphy_read_failed;
}
- return (anlpar & LPA_100) ? _100BASET : _10BASET;
+
+ if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+ puts("PHY AN adv speed");
+ goto miiphy_read_failed;
+ }
+ return ((anlpar & adv) & LPA_100) ? _100BASET : _10BASET;
}
/* Get speed from basic control settings. */
return (bmcr & BMCR_SPEED100) ? _100BASET : _10BASET;
*/
int miiphy_duplex(const char *devname, unsigned char addr)
{
- u16 bmcr, anlpar;
+ u16 bmcr, anlpar, adv;
#if defined(CONFIG_PHY_GIGE)
u16 btsr;
puts("PHY AN duplex");
goto miiphy_read_failed;
}
- return (anlpar & (LPA_10FULL | LPA_100FULL)) ?
+
+ if (miiphy_read(devname, addr, MII_ADVERTISE, &adv)) {
+ puts("PHY AN adv duplex");
+ goto miiphy_read_failed;
+ }
+ return ((anlpar & adv) & (LPA_10FULL | LPA_100FULL)) ?
FULL : HALF;
}
/* Get speed from basic control settings. */