704-14-v5.19-net-mtk_eth_soc-add-fixme-comment-for-state-speed-us.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 650a49bc65df6b0e0051a8f62d7c22d95a8f350d Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Wed, 18 May 2022 15:55:07 +0100
  4. Subject: [PATCH 08/12] net: mtk_eth_soc: add fixme comment for state->speed
  5. use
  6. Add a fixme comment for the last remaining incorrect usage of
  7. state->speed in the mac_config() method, which is strangely in a code
  8. path which is only run when the PHY interface mode changes.
  9. This means if we are in RGMII mode, changes in state->speed will not
  10. cause the INTF_MODE, TRGMII_RCK_CTRL and TRGMII_TCK_CTRL registers to
  11. be set according to the speed, nor will the TRGPLL clock be set to the
  12. correct value.
  13. Signed-off-by: Russell King (Oracle) <[email protected]>
  14. Signed-off-by: Jakub Kicinski <[email protected]>
  15. ---
  16. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++++++
  17. 1 file changed, 8 insertions(+)
  18. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  19. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  20. @@ -374,6 +374,14 @@ static void mtk_mac_config(struct phylin
  21. state->interface))
  22. goto err_phy;
  23. } else {
  24. + /* FIXME: this is incorrect. Not only does it
  25. + * use state->speed (which is not guaranteed
  26. + * to be correct) but it also makes use of it
  27. + * in a code path that will only be reachable
  28. + * when the PHY interface mode changes, not
  29. + * when the speed changes. Consequently, RGMII
  30. + * is probably broken.
  31. + */
  32. mtk_gmac0_rgmii_adjust(mac->hw,
  33. state->interface,
  34. state->speed);