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