Commit 8f6345b2 authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: mv88e6xxx: kill last locked reg_read

Get rid of the last usage of the locked mv88e6xxx_reg_read function with
a new mv88e6xxx_port_read helper, useful later for chips with different
port registers base address.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 855b1932
...@@ -254,17 +254,6 @@ static int _mv88e6xxx_reg_read(struct mv88e6xxx_chip *chip, int addr, int reg) ...@@ -254,17 +254,6 @@ static int _mv88e6xxx_reg_read(struct mv88e6xxx_chip *chip, int addr, int reg)
return val; return val;
} }
static int mv88e6xxx_reg_read(struct mv88e6xxx_chip *chip, int addr, int reg)
{
int ret;
mutex_lock(&chip->reg_lock);
ret = _mv88e6xxx_reg_read(chip, addr, reg);
mutex_unlock(&chip->reg_lock);
return ret;
}
static int _mv88e6xxx_reg_write(struct mv88e6xxx_chip *chip, int addr, static int _mv88e6xxx_reg_write(struct mv88e6xxx_chip *chip, int addr,
int reg, u16 val) int reg, u16 val)
{ {
...@@ -2426,6 +2415,17 @@ static int mv88e6xxx_power_on_serdes(struct mv88e6xxx_chip *chip) ...@@ -2426,6 +2415,17 @@ static int mv88e6xxx_power_on_serdes(struct mv88e6xxx_chip *chip)
return ret; return ret;
} }
static int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port,
int reg, u16 *val)
{
int addr = chip->info->port_base_addr + port;
if (port >= chip->info->num_ports)
return -EINVAL;
return mv88e6xxx_read(chip, addr, reg, val);
}
static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port)
{ {
struct dsa_switch *ds = chip->ds; struct dsa_switch *ds = chip->ds;
...@@ -3830,12 +3830,15 @@ static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num) ...@@ -3830,12 +3830,15 @@ static const struct mv88e6xxx_info *mv88e6xxx_lookup_info(unsigned int prod_num)
static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip) static int mv88e6xxx_detect(struct mv88e6xxx_chip *chip)
{ {
const struct mv88e6xxx_info *info; const struct mv88e6xxx_info *info;
int id, prod_num, rev; unsigned int prod_num, rev;
u16 id;
int err;
id = mv88e6xxx_reg_read(chip, chip->info->port_base_addr, mutex_lock(&chip->reg_lock);
PORT_SWITCH_ID); err = mv88e6xxx_port_read(chip, 0, PORT_SWITCH_ID, &id);
if (id < 0) mutex_unlock(&chip->reg_lock);
return id; if (err)
return err;
prod_num = (id & 0xfff0) >> 4; prod_num = (id & 0xfff0) >> 4;
rev = id & 0x000f; rev = id & 0x000f;
......
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