]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: phy: broadcom: add bcm54xx_auxctl_read
authorJon Mason <jon.mason@broadcom.com>
Fri, 4 Nov 2016 05:10:56 +0000 (01:10 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 7 Nov 2016 18:11:21 +0000 (13:11 -0500)
Add a helper function to read the AUXCTL register for the BCM54xx.  This
mirrors the bcm54xx_auxctl_write function already present in the code.

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/broadcom.c
include/linux/brcmphy.h

index 583ef8a2ec8d3af2179bc3d83de7ac0dc38b481e..3a64b3d8eca8132a8f5c4807cfadf307e87ddd83 100644 (file)
@@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver");
 MODULE_AUTHOR("Maciej W. Rozycki");
 MODULE_LICENSE("GPL");
 
+static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
+{
+       /* The register must be written to both the Shadow Register Select and
+        * the Shadow Read Register Selector
+        */
+       phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
+                 regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
+       return phy_read(phydev, MII_BCM54XX_AUX_CTL);
+}
+
 static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
 {
        return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
index 60def78c4e1221ea75756fd34c07a66abf9fbc16..0ed66914b61c435571c0638960032735e72159df 100644 (file)
 #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX    0x0200
 #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC     0x7000
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC        0x0007
+#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT  12
 
 #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK        0x0007