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