]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: bcmgenet: communicate integrated PHY revision to PHY driver
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 19 Sep 2014 20:07:53 +0000 (13:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 19 Sep 2014 20:27:07 +0000 (16:27 -0400)
The integrated BCM7xxx PHY contains no useful revision information in
its MII_PHYSID2 bits 3:0, that information is instead contained in the
GENET hardware block.

We already read the GENET 32-bit revision register, so store the
integrated PHY revision in the driver private structure, and then
communicate this revision value to the PHY driver by overriding the
phy_flags value.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/broadcom/genet/bcmgenet.h
drivers/net/ethernet/broadcom/genet/bcmmii.c

index 3f9d4de8173cdd0f86589925cf48a78d0ab7648d..a12c65604f9d3cbfa5a75845114ec4f17b3fca48 100644 (file)
@@ -2432,6 +2432,13 @@ static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv)
        dev_info(&priv->pdev->dev, "GENET " GENET_VER_FMT,
                 major, (reg >> 16) & 0x0f, reg & 0xffff);
 
+       /* Store the integrated PHY revision for the MDIO probing function
+        * to pass this information to the PHY driver. The PHY driver expects
+        * to find the PHY major revision in bits 15:8 while the GENET register
+        * stores that information in bits 7:0, account for that.
+        */
+       priv->gphy_rev = (reg & 0xffff) << 8;
+
 #ifdef CONFIG_PHYS_ADDR_T_64BIT
        if (!(params->flags & GENET_HAS_40BITS))
                pr_warn("GENET does not support 40-bits PA\n");
index c862d06667719d1037eaa86bdf6924b46f6b06e6..ad95fe57ebcdbfc463d127ea3b0b910ca2a6c661 100644 (file)
@@ -545,6 +545,7 @@ struct bcmgenet_priv {
        struct phy_device *phydev;
        struct device_node *phy_dn;
        struct mii_bus *mii_bus;
+       u16 gphy_rev;
 
        /* PHY device variables */
        int old_duplex;
index 71f2ef7d33a9e9af9ff388cd2f182a6622d462cb..75b26cbaa7c1f0ae2b7cbda401a2908e3419a567 100644 (file)
@@ -296,6 +296,7 @@ static int bcmgenet_mii_probe(struct net_device *dev)
        struct bcmgenet_priv *priv = netdev_priv(dev);
        struct device_node *dn = priv->pdev->dev.of_node;
        struct phy_device *phydev;
+       u32 phy_flags;
        int ret;
 
        if (priv->phydev) {
@@ -314,8 +315,11 @@ static int bcmgenet_mii_probe(struct net_device *dev)
                priv->phy_dn = of_node_get(dn);
        }
 
-       phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup, 0,
-                               priv->phy_interface);
+       /* Communicate the integrated PHY revision */
+       phy_flags = priv->gphy_rev;
+
+       phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,
+                               phy_flags, priv->phy_interface);
        if (!phydev) {
                pr_err("could not attach to PHY\n");
                return -ENODEV;