diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-02-16 18:16:52 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2020-10-12 21:52:14 +0100 |
commit | ab2e5046153fad0d9be339e86ca3ae90f7e1dbc5 (patch) | |
tree | bfe4bddebb662512c2ef39227f71666e9b4280da /drivers/net/dsa/mv88e6xxx/port.c | |
parent | 4be1dde456950e0bd9dee43648c0132d89abe1d0 (diff) |
net: dsa: mv88e6xxx: split out SPEED_MAX setting
Currently, all the device specific speed setting functions convert
SPEED_MAX to the actual speed of the port. This is used to default
CPU and DSA interfaces which do not have a fixed-link specification
in DT, which doesn't work correctly with the phylink integration.
In order to resolve this, we need access to this value, so make this
a separate function, and update mv88e6xxx_port_setup_mac() to use it.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/port.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/port.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index a574cff80826..7c83fab58007 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -265,9 +265,6 @@ static int mv88e6xxx_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int mv88e6065_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = 200; - if (speed > 200) return -EOPNOTSUPP; @@ -276,13 +273,15 @@ int mv88e6065_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6065_port_max_speed(int port) +{ + return 200; +} + /* Support 10, 100, 1000 Mbps (e.g. 88E6185 family) */ int mv88e6185_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = 1000; - if (speed == 200 || speed > 1000) return -EOPNOTSUPP; @@ -290,13 +289,15 @@ int mv88e6185_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6185_port_max_speed(int port) +{ + return 1000; +} + /* Support 10, 100 Mbps (e.g. 88E6250 family) */ int mv88e6250_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = 100; - if (speed > 100) return -EOPNOTSUPP; @@ -304,13 +305,15 @@ int mv88e6250_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6250_port_max_speed(int port) +{ + return 100; +} + /* Support 10, 100, 200, 1000, 2500 Mbps (e.g. 88E6341) */ int mv88e6341_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = port < 5 ? 1000 : 2500; - if (speed > 2500) return -EOPNOTSUPP; @@ -324,6 +327,11 @@ int mv88e6341_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6341_port_max_speed(int port) +{ + return port < 5 ? 1000 : 2500; +} + phy_interface_t mv88e6341_port_max_speed_mode(int port) { if (port == 5) @@ -336,9 +344,6 @@ phy_interface_t mv88e6341_port_max_speed_mode(int port) int mv88e6352_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = 1000; - if (speed > 1000) return -EOPNOTSUPP; @@ -349,13 +354,15 @@ int mv88e6352_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6352_port_max_speed(int port) +{ + return 1000; +} + /* Support 10, 100, 200, 1000, 2500 Mbps (e.g. 88E6390) */ int mv88e6390_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = port < 9 ? 1000 : 2500; - if (speed > 2500) return -EOPNOTSUPP; @@ -369,6 +376,11 @@ int mv88e6390_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6390_port_max_speed(int port) +{ + return port < 9 ? 1000 : 2500; +} + phy_interface_t mv88e6390_port_max_speed_mode(int port) { if (port == 9 || port == 10) @@ -381,9 +393,6 @@ phy_interface_t mv88e6390_port_max_speed_mode(int port) int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { - if (speed == SPEED_MAX) - speed = port < 9 ? 1000 : 10000; - if (speed == 200 && port != 0) return -EOPNOTSUPP; @@ -394,6 +403,11 @@ int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } +int mv88e6390x_port_max_speed(int port) +{ + return port < 9 ? 1000 : 10000; +} + phy_interface_t mv88e6390x_port_max_speed_mode(int port) { if (port == 9 || port == 10) |