701-net-0381-net-dsa-Pass-pcs_poll-flag-from-driver-to-PHYLINK.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 3f911800613a3417101563b488c51a9b310ba7fa Mon Sep 17 00:00:00 2001
  2. From: Vladimir Oltean <[email protected]>
  3. Date: Fri, 27 Dec 2019 20:14:57 +0200
  4. Subject: [PATCH] net: dsa: Pass pcs_poll flag from driver to PHYLINK
  5. The DSA drivers that implement .phylink_mac_link_state should normally
  6. register an interrupt for the PCS, from which they should call
  7. phylink_mac_change(). However not all switches implement this, and those
  8. who don't should set this flag in dsa_switch in the .setup callback, so
  9. that PHYLINK will poll for a few ms until the in-band AN link timer
  10. expires and the PCS state settles.
  11. Signed-off-by: Vladimir Oltean <[email protected]>
  12. Conflicts:
  13. include/net/dsa.h
  14. trivially with upstream commit 05f294a85235 ("net: dsa: allocate ports
  15. on touch") which was merged in v5.4-rc3.
  16. ---
  17. include/net/dsa.h | 5 +++++
  18. net/dsa/port.c | 1 +
  19. 2 files changed, 6 insertions(+)
  20. --- a/include/net/dsa.h
  21. +++ b/include/net/dsa.h
  22. @@ -284,6 +284,11 @@ struct dsa_switch {
  23. */
  24. bool vlan_filtering;
  25. + /* MAC PCS does not provide link state change interrupt, and requires
  26. + * polling. Flag passed on to PHYLINK.
  27. + */
  28. + bool pcs_poll;
  29. +
  30. /* Dynamically allocated ports, keep last */
  31. size_t num_ports;
  32. struct dsa_port ports[];
  33. --- a/net/dsa/port.c
  34. +++ b/net/dsa/port.c
  35. @@ -639,6 +639,7 @@ static int dsa_port_phylink_register(str
  36. dp->pl_config.dev = ds->dev;
  37. dp->pl_config.type = PHYLINK_DEV;
  38. + dp->pl_config.pcs_poll = ds->pcs_poll;
  39. dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn),
  40. mode, &dsa_port_phylink_mac_ops);