076-v4.15-0001-net-phy-broadcom-support-new-device-flag-for-setting.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From 2355a6546a053b1c16ebefd6ce1f0cccc00e1da5 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Thu, 12 Oct 2017 10:21:25 +0200
  4. Subject: [PATCH] net: phy: broadcom: support new device flag for setting
  5. master mode
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Some of Broadcom's PHYs run by default in slave mode with Automatic
  10. Slave/Master configuration disabled. It stops them from working properly
  11. with some devices.
  12. So far it has been verified for BCM54210E and BCM50212E which don't
  13. work well with Intel's I217-LM and I218-LM:
  14. http://ark.intel.com/products/60019/Intel-Ethernet-Connection-I217-LM
  15. http://ark.intel.com/products/71307/Intel-Ethernet-Connection-I218-LM
  16. I was told there is massive ping loss.
  17. This commit adds support for a new flag which can be set by an ethernet
  18. driver to fixup PHY setup.
  19. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20. Signed-off-by: David S. Miller <davem@davemloft.net>
  21. ---
  22. drivers/net/phy/broadcom.c | 6 ++++++
  23. include/linux/brcmphy.h | 1 +
  24. 2 files changed, 7 insertions(+)
  25. --- a/drivers/net/phy/broadcom.c
  26. +++ b/drivers/net/phy/broadcom.c
  27. @@ -43,6 +43,12 @@ static int bcm54210e_config_init(struct
  28. val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
  29. bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
  30. + if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
  31. + val = phy_read(phydev, MII_CTRL1000);
  32. + val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
  33. + phy_write(phydev, MII_CTRL1000, val);
  34. + }
  35. +
  36. return 0;
  37. }
  38. --- a/include/linux/brcmphy.h
  39. +++ b/include/linux/brcmphy.h
  40. @@ -59,6 +59,7 @@
  41. #define PHY_BRCM_EXT_IBND_TX_ENABLE 0x00002000
  42. #define PHY_BRCM_CLEAR_RGMII_MODE 0x00004000
  43. #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00008000
  44. +#define PHY_BRCM_EN_MASTER_MODE 0x00010000
  45. /* Broadcom BCM7xxx specific workarounds */
  46. #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff)