790-26-v6.9-net-dsa-mt7530-sort-link-settings-ops-and-force-link.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From aa474698f75f4790a4de2052dd487736d2361b2e Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <[email protected]>
  3. Date: Fri, 1 Mar 2024 12:43:04 +0200
  4. Subject: [PATCH 26/30] net: dsa: mt7530: sort link settings ops and force link
  5. down on all ports
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. port_enable and port_disable clears the link settings. Move that to
  10. mt7530_setup() and mt7531_setup_common() which set up the switches. This
  11. way, the link settings are cleared on all ports at setup, and then only
  12. once with phylink_mac_link_down() when a link goes down.
  13. Enable force mode at setup to apply the force part of the link settings.
  14. This ensures that disabled ports will have their link down.
  15. Suggested-by: Vladimir Oltean <[email protected]>
  16. Signed-off-by: Arınç ÜNAL <[email protected]>
  17. Signed-off-by: Paolo Abeni <[email protected]>
  18. ---
  19. drivers/net/dsa/mt7530.c | 14 ++++++++++++--
  20. 1 file changed, 12 insertions(+), 2 deletions(-)
  21. --- a/drivers/net/dsa/mt7530.c
  22. +++ b/drivers/net/dsa/mt7530.c
  23. @@ -1215,7 +1215,6 @@ mt7530_port_enable(struct dsa_switch *ds
  24. priv->ports[port].enable = true;
  25. mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
  26. priv->ports[port].pm);
  27. - mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
  28. mutex_unlock(&priv->reg_mutex);
  29. @@ -1235,7 +1234,6 @@ mt7530_port_disable(struct dsa_switch *d
  30. priv->ports[port].enable = false;
  31. mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK,
  32. PCR_MATRIX_CLR);
  33. - mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
  34. mutex_unlock(&priv->reg_mutex);
  35. }
  36. @@ -2457,6 +2455,12 @@ mt7530_setup(struct dsa_switch *ds)
  37. mt7530_mib_reset(ds);
  38. for (i = 0; i < MT7530_NUM_PORTS; i++) {
  39. + /* Clear link settings and enable force mode to force link down
  40. + * on all ports until they're enabled later.
  41. + */
  42. + mt7530_rmw(priv, MT7530_PMCR_P(i), PMCR_LINK_SETTINGS_MASK |
  43. + PMCR_FORCE_MODE, PMCR_FORCE_MODE);
  44. +
  45. /* Disable forwarding by default on all ports */
  46. mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
  47. PCR_MATRIX_CLR);
  48. @@ -2562,6 +2566,12 @@ mt7531_setup_common(struct dsa_switch *d
  49. UNU_FFP_MASK);
  50. for (i = 0; i < MT7530_NUM_PORTS; i++) {
  51. + /* Clear link settings and enable force mode to force link down
  52. + * on all ports until they're enabled later.
  53. + */
  54. + mt7530_rmw(priv, MT7530_PMCR_P(i), PMCR_LINK_SETTINGS_MASK |
  55. + MT7531_FORCE_MODE, MT7531_FORCE_MODE);
  56. +
  57. /* Disable forwarding by default on all ports */
  58. mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
  59. PCR_MATRIX_CLR);