diff options
author | Andrew Lunn <andrew@lunn.ch> | 2015-05-06 01:09:49 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-09 16:05:53 -0400 |
commit | 15966a2a76f57ee45479cc3e7d28dd105f09260a (patch) | |
tree | d4f30724f2d2565c4fa53fe6c066b60136ce3b05 /drivers/net/dsa/mv88e6171.c | |
parent | dbde9e6667166f17d6d70a08becb05c596cb8fb5 (diff) |
net: dsa: Converting remaining registers to mnemonics
Use defines for registers, shifts and bits in the remaining register
accesses in the individual drivers, in order to aid readability.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6171.c')
-rw-r--r-- | drivers/net/dsa/mv88e6171.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c index a036d0d15a13..56fad84aded6 100644 --- a/drivers/net/dsa/mv88e6171.c +++ b/drivers/net/dsa/mv88e6171.c @@ -38,6 +38,7 @@ static char *mv88e6171_probe(struct device *host_dev, int sw_addr) static int mv88e6171_setup_global(struct dsa_switch *ds) { + u32 upstream_port = dsa_upstream_port(ds); int ret; ret = mv88e6xxx_setup_global(ds); @@ -47,21 +48,36 @@ static int mv88e6171_setup_global(struct dsa_switch *ds) /* Discard packets with excessive collisions, mask all * interrupt sources, enable PPU. */ - REG_WRITE(REG_GLOBAL, 0x04, 0x6000); + REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL, + GLOBAL_CONTROL_PPU_ENABLE | GLOBAL_CONTROL_DISCARD_EXCESS); /* Configure the upstream port, and configure the upstream * port as the port to which ingress and egress monitor frames * are to be sent. */ - if (REG_READ(REG_PORT(0), 0x03) == 0x1710) - REG_WRITE(REG_GLOBAL, 0x1a, (dsa_upstream_port(ds) * 0x1111)); + if (REG_READ(REG_PORT(0), PORT_SWITCH_ID) == PORT_SWITCH_ID_6171) + REG_WRITE(REG_GLOBAL, GLOBAL_MONITOR_CONTROL, + upstream_port << + GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT | + upstream_port << + GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT | + upstream_port << + GLOBAL_MONITOR_CONTROL_ARP_SHIFT | + upstream_port << + GLOBAL_MONITOR_CONTROL_MIRROR_SHIFT); else - REG_WRITE(REG_GLOBAL, 0x1a, (dsa_upstream_port(ds) * 0x1110)); + REG_WRITE(REG_GLOBAL, GLOBAL_MONITOR_CONTROL, + upstream_port << + GLOBAL_MONITOR_CONTROL_INGRESS_SHIFT | + upstream_port << + GLOBAL_MONITOR_CONTROL_EGRESS_SHIFT | + upstream_port << + GLOBAL_MONITOR_CONTROL_ARP_SHIFT); /* Disable remote management for now, and set the switch's * DSA device number. */ - REG_WRITE(REG_GLOBAL, 0x1c, ds->index & 0x1f); + REG_WRITE(REG_GLOBAL, GLOBAL_CONTROL_2, ds->index & 0x1f); return 0; } |