722-net-mt7531-only-do-PLL-once-after-the-reset.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 9fec662b54fc956b776df15c704e996c61292850 Mon Sep 17 00:00:00 2001
  2. From: Alexander Couzens <[email protected]>
  3. Date: Sat, 13 Aug 2022 13:05:09 +0200
  4. Subject: [PATCH 02/10] net: mt7531: only do PLL once after the reset
  5. Move the PLL init of the switch out of the pad configuration of the port
  6. 6 (usally cpu port).
  7. Fix a unidirectional 100 mbit limitation on 1 gbit or 2.5 gbit links for
  8. outbound traffic on port 5 or port 6.
  9. Signed-off-by: Alexander Couzens <[email protected]>
  10. ---
  11. drivers/net/dsa/mt7530.c | 15 +++++++++------
  12. 1 file changed, 9 insertions(+), 6 deletions(-)
  13. --- a/drivers/net/dsa/mt7530.c
  14. +++ b/drivers/net/dsa/mt7530.c
  15. @@ -506,14 +506,19 @@ static bool mt7531_dual_sgmii_supported(
  16. static int
  17. mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
  18. {
  19. - struct mt7530_priv *priv = ds->priv;
  20. + return 0;
  21. +}
  22. +
  23. +static void
  24. +mt7531_pll_setup(struct mt7530_priv *priv)
  25. +{
  26. u32 top_sig;
  27. u32 hwstrap;
  28. u32 xtal;
  29. u32 val;
  30. if (mt7531_dual_sgmii_supported(priv))
  31. - return 0;
  32. + return;
  33. val = mt7530_read(priv, MT7531_CREV);
  34. top_sig = mt7530_read(priv, MT7531_TOP_SIG_SR);
  35. @@ -592,8 +597,6 @@ mt7531_pad_setup(struct dsa_switch *ds,
  36. val |= EN_COREPLL;
  37. mt7530_write(priv, MT7531_PLLGP_EN, val);
  38. usleep_range(25, 35);
  39. -
  40. - return 0;
  41. }
  42. static void
  43. @@ -2326,6 +2329,8 @@ mt7531_setup(struct dsa_switch *ds)
  44. SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |
  45. SYS_CTRL_REG_RST);
  46. + mt7531_pll_setup(priv);
  47. +
  48. if (mt7531_dual_sgmii_supported(priv)) {
  49. priv->p5_intf_sel = P5_INTF_SEL_GMAC5_SGMII;
  50. @@ -2882,8 +2887,6 @@ mt7531_cpu_port_config(struct dsa_switch
  51. case 6:
  52. interface = PHY_INTERFACE_MODE_2500BASEX;
  53. - mt7531_pad_setup(ds, interface);
  54. -
  55. priv->p6_interface = interface;
  56. break;
  57. default: