diff mbox series

[v2,net,1/2] net: dsa: mv88e6xxx: add phylink_get_caps for the mv88e6320/21 family

Message ID 20240508072944.54880-2-steffen@innosonix.de (mailing list archive)
State Accepted
Commit f39bf3cf08a49e7d20c44bc8bc8e390fea69959a
Delegated to: Netdev Maintainers
Headers show
Series net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
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 fail Problems with Fixes tag: 1
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
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
netdev/contest success net-next-2024-05-09--06-00 (tests: 1004)

Commit Message

Steffen Bätz May 8, 2024, 7:29 a.m. UTC
As of commit de5c9bf40c45 ("net: phylink: require supported_interfaces to
be filled")
Marvell 88e6320/21 switches fail to be probed:

...
mv88e6085 30be0000.ethernet-1:00: phylink: error: empty supported_interfaces
error creating PHYLINK: -22
...

The problem stems from the use of mv88e6185_phylink_get_caps() to get
the device capabilities. 
Since there are serdes only ports 0/1 included, create a new dedicated 
phylink_get_caps for the 6320 and 6321 to properly support their 
set of capabilities.

Fixes: de5c9bf40c45 ("net: phylink: require supported_interfaces to be filled")

Signed-off-by: Steffen Bätz <steffen@innosonix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Fabio Estevam <festevam@gmail.com>

Changes since v1:
- Removed unused variables.
- Collected Reviewed-by tags from Andrew and Fabio
---
 drivers/net/dsa/mv88e6xxx/chip.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Paolo Abeni May 9, 2024, 9:52 a.m. UTC | #1
On Wed, 2024-05-08 at 09:29 +0200, Steffen Bätz wrote:
> As of commit de5c9bf40c45 ("net: phylink: require supported_interfaces to
> be filled")
> Marvell 88e6320/21 switches fail to be probed:
> 
> ...
> mv88e6085 30be0000.ethernet-1:00: phylink: error: empty supported_interfaces
> error creating PHYLINK: -22
> ...
> 
> The problem stems from the use of mv88e6185_phylink_get_caps() to get
> the device capabilities. 
> Since there are serdes only ports 0/1 included, create a new dedicated 
> phylink_get_caps for the 6320 and 6321 to properly support their 
> set of capabilities.
> 
> Fixes: de5c9bf40c45 ("net: phylink: require supported_interfaces to be filled")
> 
> Signed-off-by: Steffen Bätz <steffen@innosonix.de>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Fabio Estevam <festevam@gmail.com>
> 
> Changes since v1:
> - Removed unused variables.
> - Collected Reviewed-by tags from Andrew and Fabio

The changelog should come after a '---' separator, so it will not be
included into the commit message, and you must avoid the empty line
after the fixes tag.

I made the above changes while applying the patch, but this is really
an exception, please take care for the next submissions.

Cheers,

Paolo
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 32416d8802ca..bd58190853c7 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -697,6 +697,18 @@  static void mv88e6352_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 	}
 }
 
+static void mv88e632x_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 void mv88e6341_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 				       struct phylink_config *config)
 {
@@ -5090,7 +5102,7 @@  static const struct mv88e6xxx_ops mv88e6320_ops = {
 	.gpio_ops = &mv88e6352_gpio_ops,
 	.avb_ops = &mv88e6352_avb_ops,
 	.ptp_ops = &mv88e6352_ptp_ops,
-	.phylink_get_caps = mv88e6185_phylink_get_caps,
+	.phylink_get_caps = mv88e632x_phylink_get_caps,
 };
 
 static const struct mv88e6xxx_ops mv88e6321_ops = {
@@ -5136,7 +5148,7 @@  static const struct mv88e6xxx_ops mv88e6321_ops = {
 	.gpio_ops = &mv88e6352_gpio_ops,
 	.avb_ops = &mv88e6352_avb_ops,
 	.ptp_ops = &mv88e6352_ptp_ops,
-	.phylink_get_caps = mv88e6185_phylink_get_caps,
+	.phylink_get_caps = mv88e632x_phylink_get_caps,
 };
 
 static const struct mv88e6xxx_ops mv88e6341_ops = {