linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing
@ 2024-02-26  9:13 Steffen Bätz
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Steffen Bätz @ 2024-02-26  9:13 UTC (permalink / raw)
  Cc: Fabio Estevam, Steffen Bätz, Andrew Lunn, Florian Fainelli,
	Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Russell King, Russell King (Oracle),
	netdev, linux-kernel

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. 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>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 9caecb4dfbfa..32b927b7c221 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -649,6 +649,19 @@ 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;
+	int err, cmode;
+
+	/* 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)
 {
@@ -5042,7 +5055,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 = {
@@ -5088,7 +5101,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 = {
-- 
2.34.1


-- 


*innosonix GmbH*
Hauptstr. 35
96482 Ahorn
central: +49 9561 7459980
www.innosonix.de <http://www.innosonix.de>

innosonix GmbH
Geschäftsführer: 
Markus Bätz, Steffen Bätz
USt.-IdNr / VAT-Nr.: DE266020313
EORI-Nr.: 
DE240121536680271
HRB 5192 Coburg
WEEE-Reg.-Nr. DE88021242

-- 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports
  2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
@ 2024-02-26  9:13 ` Steffen Bätz
  2024-02-26  9:33   ` Russell King (Oracle)
                     ` (2 more replies)
  2024-02-26  9:31 ` [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Russell King (Oracle)
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 9+ messages in thread
From: Steffen Bätz @ 2024-02-26  9:13 UTC (permalink / raw)
  Cc: Fabio Estevam, Steffen Bätz, Andrew Lunn, Florian Fainelli,
	Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Russell King, Russell King (Oracle),
	netdev, linux-kernel

On the mv88e6320 and 6321 switch family, port 0/1 are serdes only ports.
Modified the mv88e6352_get_port4_serdes_cmode function to pass a port
number since the register set of the 6352 is equal on the 6320/21 families.

Signed-off-by: Steffen Bätz <steffen@innosonix.de>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 32b927b7c221..2d7361852d7e 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -589,12 +589,12 @@ static void mv88e6351_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 				   MAC_1000FD;
 }
 
-static int mv88e6352_get_port4_serdes_cmode(struct mv88e6xxx_chip *chip)
+static int mv88e63xx_get_port_serdes_cmode(struct mv88e6xxx_chip *chip, int port)
 {
 	u16 reg, val;
 	int err;
 
-	err = mv88e6xxx_port_read(chip, 4, MV88E6XXX_PORT_STS, &reg);
+	err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg);
 	if (err)
 		return err;
 
@@ -603,16 +603,16 @@ static int mv88e6352_get_port4_serdes_cmode(struct mv88e6xxx_chip *chip)
 		return 0xf;
 
 	val = reg & ~MV88E6XXX_PORT_STS_PHY_DETECT;
-	err = mv88e6xxx_port_write(chip, 4, MV88E6XXX_PORT_STS, val);
+	err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, val);
 	if (err)
 		return err;
 
-	err = mv88e6xxx_port_read(chip, 4, MV88E6XXX_PORT_STS, &val);
+	err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &val);
 	if (err)
 		return err;
 
 	/* Restore PHY_DETECT value */
-	err = mv88e6xxx_port_write(chip, 4, MV88E6XXX_PORT_STS, reg);
+	err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, reg);
 	if (err)
 		return err;
 
@@ -640,7 +640,7 @@ static void mv88e6352_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 		if (err <= 0)
 			return;
 
-		cmode = mv88e6352_get_port4_serdes_cmode(chip);
+		cmode = mv88e63xx_get_port_serdes_cmode(chip, port);
 		if (cmode < 0)
 			dev_err(chip->dev, "p%d: failed to read serdes cmode\n",
 				port);
@@ -660,6 +660,16 @@ static void mv88e632x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 
 	config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 |
 				   MAC_1000FD;
+
+	/* Port 0/1 are serdes only ports */
+	if (port == 0 || port == 1) {
+		cmode = mv88e63xx_get_port_serdes_cmode(chip, port);
+		if (cmode < 0)
+			dev_err(chip->dev, "p%d: failed to read serdes cmode\n",
+				port);
+		else
+			mv88e6xxx_translate_cmode(cmode, supported);
+	}
 }
 
 static void mv88e6341_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
-- 
2.34.1


-- 


*innosonix GmbH*
Hauptstr. 35
96482 Ahorn
central: +49 9561 7459980
www.innosonix.de <http://www.innosonix.de>

innosonix GmbH
Geschäftsführer: 
Markus Bätz, Steffen Bätz
USt.-IdNr / VAT-Nr.: DE266020313
EORI-Nr.: 
DE240121536680271
HRB 5192 Coburg
WEEE-Reg.-Nr. DE88021242

-- 


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing
  2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
@ 2024-02-26  9:31 ` Russell King (Oracle)
  2024-02-26 13:23 ` Andrew Lunn
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2024-02-26  9:31 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Fabio Estevam, Andrew Lunn, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

On Mon, Feb 26, 2024 at 10:13:23AM +0100, Steffen Bätz wrote:
> @@ -649,6 +649,19 @@ 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;
> +	int err, cmode;
> +
> +	/* Translate the default cmode */
> +	mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported);
> +
> +	config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 |
> +				   MAC_1000FD;
> +}
> +

