diff mbox series

[1/2] net: dsa: mv88e6xxx: fix marvell 6350 switch probing

Message ID 20231122131944.2180408-1-gerg@kernel.org (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [1/2] net: dsa: mv88e6xxx: fix marvell 6350 switch probing | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/codegen success Generated files up to date
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1127 this patch: 1127
netdev/cc_maintainers warning 2 maintainers not CCed: olteanv@gmail.com f.fainelli@gmail.com
netdev/build_clang success Errors and warnings before: 1154 this patch: 1154
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1154 this patch: 1154
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 34 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Greg Ungerer Nov. 22, 2023, 1:19 p.m. UTC
As of commit de5c9bf40c45 ("net: phylink: require supported_interfaces to
be filled") Marvell 88e6350 switches fail to be probed:

    ...
    mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
    mv88e6085 d0072004.mdio-mii:11: phylink: error: empty supported_interfaces
    error creating PHYLINK: -22
    mv88e6085: probe of d0072004.mdio-mii:11 failed with error -22
    ...

The problem stems from the use of mv88e6185_phylink_get_caps() to get
the device capabilities. Create a new dedicated phylink_get_caps for the
6350 to support its more different set of capabilities. Unfortunately the
6352 switch capabilities cannot be re-used due to their support of a SERDES
lane.

The Marvell 88e6351 switch is a slightly improved version of the 6350,
but is mostly identical. It will also need the dedicated 6350 function,
so update its phylink_get_caps as well.

Fixes: de5c9bf40c45 ("net: phylink: require supported_interfaces to be filled")
Signed-off-by: Greg Ungerer <gerg@kernel.org>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Andrew Lunn Nov. 23, 2023, 7:34 p.m. UTC | #1
> The Marvell 88e6351 switch is a slightly improved version of the 6350,
> but is mostly identical. It will also need the dedicated 6350 function,
> so update its phylink_get_caps as well.

In chip.h we have:

        MV88E6XXX_FAMILY_6351,  /* 6171 6175 6350 6351 */

So please make the same change to the 6171 and 6175.

This otherwise looks O.K.

    Andrew

---
pw-bot: cr
Greg Ungerer Nov. 24, 2023, 4:13 a.m. UTC | #2
On 24/11/23 05:34, Andrew Lunn wrote:
>> The Marvell 88e6351 switch is a slightly improved version of the 6350,
>> but is mostly identical. It will also need the dedicated 6350 function,
>> so update its phylink_get_caps as well.
> 
> In chip.h we have:
> 
>          MV88E6XXX_FAMILY_6351,  /* 6171 6175 6350 6351 */
> 
> So please make the same change to the 6171 and 6175.

Will do. Given the family name is 6351 with this define I'll
make that the basename of the new get_caps that function too.

Regards
Greg


> This otherwise looks O.K.
> 
>      Andrew
> 
> ---
> pw-bot: cr
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 42b1acaca33a..e9adf9711c09 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -577,6 +577,18 @@  static void mv88e6250_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 	config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100;
 }
 
+static void mv88e6350_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
+				       struct phylink_config *config)
+{
+	unsigned long *supported = config->supported_interfaces;
+
+	/* Translate the default cmode */
+	mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported);
+
+	config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 |
+				   MAC_1000FD;
+}
+
 static int mv88e6352_get_port4_serdes_cmode(struct mv88e6xxx_chip *chip)
 {
 	u16 reg, val;
@@ -5069,7 +5081,7 @@  static const struct mv88e6xxx_ops mv88e6350_ops = {
 	.vtu_loadpurge = mv88e6352_g1_vtu_loadpurge,
 	.stu_getnext = mv88e6352_g1_stu_getnext,
 	.stu_loadpurge = mv88e6352_g1_stu_loadpurge,
-	.phylink_get_caps = mv88e6185_phylink_get_caps,
+	.phylink_get_caps = mv88e6350_phylink_get_caps,
 };
 
 static const struct mv88e6xxx_ops mv88e6351_ops = {
@@ -5117,7 +5129,7 @@  static const struct mv88e6xxx_ops mv88e6351_ops = {
 	.stu_loadpurge = mv88e6352_g1_stu_loadpurge,
 	.avb_ops = &mv88e6352_avb_ops,
 	.ptp_ops = &mv88e6352_ptp_ops,
-	.phylink_get_caps = mv88e6185_phylink_get_caps,
+	.phylink_get_caps = mv88e6350_phylink_get_caps,
 };
 
 static const struct mv88e6xxx_ops mv88e6352_ops = {