net: dsa: mv88e6xxx: enable SERDES after setup

SERDES is powered on for CPU and DSA ports and powered down for unused
ports at setup time. But now that DSA calls mv88e6xxx_port_enable
and mv88e6xxx_port_disable for all ports, the SERDES power can now
be handled after setup inconditionally for all ports.

Using the port enable and disable callbacks also have the benefit to
handle the SERDES IRQ for non user ports as well.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vivien Didelot 2019-08-19 16:00:52 -04:00 committed by David S. Miller
parent 3903f31516
commit b759f528ca
1 changed files with 4 additions and 31 deletions

View File

@ -2151,16 +2151,6 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
if (err) if (err)
return err; return err;
/* Enable the SERDES interface for DSA and CPU ports. Normal
* ports SERDES are enabled when the port is enabled, thus
* saving a bit of power.
*/
if ((dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) {
err = mv88e6xxx_serdes_power(chip, port, true);
if (err)
return err;
}
/* Port Control 2: don't force a good FCS, set the maximum frame size to /* Port Control 2: don't force a good FCS, set the maximum frame size to
* 10240 bytes, disable 802.1q tags checking, don't discard tagged or * 10240 bytes, disable 802.1q tags checking, don't discard tagged or
* untagged frames on this port, do a destination address lookup on all * untagged frames on this port, do a destination address lookup on all
@ -2267,9 +2257,6 @@ static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port,
struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_chip *chip = ds->priv;
int err; int err;
if (!dsa_is_user_port(ds, port))
return 0;
mv88e6xxx_reg_lock(chip); mv88e6xxx_reg_lock(chip);
err = mv88e6xxx_serdes_power(chip, port, true); err = mv88e6xxx_serdes_power(chip, port, true);
@ -2286,9 +2273,6 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port)
{ {
struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_chip *chip = ds->priv;
if (!dsa_is_user_port(ds, port))
return;
mv88e6xxx_reg_lock(chip); mv88e6xxx_reg_lock(chip);
if (chip->info->ops->serdes_irq_free) if (chip->info->ops->serdes_irq_free)
@ -2461,27 +2445,16 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
/* Setup Switch Port Registers */ /* Setup Switch Port Registers */
for (i = 0; i < mv88e6xxx_num_ports(chip); i++) { for (i = 0; i < mv88e6xxx_num_ports(chip); i++) {
if (dsa_is_unused_port(ds, i))
continue;
/* Prevent the use of an invalid port. */ /* Prevent the use of an invalid port. */
if (mv88e6xxx_is_invalid_port(chip, i) && if (mv88e6xxx_is_invalid_port(chip, i)) {
!dsa_is_unused_port(ds, i)) {
dev_err(chip->dev, "port %d is invalid\n", i); dev_err(chip->dev, "port %d is invalid\n", i);
err = -EINVAL; err = -EINVAL;
goto unlock; goto unlock;
} }
if (dsa_is_unused_port(ds, i)) {
err = mv88e6xxx_port_set_state(chip, i,
BR_STATE_DISABLED);
if (err)
goto unlock;
err = mv88e6xxx_serdes_power(chip, i, false);
if (err)
goto unlock;
continue;
}
err = mv88e6xxx_setup_port(chip, i); err = mv88e6xxx_setup_port(chip, i);
if (err) if (err)
goto unlock; goto unlock;