|
@@ -123,8 +123,9 @@ static int mv88e6352_read_eeprom_word(struct dsa_switch *ds, int addr)
|
|
|
|
|
|
mutex_lock(&ps->eeprom_mutex);
|
|
|
|
|
|
- ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, 0x14,
|
|
|
- 0xc000 | (addr & 0xff));
|
|
|
+ ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, GLOBAL2_EEPROM_OP,
|
|
|
+ GLOBAL2_EEPROM_OP_READ |
|
|
|
+ (addr & GLOBAL2_EEPROM_OP_ADDR_MASK));
|
|
|
if (ret < 0)
|
|
|
goto error;
|
|
|
|
|
@@ -132,7 +133,7 @@ static int mv88e6352_read_eeprom_word(struct dsa_switch *ds, int addr)
|
|
|
if (ret < 0)
|
|
|
goto error;
|
|
|
|
|
|
- ret = mv88e6xxx_reg_read(ds, REG_GLOBAL2, 0x15);
|
|
|
+ ret = mv88e6xxx_reg_read(ds, REG_GLOBAL2, GLOBAL2_EEPROM_DATA);
|
|
|
error:
|
|
|
mutex_unlock(&ps->eeprom_mutex);
|
|
|
return ret;
|
|
@@ -205,11 +206,11 @@ static int mv88e6352_eeprom_is_readonly(struct dsa_switch *ds)
|
|
|
{
|
|
|
int ret;
|
|
|
|
|
|
- ret = mv88e6xxx_reg_read(ds, REG_GLOBAL2, 0x14);
|
|
|
+ ret = mv88e6xxx_reg_read(ds, REG_GLOBAL2, GLOBAL2_EEPROM_OP);
|
|
|
if (ret < 0)
|
|
|
return ret;
|
|
|
|
|
|
- if (!(ret & 0x0400))
|
|
|
+ if (!(ret & GLOBAL2_EEPROM_OP_WRITE_EN))
|
|
|
return -EROFS;
|
|
|
|
|
|
return 0;
|
|
@@ -223,12 +224,13 @@ static int mv88e6352_write_eeprom_word(struct dsa_switch *ds, int addr,
|
|
|
|
|
|
mutex_lock(&ps->eeprom_mutex);
|
|
|
|
|
|
- ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, 0x15, data);
|
|
|
+ ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, GLOBAL2_EEPROM_DATA, data);
|
|
|
if (ret < 0)
|
|
|
goto error;
|
|
|
|
|
|
- ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, 0x14,
|
|
|
- 0xb000 | (addr & 0xff));
|
|
|
+ ret = mv88e6xxx_reg_write(ds, REG_GLOBAL2, GLOBAL2_EEPROM_OP,
|
|
|
+ GLOBAL2_EEPROM_OP_WRITE |
|
|
|
+ (addr & GLOBAL2_EEPROM_OP_ADDR_MASK));
|
|
|
if (ret < 0)
|
|
|
goto error;
|
|
|
|