]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
net: phy: xilinx: Added phy-type property for 1000 base-x operation
authorPunnaiah Choudary Kalluri <punnaiah.choudary.kalluri@xilinx.com>
Wed, 18 Nov 2015 03:51:17 +0000 (09:21 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 18 Nov 2015 07:31:18 +0000 (08:31 +0100)
Added phy-type property for 1000 base-x operation. Based on this phy-type
value driver will not advertise the other speed modes for 1000 base-x
operation.

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

index 0c817b5bdd31c59c943a01ee7b479abd76a0bfd9..1985949d039d38c23624d16ece104fb3f33cac68 100644 (file)
@@ -92,10 +92,30 @@ static int xilinxphy_read_status(struct phy_device *phydev)
        return 0;
 }
 
+static int xilinxphy_of_init(struct phy_device *phydev)
+{
+       struct device *dev = &phydev->dev;
+       struct device_node *of_node = dev->of_node;
+       u32 phytype;
+
+       if (!IS_ENABLED(CONFIG_OF_MDIO))
+               return 0;
+
+       if (!of_node)
+               return -ENODEV;
+
+       if (!of_property_read_u32(of_node, "xlnx,phy-type", &phytype))
+               if (phytype == XAE_PHY_TYPE_1000BASE_X)
+                       phydev->dev_flags |= XAE_PHY_TYPE_1000BASE_X;
+
+       return 0;
+}
+
 static int xilinxphy_config_init(struct phy_device *phydev)
 {
        int temp;
 
+       xilinxphy_of_init(phydev);
        temp = phy_read(phydev, MII_BMCR);
        temp &= XPCSPMA_PHY_CTRL_ISOLATE_DISABLE;
        phy_write(phydev, MII_BMCR, temp);