This looks identical to mv88e6351_phylink_get_caps(). Would that work
for you instead?

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
@ 2024-02-26  9:33   ` Russell King (Oracle)
  2024-02-26 13:26   ` Andrew Lunn
  2024-02-27 11:22   ` Fabio Estevam
  2 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2024-02-26  9:33 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Fabio Estevam, Andrew Lunn, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

On Mon, Feb 26, 2024 at 10:13:24AM +0100, Steffen Bätz wrote:
> @@ -660,6 +660,16 @@ static void mv88e632x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
>  
>  	config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100 |
>  				   MAC_1000FD;
> +
> +	/* Port 0/1 are serdes only ports */
> +	if (port == 0 || port == 1) {
> +		cmode = mv88e63xx_get_port_serdes_cmode(chip, port);
> +		if (cmode < 0)
> +			dev_err(chip->dev, "p%d: failed to read serdes cmode\n",
> +				port);
> +		else
> +			mv88e6xxx_translate_cmode(cmode, supported);
> +	}

Ah, ignore my comment on the other patch.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing
  2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
  2024-02-26  9:31 ` [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Russell King (Oracle)
@ 2024-02-26 13:23 ` Andrew Lunn
  2024-02-27 11:22 ` Fabio Estevam
  2024-02-28  2:21 ` Jakub Kicinski
  4 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2024-02-26 13:23 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Fabio Estevam, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Russell King, Russell King (Oracle),
	netdev, linux-kernel

On Mon, Feb 26, 2024 at 10:13:23AM +0100, 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. 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>

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
  2024-02-26  9:33   ` Russell King (Oracle)
@ 2024-02-26 13:26   ` Andrew Lunn
  2024-02-27 11:22   ` Fabio Estevam
  2 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2024-02-26 13:26 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Fabio Estevam, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Russell King, Russell King (Oracle),
	netdev, linux-kernel

On Mon, Feb 26, 2024 at 10:13:24AM +0100, Steffen Bätz wrote:
> On the mv88e6320 and 6321 switch family, port 0/1 are serdes only ports.
> Modified the mv88e6352_get_port4_serdes_cmode function to pass a port
> number since the register set of the 6352 is equal on the 6320/21 families.
> 
> Signed-off-by: Steffen Bätz <steffen@innosonix.de>

It would be normal for a patch set to have a cover letter, patch 0/2
explaining the big picture. It might also help those doing stable
backports to see what both patches are needed and should be kept
together.

However, the patches will probably be accepted now, you don't need to
resend. Just please try to remember this for future patchsets.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing
  2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
                   ` (2 preceding siblings ...)
  2024-02-26 13:23 ` Andrew Lunn
@ 2024-02-27 11:22 ` Fabio Estevam
  2024-02-28  2:21 ` Jakub Kicinski
  4 siblings, 0 replies; 9+ messages in thread
From: Fabio Estevam @ 2024-02-27 11:22 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
	Russell King (Oracle),
	netdev, linux-kernel

Hi Steffen,

On Mon, Feb 26, 2024 at 6:15 AM Steffen Bätz <steffen@innosonix.de> 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. 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>

Thanks for the fix.

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports
  2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
  2024-02-26  9:33   ` Russell King (Oracle)
  2024-02-26 13:26   ` Andrew Lunn
@ 2024-02-27 11:22   ` Fabio Estevam
  2 siblings, 0 replies; 9+ messages in thread
From: Fabio Estevam @ 2024-02-27 11:22 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King,
	Russell King (Oracle),
	netdev, linux-kernel

On Mon, Feb 26, 2024 at 6:15 AM Steffen Bätz <steffen@innosonix.de> wrote:
>
> On the mv88e6320 and 6321 switch family, port 0/1 are serdes only ports.
> Modified the mv88e6352_get_port4_serdes_cmode function to pass a port
> number since the register set of the 6352 is equal on the 6320/21 families.
>
> Signed-off-by: Steffen Bätz <steffen@innosonix.de>

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing
  2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
                   ` (3 preceding siblings ...)
  2024-02-27 11:22 ` Fabio Estevam
@ 2024-02-28  2:21 ` Jakub Kicinski
  4 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2024-02-28  2:21 UTC (permalink / raw)
  To: Steffen Bätz
  Cc: Fabio Estevam, Andrew Lunn, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Paolo Abeni, Russell King,
	Russell King (Oracle),
	netdev, linux-kernel

On Mon, 26 Feb 2024 10:13:23 +0100 Steffen Bätz wrote:
> +static void mv88e632x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
> +				       struct phylink_config *config)
> +{
> +	unsigned long *supported = config->supported_interfaces;
> +	int err, cmode;

err and cmode are unused in this patch, please move cmode addition
to patch 2 and drop err which appears to remain unused after patch 2.
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-02-28  2:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26  9:13 [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Steffen Bätz
2024-02-26  9:13 ` [PATCH net 2/2] net: dsa: mv88e6xxx: 6320/21 read cmode on serdes ports Steffen Bätz
2024-02-26  9:33   ` Russell King (Oracle)
2024-02-26 13:26   ` Andrew Lunn
2024-02-27 11:22   ` Fabio Estevam
2024-02-26  9:31 ` [PATCH net 1/2] net: dsa: mv88e6xxx: fix marvell 6320/21 switch probing Russell King (Oracle)
2024-02-26 13:23 ` Andrew Lunn
2024-02-27 11:22 ` Fabio Estevam
2024-02-28  2:21 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).