078-0004-net-phy-pick-Broadcom-drivers-updates-from-net-next-.patch 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. --- a/drivers/net/phy/broadcom.c
  2. +++ b/drivers/net/phy/broadcom.c
  3. @@ -30,6 +30,50 @@ MODULE_DESCRIPTION("Broadcom PHY driver"
  4. MODULE_AUTHOR("Maciej W. Rozycki");
  5. MODULE_LICENSE("GPL");
  6. +static int bcm54210e_config_init(struct phy_device *phydev)
  7. +{
  8. + int val;
  9. +
  10. + val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
  11. + val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
  12. + val |= MII_BCM54XX_AUXCTL_MISC_WREN;
  13. + bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val);
  14. +
  15. + val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
  16. + val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
  17. + bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
  18. +
  19. + return 0;
  20. +}
  21. +
  22. +static int bcm54612e_config_init(struct phy_device *phydev)
  23. +{
  24. + /* Clear TX internal delay unless requested. */
  25. + if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
  26. + (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
  27. + /* Disable TXD to GTXCLK clock delay (default set) */
  28. + /* Bit 9 is the only field in shadow register 00011 */
  29. + bcm_phy_write_shadow(phydev, 0x03, 0);
  30. + }
  31. +
  32. + /* Clear RX internal delay unless requested. */
  33. + if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
  34. + (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
  35. + u16 reg;
  36. +
  37. + reg = bcm54xx_auxctl_read(phydev,
  38. + MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
  39. + /* Disable RXD to RXC delay (default set) */
  40. + reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
  41. + /* Clear shadow selector field */
  42. + reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
  43. + bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
  44. + MII_BCM54XX_AUXCTL_MISC_WREN | reg);
  45. + }
  46. +
  47. + return 0;
  48. +}
  49. +
  50. static int bcm54810_config(struct phy_device *phydev)
  51. {
  52. int rc, val;
  53. @@ -230,7 +274,15 @@ static int bcm54xx_config_init(struct ph
  54. (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
  55. bcm54xx_adjust_rxrefclk(phydev);
  56. - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
  57. + if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) {
  58. + err = bcm54210e_config_init(phydev);
  59. + if (err)
  60. + return err;
  61. + } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54612E) {
  62. + err = bcm54612e_config_init(phydev);
  63. + if (err)
  64. + return err;
  65. + } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
  66. err = bcm54810_config(phydev);
  67. if (err)
  68. return err;
  69. @@ -375,41 +427,6 @@ static int bcm5481_config_aneg(struct ph
  70. return ret;
  71. }
  72. -static int bcm54612e_config_aneg(struct phy_device *phydev)
  73. -{
  74. - int ret;
  75. -
  76. - /* First, auto-negotiate. */
  77. - ret = genphy_config_aneg(phydev);
  78. -
  79. - /* Clear TX internal delay unless requested. */
  80. - if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
  81. - (phydev->interface != PHY_INTERFACE_MODE_RGMII_TXID)) {
  82. - /* Disable TXD to GTXCLK clock delay (default set) */
  83. - /* Bit 9 is the only field in shadow register 00011 */
  84. - bcm_phy_write_shadow(phydev, 0x03, 0);
  85. - }
  86. -
  87. - /* Clear RX internal delay unless requested. */
  88. - if ((phydev->interface != PHY_INTERFACE_MODE_RGMII_ID) &&
  89. - (phydev->interface != PHY_INTERFACE_MODE_RGMII_RXID)) {
  90. - u16 reg;
  91. -
  92. - /* Errata: reads require filling in the write selector field */
  93. - bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
  94. - MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC);
  95. - reg = phy_read(phydev, MII_BCM54XX_AUX_CTL);
  96. - /* Disable RXD to RXC delay (default set) */
  97. - reg &= ~MII_BCM54XX_AUXCTL_MISC_RXD_RXC_SKEW;
  98. - /* Clear shadow selector field */
  99. - reg &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MASK;
  100. - bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
  101. - MII_BCM54XX_AUXCTL_MISC_WREN | reg);
  102. - }
  103. -
  104. - return ret;
  105. -}
  106. -
  107. static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
  108. {
  109. int val;
  110. @@ -548,6 +565,19 @@ static struct phy_driver broadcom_driver
  111. .config_intr = bcm_phy_config_intr,
  112. .driver = { .owner = THIS_MODULE },
  113. }, {
  114. + .phy_id = PHY_ID_BCM54210E,
  115. + .phy_id_mask = 0xfffffff0,
  116. + .name = "Broadcom BCM54210E",
  117. + .features = PHY_GBIT_FEATURES |
  118. + SUPPORTED_Pause | SUPPORTED_Asym_Pause,
  119. + .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
  120. + .config_init = bcm54xx_config_init,
  121. + .config_aneg = genphy_config_aneg,
  122. + .read_status = genphy_read_status,
  123. + .ack_interrupt = bcm_phy_ack_intr,
  124. + .config_intr = bcm_phy_config_intr,
  125. + .driver = { .owner = THIS_MODULE },
  126. +}, {
  127. .phy_id = PHY_ID_BCM5461,
  128. .phy_id_mask = 0xfffffff0,
  129. .name = "Broadcom BCM5461",
  130. @@ -568,7 +598,7 @@ static struct phy_driver broadcom_driver
  131. SUPPORTED_Pause | SUPPORTED_Asym_Pause,
  132. .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
  133. .config_init = bcm54xx_config_init,
  134. - .config_aneg = bcm54612e_config_aneg,
  135. + .config_aneg = genphy_config_aneg,
  136. .read_status = genphy_read_status,
  137. .ack_interrupt = bcm_phy_ack_intr,
  138. .config_intr = bcm_phy_config_intr,
  139. @@ -710,6 +740,7 @@ module_phy_driver(broadcom_drivers);
  140. static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
  141. { PHY_ID_BCM5411, 0xfffffff0 },
  142. { PHY_ID_BCM5421, 0xfffffff0 },
  143. + { PHY_ID_BCM54210E, 0xfffffff0 },
  144. { PHY_ID_BCM5461, 0xfffffff0 },
  145. { PHY_ID_BCM54612E, 0xfffffff0 },
  146. { PHY_ID_BCM54616S, 0xfffffff0 },
  147. --- a/include/linux/brcmphy.h
  148. +++ b/include/linux/brcmphy.h
  149. @@ -17,6 +17,7 @@
  150. #define PHY_ID_BCM5482 0x0143bcb0
  151. #define PHY_ID_BCM5411 0x00206070
  152. #define PHY_ID_BCM5421 0x002060e0
  153. +#define PHY_ID_BCM54210E 0x600d84a0
  154. #define PHY_ID_BCM5464 0x002060b0
  155. #define PHY_ID_BCM5461 0x002060c0
  156. #define PHY_ID_BCM54612E 0x03625e60