751-v5.16-net-dsa-qca8k-fix-internal-delay-applied-to-the-wrong-PAD.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 3b00a07c2443745d62babfe08dbb2ad8e649526e Mon Sep 17 00:00:00 2001
  2. From: Ansuel Smith <[email protected]>
  3. Date: Fri, 19 Nov 2021 03:03:49 +0100
  4. Subject: [PATCH] net: dsa: qca8k: fix internal delay applied to the wrong PAD
  5. config
  6. With SGMII phy the internal delay is always applied to the PAD0 config.
  7. This is caused by the falling edge configuration that hardcode the reg
  8. to PAD0 (as the falling edge bits are present only in PAD0 reg)
  9. Move the delay configuration before the reg overwrite to correctly apply
  10. the delay.
  11. Fixes: cef08115846e ("net: dsa: qca8k: set internal delay also for sgmii")
  12. Signed-off-by: Ansuel Smith <[email protected]>
  13. Reviewed-by: Vladimir Oltean <[email protected]>
  14. Signed-off-by: David S. Miller <[email protected]>
  15. ---
  16. drivers/net/dsa/qca8k.c | 12 ++++++------
  17. 1 file changed, 6 insertions(+), 6 deletions(-)
  18. --- a/drivers/net/dsa/qca8k.c
  19. +++ b/drivers/net/dsa/qca8k.c
  20. @@ -1433,6 +1433,12 @@ qca8k_phylink_mac_config(struct dsa_swit
  21. qca8k_write(priv, QCA8K_REG_SGMII_CTRL, val);
  22. + /* From original code is reported port instability as SGMII also
  23. + * require delay set. Apply advised values here or take them from DT.
  24. + */
  25. + if (state->interface == PHY_INTERFACE_MODE_SGMII)
  26. + qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg);
  27. +
  28. /* For qca8327/qca8328/qca8334/qca8338 sgmii is unique and
  29. * falling edge is set writing in the PORT0 PAD reg
  30. */
  31. @@ -1455,12 +1461,6 @@ qca8k_phylink_mac_config(struct dsa_swit
  32. QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE,
  33. val);
  34. - /* From original code is reported port instability as SGMII also
  35. - * require delay set. Apply advised values here or take them from DT.
  36. - */
  37. - if (state->interface == PHY_INTERFACE_MODE_SGMII)
  38. - qca8k_mac_config_setup_internal_delay(priv, cpu_port_index, reg);
  39. -
  40. break;
  41. default:
  42. dev_err(ds->dev, "xMII mode %s not supported for port %d\n",