1
0

075-v4.10-0005-net-phy-broadcom-Move-bcm54xx_auxctl_-read-write-to-.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From: Florian Fainelli <f.fainelli@gmail.com>
  2. Date: Tue, 22 Nov 2016 11:40:54 -0800
  3. Subject: [PATCH] net: phy: broadcom: Move bcm54xx_auxctl_{read, write} to
  4. common library
  5. We are going to need these functions to implement support for Broadcom
  6. Wirespeed, aka downshift.
  7. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
  8. Signed-off-by: David S. Miller <davem@davemloft.net>
  9. ---
  10. --- a/drivers/net/phy/bcm-phy-lib.c
  11. +++ b/drivers/net/phy/bcm-phy-lib.c
  12. @@ -50,6 +50,23 @@ int bcm_phy_read_exp(struct phy_device *
  13. }
  14. EXPORT_SYMBOL_GPL(bcm_phy_read_exp);
  15. +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. +EXPORT_SYMBOL_GPL(bcm54xx_auxctl_read);
  25. +
  26. +int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
  27. +{
  28. + return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
  29. +}
  30. +EXPORT_SYMBOL(bcm54xx_auxctl_write);
  31. +
  32. int bcm_phy_write_misc(struct phy_device *phydev,
  33. u16 reg, u16 chl, u16 val)
  34. {
  35. --- a/drivers/net/phy/bcm-phy-lib.h
  36. +++ b/drivers/net/phy/bcm-phy-lib.h
  37. @@ -26,6 +26,9 @@ static inline int bcm_phy_write_exp_sel(
  38. return bcm_phy_write_exp(phydev, reg | MII_BCM54XX_EXP_SEL_ER, val);
  39. }
  40. +int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val);
  41. +int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum);
  42. +
  43. int bcm_phy_write_misc(struct phy_device *phydev,
  44. u16 reg, u16 chl, u16 value);
  45. int bcm_phy_read_misc(struct phy_device *phydev,
  46. --- a/drivers/net/phy/broadcom.c
  47. +++ b/drivers/net/phy/broadcom.c
  48. @@ -30,21 +30,6 @@ MODULE_DESCRIPTION("Broadcom PHY driver"
  49. MODULE_AUTHOR("Maciej W. Rozycki");
  50. MODULE_LICENSE("GPL");
  51. -static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
  52. -{
  53. - /* The register must be written to both the Shadow Register Select and
  54. - * the Shadow Read Register Selector
  55. - */
  56. - phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum |
  57. - regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT);
  58. - return phy_read(phydev, MII_BCM54XX_AUX_CTL);
  59. -}
  60. -
  61. -static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val)
  62. -{
  63. - return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val);
  64. -}
  65. -
  66. static int bcm54810_config(struct phy_device *phydev)
  67. {
  68. int rc, val;