076-v4.11-0006-net-phy-broadcom-add-support-for-BCM54210E.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  2. Date: Fri, 27 Jan 2017 14:07:01 +0100
  3. Subject: [PATCH] net: phy: broadcom: add support for BCM54210E
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. It's Broadcom PHY simply described as single-port
  8. RGMII 10/100/1000BASE-T PHY. It requires disabling delay skew and GTXCLK
  9. bits.
  10. Signed-off-by: Rafał Miłecki <[email protected]>
  11. Signed-off-by: David S. Miller <[email protected]>
  12. ---
  13. --- a/drivers/net/phy/broadcom.c
  14. +++ b/drivers/net/phy/broadcom.c
  15. @@ -30,6 +30,22 @@ MODULE_DESCRIPTION("Broadcom PHY driver"
  16. MODULE_AUTHOR("Maciej W. Rozycki");
  17. MODULE_LICENSE("GPL");
  18. +static int bcm54210e_config_init(struct phy_device *phydev)
  19. +{
  20. + int val;
  21. +
  22. + val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
  23. + val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
  24. + val |= MII_BCM54XX_AUXCTL_MISC_WREN;
  25. + bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC, val);
  26. +
  27. + val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
  28. + val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
  29. + bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
  30. +
  31. + return 0;
  32. +}
  33. +
  34. static int bcm54810_config(struct phy_device *phydev)
  35. {
  36. int rc, val;
  37. @@ -230,7 +246,11 @@ static int bcm54xx_config_init(struct ph
  38. (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE))
  39. bcm54xx_adjust_rxrefclk(phydev);
  40. - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
  41. + if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E) {
  42. + err = bcm54210e_config_init(phydev);
  43. + if (err)
  44. + return err;
  45. + } else if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810) {
  46. err = bcm54810_config(phydev);
  47. if (err)
  48. return err;
  49. @@ -544,6 +564,17 @@ static struct phy_driver broadcom_driver
  50. .ack_interrupt = bcm_phy_ack_intr,
  51. .config_intr = bcm_phy_config_intr,
  52. }, {
  53. + .phy_id = PHY_ID_BCM54210E,
  54. + .phy_id_mask = 0xfffffff0,
  55. + .name = "Broadcom BCM54210E",
  56. + .features = PHY_GBIT_FEATURES,
  57. + .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT,
  58. + .config_init = bcm54xx_config_init,
  59. + .config_aneg = genphy_config_aneg,
  60. + .read_status = genphy_read_status,
  61. + .ack_interrupt = bcm_phy_ack_intr,
  62. + .config_intr = bcm_phy_config_intr,
  63. +}, {
  64. .phy_id = PHY_ID_BCM5461,
  65. .phy_id_mask = 0xfffffff0,
  66. .name = "Broadcom BCM5461",
  67. @@ -694,6 +725,7 @@ module_phy_driver(broadcom_drivers);
  68. static struct mdio_device_id __maybe_unused broadcom_tbl[] = {
  69. { PHY_ID_BCM5411, 0xfffffff0 },
  70. { PHY_ID_BCM5421, 0xfffffff0 },
  71. + { PHY_ID_BCM54210E, 0xfffffff0 },
  72. { PHY_ID_BCM5461, 0xfffffff0 },
  73. { PHY_ID_BCM54612E, 0xfffffff0 },
  74. { PHY_ID_BCM54616S, 0xfffffff0 },
  75. --- a/include/linux/brcmphy.h
  76. +++ b/include/linux/brcmphy.h
  77. @@ -17,6 +17,7 @@
  78. #define PHY_ID_BCM5482 0x0143bcb0
  79. #define PHY_ID_BCM5411 0x00206070
  80. #define PHY_ID_BCM5421 0x002060e0
  81. +#define PHY_ID_BCM54210E 0x600d84a0
  82. #define PHY_ID_BCM5464 0x002060b0
  83. #define PHY_ID_BCM5461 0x002060c0
  84. #define PHY_ID_BCM54612E 0x03625e60