net: dsa: b53: Disable all ports on setup

A b53 device may configured through an external EEPROM like the switch
device on the Lamobo R1 router board. The configuration of a port may
therefore differ from the reset configuration of the switch.

The switch configuration reported by the DSA subsystem is different until
the port is configured by DSA i.e. a port can be active, while the DSA
subsystem reports the port is inactive. Disable all ports and not only
the unused ones to put all ports into a well defined state.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Benedikt Spranger 2019-06-28 18:58:11 +02:00 committed by David S. Miller
parent e7792df831
commit 75dad2520f

View File

@ -955,13 +955,13 @@ static int b53_setup(struct dsa_switch *ds)
if (ret) if (ret)
dev_err(ds->dev, "failed to apply configuration\n"); dev_err(ds->dev, "failed to apply configuration\n");
/* Configure IMP/CPU port, disable unused ports. Enabled /* Configure IMP/CPU port, disable all other ports. Enabled
* ports will be configured with .port_enable * ports will be configured with .port_enable
*/ */
for (port = 0; port < dev->num_ports; port++) { for (port = 0; port < dev->num_ports; port++) {
if (dsa_is_cpu_port(ds, port)) if (dsa_is_cpu_port(ds, port))
b53_enable_cpu_port(dev, port); b53_enable_cpu_port(dev, port);
else if (dsa_is_unused_port(ds, port)) else
b53_disable_port(ds, port); b53_disable_port(ds, port);
} }