[PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250

Steffen Trumtrar str at pengutronix.de
Mon Mar 21 06:16:31 PDT 2022


From: Steffen Trumtrar <s.trumtrar at pengutronix.de>

barebox port of the linux patch:

  commit a528e5be6b5f8026eda029b03340dcfa23c70824
  Author: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
  Date:   Tue Jun 4 07:34:29 2019 +0000

      net: dsa: mv88e6xxx: implement port_set_speed for mv88e6250

      The data sheet also mentions the possibility of selecting 200 Mbps for
      the MII ports (ports 5 and 6) by setting the ForceSpd field to
      0x2 (aka MV88E6065_PORT_MAC_CTL_SPEED_200). However, there's a note
      that "actual speed is determined by bit 8 above", and flipping back a
      page, one finds that bits 13:8 are reserved...

      So without further information on what bit 8 means, let's stick to
      supporting just 10 and 100 Mbps on all ports.

      Reviewed-by: Andrew Lunn <andrew at lunn.ch>
      Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
      Signed-off-by: David S. Miller <davem at davemloft.net>

Signed-off-by: Steffen Trumtrar <s.trumtrar at pengutronix.de>
---
 drivers/net/phy/mv88e6xxx/port.c | 12 ++++++++++++
 drivers/net/phy/mv88e6xxx/port.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/phy/mv88e6xxx/port.c b/drivers/net/phy/mv88e6xxx/port.c
index ba2b03e18d..95542d4eec 100644
--- a/drivers/net/phy/mv88e6xxx/port.c
+++ b/drivers/net/phy/mv88e6xxx/port.c
@@ -277,6 +277,18 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
 	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
 }
 
+/* Support 10, 100 (e.g. 88E6250 family) */
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
+{
+	if (speed == SPEED_MAX)
+		speed = 100;
+
+	if (speed > 100)
+		return -EOPNOTSUPP;
+
+	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
+}
+
 /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */
 int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
 {
diff --git a/drivers/net/phy/mv88e6xxx/port.h b/drivers/net/phy/mv88e6xxx/port.h
index f47f392b87..f5cf72932a 100644
--- a/drivers/net/phy/mv88e6xxx/port.h
+++ b/drivers/net/phy/mv88e6xxx/port.h
@@ -121,6 +121,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link);
 int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup);
 int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
-- 
2.30.2




More information about the barebox mailing list