]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: phy: xilinx: Fix reporting half duplex mode wrongly
authorPunnaiah Choudary Kalluri <punnaiah.choudary.kalluri@xilinx.com>
Wed, 18 Nov 2015 03:51:16 +0000 (09:21 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 18 Nov 2015 07:31:18 +0000 (08:31 +0100)
Current driver masking the status register value with the speed
mask to get the duplex mode which is wrong and it overwrites the
full duplex status bit. This patch fixes the logic.

Signed-off-by: Punnaiah Choudary Kalluri <punnaia@xilinx.com>
Reviewed-by: Kedareswara rao Appana <appanad@xilinx.com>
drivers/net/phy/xilinx_phy.c

index 2f864cc67ee60589ba68ee16999a7dbe712ad98c..0c817b5bdd31c59c943a01ee7b479abd76a0bfd9 100644 (file)
@@ -43,14 +43,13 @@ static int xilinxphy_read_status(struct phy_device *phydev)
 
        if (AUTONEG_ENABLE == phydev->autoneg) {
                status = phy_read(phydev, MII_LPA);
-               status = status & MII_PHY_STATUS_SPD_MASK;
 
                if (status & MII_PHY_STATUS_FULLDUPLEX)
                        phydev->duplex = DUPLEX_FULL;
                else
                        phydev->duplex = DUPLEX_HALF;
 
-               switch (status) {
+               switch (status & MII_PHY_STATUS_SPD_MASK) {
                case MII_PHY_STATUS_1000:
                        phydev->speed = SPEED_1000;
                        break;