Skip to content

Commit

Permalink
dsa/mv88e6060: support nonzero mii base address
Browse files Browse the repository at this point in the history
The mv88e6060 uses either the lower 16 or upper 16 mii addresses,
depending on the value of the EE_CLK/ADDR4 pin. Support both
configurations by using the sw_addr setting as base address.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Peter Korsgaard authored and David S. Miller committed Mar 8, 2011
1 parent c01c6af commit fdb838c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/dsa/mv88e6060.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

static int reg_read(struct dsa_switch *ds, int addr, int reg)
{
return mdiobus_read(ds->master_mii_bus, addr, reg);
return mdiobus_read(ds->master_mii_bus, ds->pd->sw_addr + addr, reg);
}

#define REG_READ(addr, reg) \
Expand All @@ -34,7 +34,8 @@ static int reg_read(struct dsa_switch *ds, int addr, int reg)

static int reg_write(struct dsa_switch *ds, int addr, int reg, u16 val)
{
return mdiobus_write(ds->master_mii_bus, addr, reg, val);
return mdiobus_write(ds->master_mii_bus, ds->pd->sw_addr + addr,
reg, val);
}

#define REG_WRITE(addr, reg, val) \
Expand All @@ -50,7 +51,7 @@ static char *mv88e6060_probe(struct mii_bus *bus, int sw_addr)
{
int ret;

ret = mdiobus_read(bus, REG_PORT(0), 0x03);
ret = mdiobus_read(bus, sw_addr + REG_PORT(0), 0x03);
if (ret >= 0) {
ret &= 0xfff0;
if (ret == 0x0600)
Expand Down

0 comments on commit fdb838c

Please sign in to comment.