diff mbox series

[net] net: dsa: mv88e6xxx: power serdes on/off for 10G interfaces on 6390X

Message ID 20190228211433.14211-1-maxime.chevallier@bootlin.com
State Accepted
Delegated to: David Miller
Headers show
Series [net] net: dsa: mv88e6xxx: power serdes on/off for 10G interfaces on 6390X | expand

Commit Message

Maxime Chevallier Feb. 28, 2019, 9:14 p.m. UTC
Upon setting the cmode on 6390 and 6390X, the associated serdes
interfaces must be powered off/on.

Both 6390X and 6390 share code to do so, but it currently uses the 6390
specific helper mv88e6390_serdes_power() to disable and enable the
serdes interface.

This call will fail silently on 6390X when trying so set a 10G interface
such as XAUI or RXAUI, since mv88e6390_serdes_power() internally grabs
the lane number based on modes supported by the 6390, and returns 0 when
getting -ENODEV as a lane number.

Using mv88e6390x_serdes_power() should be safe here, since we explicitly
rule-out all ports but the 9 and 10, and because modes supported by 6390
ports 9 and 10 are a subset of those supported on 6390X.

This was tested on 6390X using RXAUI mode.

Fixes: 364e9d7776a3 ("net: dsa: mv88e6xxx: Power on/off SERDES on cmode change")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/dsa/mv88e6xxx/port.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Lunn Feb. 28, 2019, 9:54 p.m. UTC | #1
On Thu, Feb 28, 2019 at 10:14:33PM +0100, Maxime Chevallier wrote:
> Upon setting the cmode on 6390 and 6390X, the associated serdes
> interfaces must be powered off/on.
> 
> Both 6390X and 6390 share code to do so, but it currently uses the 6390
> specific helper mv88e6390_serdes_power() to disable and enable the
> serdes interface.
> 
> This call will fail silently on 6390X when trying so set a 10G interface
> such as XAUI or RXAUI, since mv88e6390_serdes_power() internally grabs
> the lane number based on modes supported by the 6390, and returns 0 when
> getting -ENODEV as a lane number.
> 
> Using mv88e6390x_serdes_power() should be safe here, since we explicitly
> rule-out all ports but the 9 and 10, and because modes supported by 6390
> ports 9 and 10 are a subset of those supported on 6390X.
> 
> This was tested on 6390X using RXAUI mode.
> 
> Fixes: 364e9d7776a3 ("net: dsa: mv88e6xxx: Power on/off SERDES on cmode change")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

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

    Andrew
David Miller Feb. 28, 2019, 11:16 p.m. UTC | #2
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: Thu, 28 Feb 2019 22:14:33 +0100

> Upon setting the cmode on 6390 and 6390X, the associated serdes
> interfaces must be powered off/on.
> 
> Both 6390X and 6390 share code to do so, but it currently uses the 6390
> specific helper mv88e6390_serdes_power() to disable and enable the
> serdes interface.
> 
> This call will fail silently on 6390X when trying so set a 10G interface
> such as XAUI or RXAUI, since mv88e6390_serdes_power() internally grabs
> the lane number based on modes supported by the 6390, and returns 0 when
> getting -ENODEV as a lane number.
> 
> Using mv88e6390x_serdes_power() should be safe here, since we explicitly
> rule-out all ports but the 9 and 10, and because modes supported by 6390
> ports 9 and 10 are a subset of those supported on 6390X.
> 
> This was tested on 6390X using RXAUI mode.
> 
> Fixes: 364e9d7776a3 ("net: dsa: mv88e6xxx: Power on/off SERDES on cmode change")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Applied and queued up for -stable.
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
index ebd26b6a93e6..4b02c96f6786 100644
--- a/drivers/net/dsa/mv88e6xxx/port.c
+++ b/drivers/net/dsa/mv88e6xxx/port.c
@@ -408,7 +408,7 @@  int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
 			return err;
 	}
 
-	err = mv88e6390_serdes_power(chip, port, false);
+	err = mv88e6390x_serdes_power(chip, port, false);
 	if (err)
 		return err;
 
@@ -424,7 +424,7 @@  int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
 		if (err)
 			return err;
 
-		err = mv88e6390_serdes_power(chip, port, true);
+		err = mv88e6390x_serdes_power(chip, port, true);
 		if (err)
 			return err;