Skip to content

Commit b48a186

Browse files
Russell King (Oracle)davem330
authored andcommitted
net: mdio: i2c: fix rollball accessors
Commit 87e3bee ("net: mdio: i2c: Separate C22 and C45 transactions") separated the non-rollball bus accessors, but left the rollball accessors as is. As rollball accessors are clause 45, this results in the rollball protocol being completely non-functional. Fix this. Fixes: 87e3bee ("net: mdio: i2c: Separate C22 and C45 transactions") Signed-off-by: Russell King (Oracle) <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5306623 commit b48a186

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/net/mdio/mdio-i2c.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ static int i2c_rollball_mii_cmd(struct mii_bus *bus, int bus_addr, u8 cmd,
291291
return i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
292292
}
293293

294-
static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
294+
static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int devad,
295+
int reg)
295296
{
296297
u8 buf[4], res[6];
297298
int bus_addr, ret;
@@ -302,7 +303,7 @@ static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
302303
return 0xffff;
303304

304305
buf[0] = ROLLBALL_DATA_ADDR;
305-
buf[1] = (reg >> 16) & 0x1f;
306+
buf[1] = devad;
306307
buf[2] = (reg >> 8) & 0xff;
307308
buf[3] = reg & 0xff;
308309

@@ -322,8 +323,8 @@ static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
322323
return val;
323324
}
324325

325-
static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
326-
u16 val)
326+
static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int devad,
327+
int reg, u16 val)
327328
{
328329
int bus_addr, ret;
329330
u8 buf[6];
@@ -333,7 +334,7 @@ static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
333334
return 0;
334335

335336
buf[0] = ROLLBALL_DATA_ADDR;
336-
buf[1] = (reg >> 16) & 0x1f;
337+
buf[1] = devad;
337338
buf[2] = (reg >> 8) & 0xff;
338339
buf[3] = reg & 0xff;
339340
buf[4] = val >> 8;
@@ -405,8 +406,8 @@ struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
405406
return ERR_PTR(ret);
406407
}
407408

408-
mii->read = i2c_mii_read_rollball;
409-
mii->write = i2c_mii_write_rollball;
409+
mii->read_c45 = i2c_mii_read_rollball;
410+
mii->write_c45 = i2c_mii_write_rollball;
410411
break;
411412
default:
412413
mii->read = i2c_mii_read_default_c22;

0 commit comments

Comments
 (0)