diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-10-29 10:45:05 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-30 14:54:11 -0400 |
commit | a1ab91f3deadc398675de3b9ff297c1f66b5b1f9 (patch) | |
tree | d85190c26ad4f89ef7887032231f4de1b3fa7fea /drivers | |
parent | 3d762a0f0ab9cb4a6b5993db3ce56c92f9f90ab2 (diff) | |
download | op-kernel-dev-a1ab91f3deadc398675de3b9ff297c1f66b5b1f9.zip op-kernel-dev-a1ab91f3deadc398675de3b9ff297c1f66b5b1f9.tar.gz |
net: dsa/mv88e6123_61_65: Add support for reading switch registers
The infrastructure can now report switch registers to ethtool.
Add support for it to the mv88e6123_61_65 driver.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/dsa/mv88e6123_61_65.c | 2 | ||||
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.c | 24 | ||||
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.h | 3 |
3 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6123_61_65.c b/drivers/net/dsa/mv88e6123_61_65.c index 9f43c9b..e2d2e37 100644 --- a/drivers/net/dsa/mv88e6123_61_65.c +++ b/drivers/net/dsa/mv88e6123_61_65.c @@ -470,6 +470,8 @@ struct dsa_switch_driver mv88e6123_61_65_switch_driver = { #ifdef CONFIG_NET_DSA_HWMON .get_temp = mv88e6123_61_65_get_temp, #endif + .get_regs_len = mv88e6xxx_get_regs_len, + .get_regs = mv88e6xxx_get_regs, }; MODULE_ALIAS("platform:mv88e6123"); diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index 8e1090b..c071fde 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -499,6 +499,30 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, mutex_unlock(&ps->stats_mutex); } +int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port) +{ + return 32 * sizeof(u16); +} + +void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, + struct ethtool_regs *regs, void *_p) +{ + u16 *p = _p; + int i; + + regs->version = 0; + + memset(p, 0xff, 32 * sizeof(u16)); + + for (i = 0; i < 32; i++) { + int ret; + + ret = mv88e6xxx_reg_read(ds, REG_PORT(port), i); + if (ret >= 0) + p[i] = ret; + } +} + static int __init mv88e6xxx_init(void) { #if IS_ENABLED(CONFIG_NET_DSA_MV88E6131) diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h index 29feed0..a0780b0 100644 --- a/drivers/net/dsa/mv88e6xxx.h +++ b/drivers/net/dsa/mv88e6xxx.h @@ -78,6 +78,9 @@ void mv88e6xxx_get_strings(struct dsa_switch *ds, void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int nr_stats, struct mv88e6xxx_hw_stat *stats, int port, uint64_t *data); +int mv88e6xxx_get_regs_len(struct dsa_switch *ds, int port); +void mv88e6xxx_get_regs(struct dsa_switch *ds, int port, + struct ethtool_regs *regs, void *_p); extern struct dsa_switch_driver mv88e6131_switch_driver; extern struct dsa_switch_driver mv88e6123_61_65_switch_driver; |