40d22f46526d79ed0be5139706c1a3faa27108d6
[openwrt/staging/981213.git] /
1 From 3f911800613a3417101563b488c51a9b310ba7fa Mon Sep 17 00:00:00 2001
2 From: Vladimir Oltean <vladimir.oltean@nxp.com>
3 Date: Fri, 27 Dec 2019 20:14:57 +0200
4 Subject: [PATCH] net: dsa: Pass pcs_poll flag from driver to PHYLINK
5
6 The DSA drivers that implement .phylink_mac_link_state should normally
7 register an interrupt for the PCS, from which they should call
8 phylink_mac_change(). However not all switches implement this, and those
9 who don't should set this flag in dsa_switch in the .setup callback, so
10 that PHYLINK will poll for a few ms until the in-band AN link timer
11 expires and the PCS state settles.
12
13 Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
14
15 Conflicts:
16 include/net/dsa.h
17
18 trivially with upstream commit 05f294a85235 ("net: dsa: allocate ports
19 on 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 @@ -277,6 +277,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 @@ -625,6 +625,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);