Skip to content

Commit

Permalink
net: dsa: mv88e6xxx: Fix stats counters for 6352 family
Browse files Browse the repository at this point in the history
The statistic counters for the mv88e6172 never worked. This device is
a member of the 6352 family of chips, which has a slightly different
layout of the register used for capturing statistics. Add support for
detecting this family and poking the port in the right place in the
register.

Signed-off-by: Andrew Lunn <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
lunn authored and davem330 committed Apr 2, 2015
1 parent cca8b13 commit f3a8b6b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions drivers/net/dsa/mv88e6xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,19 @@ void mv88e6xxx_poll_link(struct dsa_switch *ds)
}
}

static bool mv88e6xxx_6352_family(struct dsa_switch *ds)
{
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);

switch (ps->id) {
case PORT_SWITCH_ID_6352:
case PORT_SWITCH_ID_6172:
case PORT_SWITCH_ID_6176:
return true;
}
return false;
}

static int mv88e6xxx_stats_wait(struct dsa_switch *ds)
{
int ret;
Expand All @@ -452,6 +465,9 @@ static int mv88e6xxx_stats_snapshot(struct dsa_switch *ds, int port)
{
int ret;

if (mv88e6xxx_6352_family(ds))
port = (port + 1) << 5;

/* Snapshot the hardware statistics counters for this port. */
REG_WRITE(REG_GLOBAL, GLOBAL_STATS_OP,
GLOBAL_STATS_OP_CAPTURE_PORT |
Expand Down

0 comments on commit f3a8b6b

Please sign in to comment.