Commit a1ab91f3 authored by Guenter Roeck's avatar Guenter Roeck Committed by David S. Miller

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: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3d762a0f
...@@ -470,6 +470,8 @@ struct dsa_switch_driver mv88e6123_61_65_switch_driver = { ...@@ -470,6 +470,8 @@ struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
#ifdef CONFIG_NET_DSA_HWMON #ifdef CONFIG_NET_DSA_HWMON
.get_temp = mv88e6123_61_65_get_temp, .get_temp = mv88e6123_61_65_get_temp,
#endif #endif
.get_regs_len = mv88e6xxx_get_regs_len,
.get_regs = mv88e6xxx_get_regs,
}; };
MODULE_ALIAS("platform:mv88e6123"); MODULE_ALIAS("platform:mv88e6123");
......
...@@ -499,6 +499,30 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, ...@@ -499,6 +499,30 @@ void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
mutex_unlock(&ps->stats_mutex); 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) static int __init mv88e6xxx_init(void)
{ {
#if IS_ENABLED(CONFIG_NET_DSA_MV88E6131) #if IS_ENABLED(CONFIG_NET_DSA_MV88E6131)
......
...@@ -78,6 +78,9 @@ void mv88e6xxx_get_strings(struct dsa_switch *ds, ...@@ -78,6 +78,9 @@ void mv88e6xxx_get_strings(struct dsa_switch *ds,
void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds,
int nr_stats, struct mv88e6xxx_hw_stat *stats, int nr_stats, struct mv88e6xxx_hw_stat *stats,
int port, uint64_t *data); 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 mv88e6131_switch_driver;
extern struct dsa_switch_driver mv88e6123_61_65_switch_driver; extern struct dsa_switch_driver mv88e6123_61_65_switch_driver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment