diff --git a/drivers/net/core10100.c b/drivers/net/core10100.c index 76b0986fa22079ef407569111dff9d664a0b5694..4cb9231ef6e64861c6f8d0a15d940c538275f590 100644 --- a/drivers/net/core10100.c +++ b/drivers/net/core10100.c @@ -140,7 +140,7 @@ static int phy_init(struct core10100_dev *bp) /* get link status */ static int phy_link_stat(struct core10100_dev *bp) { - u16 val; + u16 val, lpa, adv; u32 link_stat = 0; /* If not initialized, return no link */ @@ -155,17 +155,19 @@ static int phy_link_stat(struct core10100_dev *bp) if (val & PHY_BMSR_LS) { link_stat |= LINK_UP; } + /* Read autonegotiations results, code from linux/drivers/net/phy/phy_device.c, genphy_read_status() */ + lpa = mii_read(bp, PHY_ANLPAR); + adv = mii_read(bp, PHY_ANAR); + lpa &= adv; - /* Read link speed and duplex */ - val = mii_read(bp, PHY_BMCR); - - /* Update link speed */ - if (val & (PHY_BMSR_100TXH | PHY_BMSR_100TXF)) { + if (lpa & (PHY_ANLPAR_100HALF | PHY_ANLPAR_100FULL)){ link_stat |= LINK_100; - } - /* Update link speed */ - if (val & PHY_BMSR_EXT_STAT) { + if (lpa & PHY_ANLPAR_100FULL){ + link_stat |= LINK_FD; + + } + } else if (lpa & PHY_ANLPAR_10FD) { link_stat |= LINK_FD; } diff --git a/include/miiphy.h b/include/miiphy.h index 53621252330f4923a43c0876745c3348a3e3637e..c2963364eec29df6571d8d212cad7901f4fe9bae 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -162,7 +162,9 @@ int bb_miiphy_write (char *devname, unsigned char addr, #define PHY_ANLPAR_PAUSE 0x0400 #define PHY_ANLPAR_T4 0x0200 #define PHY_ANLPAR_TXFD 0x0100 +#define PHY_ANLPAR_100FULL 0x0100 #define PHY_ANLPAR_TX 0x0080 +#define PHY_ANLPAR_100HALF 0x0080 #define PHY_ANLPAR_10FD 0x0040 #define PHY_ANLPAR_10 0x0020 #define PHY_ANLPAR_100 0x0380 /* we can run at 100 */