Auto-neg emulation currently doesn't set bit BMCR_ANENABLE in BMCR,
add this. Users will ignore speed and duplex settings in BMCR because
we're emulating auto-neg, therefore we can remove related code.
See also following discussion [0].

[0] https://marc.info/?t=155041784900002&r=1&w=2

Signed-off-by: Heiner Kallweit <hkallwe...@gmail.com>
---
 drivers/net/phy/swphy.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/phy/swphy.c b/drivers/net/phy/swphy.c
index b9743569e..dad22481d 100644
--- a/drivers/net/phy/swphy.c
+++ b/drivers/net/phy/swphy.c
@@ -19,7 +19,6 @@
 #define MII_REGS_NUM 29
 
 struct swmii_regs {
-       u16 bmcr;
        u16 bmsr;
        u16 lpa;
        u16 lpagb;
@@ -40,16 +39,13 @@ enum {
  */
 static const struct swmii_regs speed[] = {
        [SWMII_SPEED_10] = {
-               .bmcr  = BMCR_FULLDPLX,
                .lpa   = LPA_10FULL | LPA_10HALF,
        },
        [SWMII_SPEED_100] = {
-               .bmcr  = BMCR_FULLDPLX | BMCR_SPEED100,
                .bmsr  = BMSR_100FULL | BMSR_100HALF,
                .lpa   = LPA_100FULL | LPA_100HALF,
        },
        [SWMII_SPEED_1000] = {
-               .bmcr  = BMCR_FULLDPLX | BMCR_SPEED1000,
                .bmsr  = BMSR_ESTATEN,
                .lpagb = LPA_1000FULL | LPA_1000HALF,
        },
@@ -57,13 +53,11 @@ static const struct swmii_regs speed[] = {
 
 static const struct swmii_regs duplex[] = {
        [SWMII_DUPLEX_HALF] = {
-               .bmcr  = ~BMCR_FULLDPLX,
                .bmsr  = BMSR_ESTATEN | BMSR_100HALF,
                .lpa   = LPA_10HALF | LPA_100HALF,
                .lpagb = LPA_1000HALF,
        },
        [SWMII_DUPLEX_FULL] = {
-               .bmcr  = ~0,
                .bmsr  = BMSR_ESTATEN | BMSR_100FULL,
                .lpa   = LPA_10FULL | LPA_100FULL,
                .lpagb = LPA_1000FULL,
@@ -118,7 +112,6 @@ int swphy_read_reg(int reg, const struct fixed_phy_status 
*state)
 {
        int speed_index, duplex_index;
        u16 bmsr = BMSR_ANEGCAPABLE;
-       u16 bmcr = 0;
        u16 lpagb = 0;
        u16 lpa = 0;
 
@@ -136,7 +129,6 @@ int swphy_read_reg(int reg, const struct fixed_phy_status 
*state)
        if (state->link) {
                bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
 
-               bmcr  |= speed[speed_index].bmcr  & duplex[duplex_index].bmcr;
                lpa   |= speed[speed_index].lpa   & duplex[duplex_index].lpa;
                lpagb |= speed[speed_index].lpagb & duplex[duplex_index].lpagb;
 
@@ -149,7 +141,7 @@ int swphy_read_reg(int reg, const struct fixed_phy_status 
*state)
 
        switch (reg) {
        case MII_BMCR:
-               return bmcr;
+               return BMCR_ANENABLE;
        case MII_BMSR:
                return bmsr;
        case MII_PHYSID1:
-- 
2.20.1

Andr

Reply via email to