diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-06-09 01:34:09 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-09 19:10:57 +0300 |
commit | 31bef4e90cf761eaa16298461bcb4c101044baea (patch) | |
tree | 0d981c8dc1ae563e224bb303148a69df6074e309 /drivers/net/dsa/mv88e6xxx/port.c | |
parent | 774439e532bfe9dba83a5f499fcdfd8eea961919 (diff) | |
download | linux-31bef4e90cf761eaa16298461bcb4c101044baea.tar.xz |
net: dsa: mv88e6xxx: add egress mode enumeration
As for the frame mode, add a mv88e6xxx_egress_mode enumeration instead
of a 16-bit register mask.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/port.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/port.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index fc09b26f9b49..09e17131a6bd 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -425,7 +425,7 @@ int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state) } int mv88e6xxx_port_set_egress_mode(struct mv88e6xxx_chip *chip, int port, - u16 mode) + enum mv88e6xxx_egress_mode mode) { int err; u16 reg; @@ -435,7 +435,23 @@ int mv88e6xxx_port_set_egress_mode(struct mv88e6xxx_chip *chip, int port, return err; reg &= ~PORT_CONTROL_EGRESS_MASK; - reg |= mode; + + switch (mode) { + case MV88E6XXX_EGRESS_MODE_UNMODIFIED: + reg |= PORT_CONTROL_EGRESS_UNMODIFIED; + break; + case MV88E6XXX_EGRESS_MODE_UNTAGGED: + reg |= PORT_CONTROL_EGRESS_UNTAGGED; + break; + case MV88E6XXX_EGRESS_MODE_TAGGED: + reg |= PORT_CONTROL_EGRESS_TAGGED; + break; + case MV88E6XXX_EGRESS_MODE_ETHERTYPE: + reg |= PORT_CONTROL_EGRESS_ADD_TAG; + break; + default: + return -EINVAL; + } return mv88e6xxx_port_write(chip, port, PORT_CONTROL, reg); } |