735-v5.14-23-net-dsa-qca8k-pass-switch_revision-info-to-phy-dev_f.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From a46aec02bc06ac2c33f326339e4ef88c735dc30d Mon Sep 17 00:00:00 2001
  2. From: Ansuel Smith <[email protected]>
  3. Date: Fri, 14 May 2021 23:00:13 +0200
  4. Subject: [PATCH] net: dsa: qca8k: pass switch_revision info to phy dev_flags
  5. Define get_phy_flags to pass switch_Revision needed to tweak the
  6. internal PHY with debug values based on the revision.
  7. Signed-off-by: Ansuel Smith <[email protected]>
  8. Reviewed-by: Florian Fainelli <[email protected]>
  9. Signed-off-by: David S. Miller <[email protected]>
  10. ---
  11. drivers/net/dsa/qca8k.c | 17 +++++++++++++++++
  12. 1 file changed, 17 insertions(+)
  13. --- a/drivers/net/dsa/qca8k.c
  14. +++ b/drivers/net/dsa/qca8k.c
  15. @@ -1740,6 +1740,22 @@ qca8k_port_vlan_del(struct dsa_switch *d
  16. return ret;
  17. }
  18. +static u32 qca8k_get_phy_flags(struct dsa_switch *ds, int port)
  19. +{
  20. + struct qca8k_priv *priv = ds->priv;
  21. +
  22. + /* Communicate to the phy internal driver the switch revision.
  23. + * Based on the switch revision different values needs to be
  24. + * set to the dbg and mmd reg on the phy.
  25. + * The first 2 bit are used to communicate the switch revision
  26. + * to the phy driver.
  27. + */
  28. + if (port > 0 && port < 6)
  29. + return priv->switch_revision;
  30. +
  31. + return 0;
  32. +}
  33. +
  34. static enum dsa_tag_protocol
  35. qca8k_get_tag_protocol(struct dsa_switch *ds, int port,
  36. enum dsa_tag_protocol mp)
  37. @@ -1774,6 +1790,7 @@ static const struct dsa_switch_ops qca8k
  38. .phylink_mac_config = qca8k_phylink_mac_config,
  39. .phylink_mac_link_down = qca8k_phylink_mac_link_down,
  40. .phylink_mac_link_up = qca8k_phylink_mac_link_up,
  41. + .get_phy_flags = qca8k_get_phy_flags,
  42. };
  43. static int qca8k_read_switch_id(struct qca8k_priv *priv)