]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
net: dsa: mv88e6xxx: Fix stats counters for 6352 family
authorAndrew Lunn <andrew@lunn.ch>
Thu, 2 Apr 2015 02:06:40 +0000 (04:06 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Apr 2015 02:55:41 +0000 (22:55 -0400)
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 <andrew@lunn.ch>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx.c

index 488b6545dfb5e417acd4e907007b8638d21ccc41..fc8d3b6ffe8e0b35e64ed2aaa78b342a1b86f66a 100644 (file)
@@ -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;
@@ -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 |