733-v6.2-09-net-mtk_eth_soc-add-advertisement-programming.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From c125c66ea71b9377ae2478c4f1b87b180cc5c6ef Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Thu, 27 Oct 2022 14:11:18 +0100
  4. Subject: [PATCH 08/10] net: mtk_eth_soc: add advertisement programming
  5. Program the advertisement into the mtk PCS block.
  6. Signed-off-by: Russell King (Oracle) <[email protected]>
  7. Signed-off-by: Jakub Kicinski <[email protected]>
  8. ---
  9. drivers/net/ethernet/mediatek/mtk_sgmii.c | 13 ++++++++++++-
  10. 1 file changed, 12 insertions(+), 1 deletion(-)
  11. --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c
  12. +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c
  13. @@ -70,16 +70,27 @@ static int mtk_pcs_config(struct phylink
  14. {
  15. struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs);
  16. unsigned int rgc3;
  17. + int advertise;
  18. + bool changed;
  19. if (interface == PHY_INTERFACE_MODE_2500BASEX)
  20. rgc3 = RG_PHY_SPEED_3_125G;
  21. else
  22. rgc3 = 0;
  23. + advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
  24. + advertising);
  25. + if (advertise < 0)
  26. + return advertise;
  27. +
  28. /* Configure the underlying interface speed */
  29. regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3,
  30. RG_PHY_SPEED_3_125G, rgc3);
  31. + /* Update the advertisement, noting whether it has changed */
  32. + regmap_update_bits_check(mpcs->regmap, SGMSYS_PCS_ADVERTISE,
  33. + SGMII_ADVERTISE, advertise, &changed);
  34. +
  35. /* Setup SGMIISYS with the determined property */
  36. if (interface != PHY_INTERFACE_MODE_SGMII)
  37. mtk_pcs_setup_mode_force(mpcs, interface);
  38. @@ -90,7 +101,7 @@ static int mtk_pcs_config(struct phylink
  39. regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL,
  40. SGMII_PHYA_PWD, 0);
  41. - return 0;
  42. + return changed;
  43. }
  44. static void mtk_pcs_restart_an(struct phylink_pcs *pcs)