075-v4.10-0003-net-phy-broadcom-add-bcm54xx_auxctl_read.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From: Jon Mason <jon.mason@broadcom.com>
  2. Date: Fri, 4 Nov 2016 01:10:56 -0400
  3. Subject: [PATCH] net: phy: broadcom: add bcm54xx_auxctl_read
  4. Add a helper function to read the AUXCTL register for the BCM54xx. This
  5. mirrors the bcm54xx_auxctl_write function already present in the code.
  6. Signed-off-by: Jon Mason <jon.mason@broadcom.com>
  7. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  8. Signed-off-by: David S. Miller <davem@davemloft.net>
  9. ---
  10. --- a/drivers/net/phy/broadcom.c
  11. +++ b/drivers/net/phy/broadcom.c
  12. @@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver"
  13. MODULE_AUTHOR("Maciej W. Rozycki");
  14. MODULE_LICENSE("GPL");
  15. +static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
  16. +{
  17. + /* The register must be written to both the Shadow Register Select and
  18. + * the Shadow Read Register Selector
  19. + */
  20. + phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
  21. + regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
  22. + return phy_read(phydev, MII_BCM54XX_AUX_CTL);
  23. +}
  24. +
  25. static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
  26. {
  27. return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
  28. --- a/include/linux/brcmphy.h
  29. +++ b/include/linux/brcmphy.h
  30. @@ -110,6 +110,7 @@
  31. #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200
  32. #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000
  33. #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007
  34. +#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12
  35. #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007