705-05-v5.19-net-dsa-mt7530-only-indicate-linkmodes-that-can-be-s.patch 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 3c1d788a62dc648d1846049b66119ebb69dedd52 Mon Sep 17 00:00:00 2001
  2. From: "Russell King (Oracle)" <[email protected]>
  3. Date: Mon, 11 Apr 2022 10:46:17 +0100
  4. Subject: [PATCH 05/13] net: dsa: mt7530: only indicate linkmodes that can be
  5. supported
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Now that mt7530 is not using the basex helper, it becomes unnecessary to
  10. indicate support for both 1000baseX and 2500baseX when one of the 803.3z
  11. PHY interface modes is being selected. Ensure that the driver indicates
  12. only those linkmodes that can actually be supported by the PHY interface
  13. mode.
  14. Tested-by: Marek Behún <[email protected]>
  15. Signed-off-by: Russell King (Oracle) <[email protected]>
  16. Signed-off-by: Paolo Abeni <[email protected]>
  17. ---
  18. drivers/net/dsa/mt7530.c | 12 ++++++++----
  19. drivers/net/dsa/mt7530.h | 1 +
  20. 2 files changed, 9 insertions(+), 4 deletions(-)
  21. --- a/drivers/net/dsa/mt7530.c
  22. +++ b/drivers/net/dsa/mt7530.c
  23. @@ -2632,12 +2632,13 @@ static int mt7531_rgmii_setup(struct mt7
  24. }
  25. static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port,
  26. + phy_interface_t interface,
  27. unsigned long *supported)
  28. {
  29. /* Port5 supports ethier RGMII or SGMII.
  30. * Port6 supports SGMII only.
  31. */
  32. - if (port == 6) {
  33. + if (port == 6 && interface == PHY_INTERFACE_MODE_2500BASEX) {
  34. phylink_set(supported, 2500baseX_Full);
  35. phylink_set(supported, 2500baseT_Full);
  36. }
  37. @@ -3010,16 +3011,18 @@ static void mt753x_phylink_get_caps(stru
  38. static void
  39. mt7530_mac_port_validate(struct dsa_switch *ds, int port,
  40. + phy_interface_t interface,
  41. unsigned long *supported)
  42. {
  43. }
  44. static void mt7531_mac_port_validate(struct dsa_switch *ds, int port,
  45. + phy_interface_t interface,
  46. unsigned long *supported)
  47. {
  48. struct mt7530_priv *priv = ds->priv;
  49. - mt7531_sgmii_validate(priv, port, supported);
  50. + mt7531_sgmii_validate(priv, port, interface, supported);
  51. }
  52. static void
  53. @@ -3042,12 +3045,13 @@ mt753x_phylink_validate(struct dsa_switc
  54. }
  55. /* This switch only supports 1G full-duplex. */
  56. - if (state->interface != PHY_INTERFACE_MODE_MII) {
  57. + if (state->interface != PHY_INTERFACE_MODE_MII &&
  58. + state->interface != PHY_INTERFACE_MODE_2500BASEX) {
  59. phylink_set(mask, 1000baseT_Full);
  60. phylink_set(mask, 1000baseX_Full);
  61. }
  62. - priv->info->mac_port_validate(ds, port, mask);
  63. + priv->info->mac_port_validate(ds, port, state->interface, mask);
  64. phylink_set(mask, Pause);
  65. phylink_set(mask, Asym_Pause);
  66. --- a/drivers/net/dsa/mt7530.h
  67. +++ b/drivers/net/dsa/mt7530.h
  68. @@ -799,6 +799,7 @@ struct mt753x_info {
  69. void (*mac_port_get_caps)(struct dsa_switch *ds, int port,
  70. struct phylink_config *config);
  71. void (*mac_port_validate)(struct dsa_switch *ds, int port,
  72. + phy_interface_t interface,
  73. unsigned long *supported);
  74. int (*mac_port_get_state)(struct dsa_switch *ds, int port,
  75. struct phylink_link_state *state);