summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/mv88e6xxx/chip.c
diff options
context:
space:
mode:
authorHubert Feurstein <h.feurstein@gmail.com>2019-07-31 10:23:48 +0200
committerDavid S. Miller <davem@davemloft.net>2019-08-02 17:58:53 -0700
commitc857486a4b6d5c9250832315341e5889fdcb03c3 (patch)
tree4dc1c38e6b26c7ee8a8400400275bfd0e88ab7dc /drivers/net/dsa/mv88e6xxx/chip.c
parent83c5ee315f73048d0c06c5736eb8ffe4ded2b7cc (diff)
downloadblackbird-op-linux-c857486a4b6d5c9250832315341e5889fdcb03c3.tar.gz
blackbird-op-linux-c857486a4b6d5c9250832315341e5889fdcb03c3.zip
net: dsa: mv88e6xxx: introduce invalid_port_mask in mv88e6xxx_info
With this it is possible to mark certain chip ports as invalid. This is required for example for the MV88E6220 (which is in general a MV88E6250 with 7 ports) but the ports 2-4 are not routed to pins. If a user configures an invalid port, an error is returned. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/chip.c')
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 390b61651e10..7fd13468b8da 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2485,6 +2485,14 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
/* Setup Switch Port Registers */
for (i = 0; i < mv88e6xxx_num_ports(chip); i++) {
+ /* Prevent the use of an invalid port. */
+ if (mv88e6xxx_is_invalid_port(chip, i) &&
+ !dsa_is_unused_port(ds, i)) {
+ dev_err(chip->dev, "port %d is invalid\n", i);
+ err = -EINVAL;
+ goto unlock;
+ }
+
if (dsa_is_unused_port(ds, i)) {
err = mv88e6xxx_port_set_state(chip, i,
BR_STATE_DISABLED);
@@ -4286,6 +4294,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
*/
.num_ports = 7,
.num_internal_phys = 2,
+ .invalid_port_mask = BIT(2) | BIT(3) | BIT(4),
.max_vid = 4095,
.port_base_addr = 0x08,
.phy_base_addr = 0x00,
OpenPOWER on IntegriCloud