perf: fix build on PowerPC
[openwrt/staging/stintel.git] / target / linux / kirkwood / patches-6.1 / 005-6.7-net-dsa-mv88e6xxx-fix-marvell-6350-switch-probing.patch
1 From b3f1a164c7f742503dc7159011f7ad6b092b660e Mon Sep 17 00:00:00 2001
2 From: Greg Ungerer <gerg@kernel.org>
3 Date: Fri, 24 Nov 2023 14:15:28 +1000
4 Subject: [PATCH] net: dsa: mv88e6xxx: fix marvell 6350 switch probing
5
6 As of commit de5c9bf40c45 ("net: phylink: require supported_interfaces to
7 be filled") Marvell 88e6350 switches fail to be probed:
8
9 ...
10 mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
11 mv88e6085 d0072004.mdio-mii:11: phylink: error: empty supported_interfaces
12 error creating PHYLINK: -22
13 mv88e6085: probe of d0072004.mdio-mii:11 failed with error -22
14 ...
15
16 The problem stems from the use of mv88e6185_phylink_get_caps() to get
17 the device capabilities. Create a new dedicated phylink_get_caps for the
18 6351 family (which the 6350 is one of) to properly support their set of
19 capabilities.
20
21 According to chip.h the 6351 switch family includes the 6171, 6175, 6350
22 and 6351 switches, so update each of these to use the correct
23 phylink_get_caps.
24
25 Fixes: de5c9bf40c45 ("net: phylink: require supported_interfaces to be filled")
26 Signed-off-by: Greg Ungerer <gerg@kernel.org>
27 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
28 Signed-off-by: David S. Miller <davem@davemloft.net>
29 ---
30 drivers/net/dsa/mv88e6xxx/chip.c | 20 ++++++++++++++++----
31 1 file changed, 16 insertions(+), 4 deletions(-)
32
33 --- a/drivers/net/dsa/mv88e6xxx/chip.c
34 +++ b/drivers/net/dsa/mv88e6xxx/chip.c
35 @@ -652,6 +652,18 @@ static void mv88e6250_phylink_get_caps(s
36 config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100;
37 }
38
39 +static void mv88e6351_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
40 + struct phylink_config *config)
41 +{
42 + unsigned long *supported = config->supported_interfaces;
43 +
44 + /* Translate the default cmode */
45 + mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported);
46 +
47 + config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 |
48 + MAC_1000FD;
49 +}
50 +
51 static int mv88e6352_get_port4_serdes_cmode(struct mv88e6xxx_chip *chip)
52 {
53 u16 reg, val;
54 @@ -4498,7 +4510,7 @@ static const struct mv88e6xxx_ops mv88e6
55 .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
56 .stu_getnext = mv88e6352_g1_stu_getnext,
57 .stu_loadpurge = mv88e6352_g1_stu_loadpurge,
58 - .phylink_get_caps = mv88e6185_phylink_get_caps,
59 + .phylink_get_caps = mv88e6351_phylink_get_caps,
60 };
61
62 static const struct mv88e6xxx_ops mv88e6172_ops = {
63 @@ -4599,7 +4611,7 @@ static const struct mv88e6xxx_ops mv88e6
64 .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
65 .stu_getnext = mv88e6352_g1_stu_getnext,
66 .stu_loadpurge = mv88e6352_g1_stu_loadpurge,
67 - .phylink_get_caps = mv88e6185_phylink_get_caps,
68 + .phylink_get_caps = mv88e6351_phylink_get_caps,
69 };
70
71 static const struct mv88e6xxx_ops mv88e6176_ops = {
72 @@ -5256,7 +5268,7 @@ static const struct mv88e6xxx_ops mv88e6
73 .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
74 .stu_getnext = mv88e6352_g1_stu_getnext,
75 .stu_loadpurge = mv88e6352_g1_stu_loadpurge,
76 - .phylink_get_caps = mv88e6185_phylink_get_caps,
77 + .phylink_get_caps = mv88e6351_phylink_get_caps,
78 };
79
80 static const struct mv88e6xxx_ops mv88e6351_ops = {
81 @@ -5302,7 +5314,7 @@ static const struct mv88e6xxx_ops mv88e6
82 .stu_loadpurge = mv88e6352_g1_stu_loadpurge,
83 .avb_ops = &mv88e6352_avb_ops,
84 .ptp_ops = &mv88e6352_ptp_ops,
85 - .phylink_get_caps = mv88e6185_phylink_get_caps,
86 + .phylink_get_caps = mv88e6351_phylink_get_caps,
87 };
88
89 static const struct mv88e6xxx_ops mv88e6352_ops = {