|
@@ -316,6 +316,8 @@ static int mv88e6171_setup(struct dsa_switch *ds)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ mutex_init(&ps->phy_mutex);
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -329,18 +331,28 @@ static int mv88e6171_port_to_phy_addr(int port)
|
|
static int
|
|
static int
|
|
mv88e6171_phy_read(struct dsa_switch *ds, int port, int regnum)
|
|
mv88e6171_phy_read(struct dsa_switch *ds, int port, int regnum)
|
|
{
|
|
{
|
|
|
|
+ struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
|
int addr = mv88e6171_port_to_phy_addr(port);
|
|
int addr = mv88e6171_port_to_phy_addr(port);
|
|
|
|
+ int ret;
|
|
|
|
|
|
- return mv88e6xxx_phy_read(ds, addr, regnum);
|
|
|
|
|
|
+ mutex_lock(&ps->phy_mutex);
|
|
|
|
+ ret = mv88e6xxx_phy_read(ds, addr, regnum);
|
|
|
|
+ mutex_unlock(&ps->phy_mutex);
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static int
|
|
static int
|
|
mv88e6171_phy_write(struct dsa_switch *ds,
|
|
mv88e6171_phy_write(struct dsa_switch *ds,
|
|
int port, int regnum, u16 val)
|
|
int port, int regnum, u16 val)
|
|
{
|
|
{
|
|
|
|
+ struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
|
|
int addr = mv88e6171_port_to_phy_addr(port);
|
|
int addr = mv88e6171_port_to_phy_addr(port);
|
|
|
|
+ int ret;
|
|
|
|
|
|
- return mv88e6xxx_phy_write(ds, addr, regnum, val);
|
|
|
|
|
|
+ mutex_lock(&ps->phy_mutex);
|
|
|
|
+ ret = mv88e6xxx_phy_write(ds, addr, regnum, val);
|
|
|
|
+ mutex_unlock(&ps->phy_mutex);
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static struct mv88e6xxx_hw_stat mv88e6171_hw_stats[] = {
|
|
static struct mv88e6xxx_hw_stat mv88e6171_hw_stats[] = {
|
|
@@ -408,6 +420,11 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
|
|
.get_strings = mv88e6171_get_strings,
|
|
.get_strings = mv88e6171_get_strings,
|
|
.get_ethtool_stats = mv88e6171_get_ethtool_stats,
|
|
.get_ethtool_stats = mv88e6171_get_ethtool_stats,
|
|
.get_sset_count = mv88e6171_get_sset_count,
|
|
.get_sset_count = mv88e6171_get_sset_count,
|
|
|
|
+#ifdef CONFIG_NET_DSA_HWMON
|
|
|
|
+ .get_temp = mv88e6xxx_get_temp,
|
|
|
|
+#endif
|
|
|
|
+ .get_regs_len = mv88e6xxx_get_regs_len,
|
|
|
|
+ .get_regs = mv88e6xxx_get_regs,
|
|
};
|
|
};
|
|
|
|
|
|
MODULE_ALIAS("platform:mv88e6171");
|
|
MODULE_ALIAS("platform:mv88e6171");
|