net: phy: Fix mask value write on gmii2rgmii converter speed register
authorFahad Kunnathadi <fahad.kunnathadi@dexceldesigns.com>
Fri, 15 Sep 2017 06:31:58 +0000 (12:01 +0530)
committerDavid S. Miller <davem@davemloft.net>
Mon, 18 Sep 2017 23:33:18 +0000 (16:33 -0700)
To clear Speed Selection in MDIO control register(0x10),
ie, clear bits 6 and 13 to zero while keeping other bits same.
Before AND operation,The Mask value has to be perform with bitwise NOT
operation (ie, ~ operator)

This patch clears current speed selection before writing the
new speed settings to gmii2rgmii converter

Fixes: f411a6160bd4 ("net: phy: Add gmiitorgmii converter support")
Signed-off-by: Fahad Kunnathadi <fahad.kunnathadi@dexceldesigns.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/xilinx_gmii2rgmii.c

index d15dd3938ba82624fd693b5a6f77301bb6d26bde..2e5150b0b8d52c5dd784a3df1818962d64972898 100644 (file)
@@ -44,7 +44,7 @@ static int xgmiitorgmii_read_status(struct phy_device *phydev)
        priv->phy_drv->read_status(phydev);
 
        val = mdiobus_read(phydev->mdio.bus, priv->addr, XILINX_GMII2RGMII_REG);
-       val &= XILINX_GMII2RGMII_SPEED_MASK;
+       val &= ~XILINX_GMII2RGMII_SPEED_MASK;
 
        if (phydev->speed == SPEED_1000)
                val |= BMCR_SPEED1000;