071-v4.10-0003-net-bgmac-use-PHY-subsystem-for-initializing-PHY.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 8e6f31baba7e2c13ab7e954fe6179420a7545a8b Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
  3. Date: Tue, 31 Jan 2017 19:37:56 +0100
  4. Subject: [PATCH 3/3] net: bgmac: use PHY subsystem for initializing PHY
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. This adds support for using bgmac with PHYs supported by standalone PHY
  9. drivers. Having any PHY initialization in bgmac is hacky and shouldn't
  10. be extended but rather removed if anyone has hardware to test it.
  11. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  12. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  13. Signed-off-by: David S. Miller <davem@davemloft.net>
  14. ---
  15. drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c | 10 ++++++++++
  16. 1 file changed, 10 insertions(+)
  17. --- a/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
  18. +++ b/drivers/net/ethernet/broadcom/bgmac-bcma-mdio.c
  19. @@ -132,6 +132,10 @@ static void bcma_mdio_phy_init(struct bg
  20. struct bcma_chipinfo *ci = &bgmac->bcma.core->bus->chipinfo;
  21. u8 i;
  22. + /* For some legacy hardware we do chipset-based PHY initialization here
  23. + * without even detecting PHY ID. It's hacky and should be cleaned as
  24. + * soon as someone can test it.
  25. + */
  26. if (ci->id == BCMA_CHIP_ID_BCM5356) {
  27. for (i = 0; i < 5; i++) {
  28. bcma_mdio_phy_write(bgmac, i, 0x1f, 0x008b);
  29. @@ -140,6 +144,7 @@ static void bcma_mdio_phy_init(struct bg
  30. bcma_mdio_phy_write(bgmac, i, 0x12, 0x2aaa);
  31. bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b);
  32. }
  33. + return;
  34. }
  35. if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg != 10) ||
  36. (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg != 10) ||
  37. @@ -161,7 +166,12 @@ static void bcma_mdio_phy_init(struct bg
  38. bcma_mdio_phy_write(bgmac, i, 0x17, 0x9273);
  39. bcma_mdio_phy_write(bgmac, i, 0x1f, 0x000b);
  40. }
  41. + return;
  42. }
  43. +
  44. + /* For all other hw do initialization using PHY subsystem. */
  45. + if (bgmac->net_dev && bgmac->net_dev->phydev)
  46. + phy_init_hw(bgmac->net_dev->phydev);
  47. }
  48. /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipphyreset */