071-v4.15-0001-net-bgmac-enable-master-mode-for-BCM54210E-and-B5021.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 12acd136913ccdf394eeb2bc8686ff5505368119 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:26 +0200
  4. Subject: [PATCH] net: bgmac: enable master mode for BCM54210E and B50212E PHYs
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. There are 4 very similar PHYs:
  9. 0x600d84a1: BCM54210E (rev B0)
  10. 0x600d84a2: BCM54210E (rev B1)
  11. 0x600d84a5: B50212E (rev B0)
  12. 0x600d84a6: B50212E (rev B1)
  13. that need setting master mode manually. It's because they run in slave
  14. mode by default with Automatic Slave/Master configuration disabled which
  15. can lead to unreliable connection with massive ping loss.
  16. So far it was reported for a board with BCM47189 SoC and B50212E B1 PHY
  17. connected to the bgmac supported ethernet device. Telling PHY driver to
  18. setup PHY properly solves this issue.
  19. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  20. Signed-off-by: David S. Miller <davem@davemloft.net>
  21. ---
  22. drivers/net/ethernet/broadcom/bgmac-bcma.c | 8 +++++++-
  23. 1 file changed, 7 insertions(+), 1 deletion(-)
  24. --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
  25. +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
  26. @@ -184,13 +184,19 @@ static int bgmac_probe(struct bcma_devic
  27. if (!bgmac_is_bcm4707_family(core) &&
  28. !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
  29. + struct phy_device *phydev;
  30. +
  31. mii_bus = bcma_mdio_mii_register(bgmac);
  32. if (IS_ERR(mii_bus)) {
  33. err = PTR_ERR(mii_bus);
  34. goto err;
  35. }
  36. -
  37. bgmac->mii_bus = mii_bus;
  38. +
  39. + phydev = mdiobus_get_phy(bgmac->mii_bus, bgmac->phyaddr);
  40. + if (ci->id == BCMA_CHIP_ID_BCM53573 && phydev &&
  41. + (phydev->drv->phy_id & phydev->drv->phy_id_mask) == PHY_ID_BCM54210E)
  42. + phydev->dev_flags |= PHY_BRCM_EN_MASTER_MODE;
  43. }
  44. if (core->bus->hosttype == BCMA_HOSTTYPE_PCI) {