i2c: octeon: remove 10-bit addressing support
The driver gives the illusion of 10-bit address support, but the upper 3 bits of the given address are always thrown away. Remove unnecessary considerations for 10 bit addressing and always complete 7 bit ops when using the hlc methods. Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20250318021632.2710792-3-aryan.srivastava@alliedtelesis.co.nz Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
committed by
Andi Shyti
parent
7202745e29
commit
b1c010bd25
@@ -421,17 +421,12 @@ static int octeon_i2c_hlc_read(struct octeon_i2c *i2c, struct i2c_msg *msgs)
|
||||
octeon_i2c_hlc_enable(i2c);
|
||||
octeon_i2c_hlc_int_clear(i2c);
|
||||
|
||||
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR;
|
||||
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR | SW_TWSI_OP_7;
|
||||
/* SIZE */
|
||||
cmd |= (u64)(msgs[0].len - 1) << SW_TWSI_SIZE_SHIFT;
|
||||
/* A */
|
||||
cmd |= (u64)(msgs[0].addr & 0x7full) << SW_TWSI_ADDR_SHIFT;
|
||||
|
||||
if (msgs[0].flags & I2C_M_TEN)
|
||||
cmd |= SW_TWSI_OP_10;
|
||||
else
|
||||
cmd |= SW_TWSI_OP_7;
|
||||
|
||||
octeon_i2c_writeq_flush(cmd, i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c));
|
||||
ret = octeon_i2c_hlc_wait(i2c);
|
||||
if (ret)
|
||||
@@ -463,17 +458,12 @@ static int octeon_i2c_hlc_write(struct octeon_i2c *i2c, struct i2c_msg *msgs)
|
||||
octeon_i2c_hlc_enable(i2c);
|
||||
octeon_i2c_hlc_int_clear(i2c);
|
||||
|
||||
cmd = SW_TWSI_V | SW_TWSI_SOVR;
|
||||
cmd = SW_TWSI_V | SW_TWSI_SOVR | SW_TWSI_OP_7;
|
||||
/* SIZE */
|
||||
cmd |= (u64)(msgs[0].len - 1) << SW_TWSI_SIZE_SHIFT;
|
||||
/* A */
|
||||
cmd |= (u64)(msgs[0].addr & 0x7full) << SW_TWSI_ADDR_SHIFT;
|
||||
|
||||
if (msgs[0].flags & I2C_M_TEN)
|
||||
cmd |= SW_TWSI_OP_10;
|
||||
else
|
||||
cmd |= SW_TWSI_OP_7;
|
||||
|
||||
for (i = 0, j = msgs[0].len - 1; i < msgs[0].len && i < 4; i++, j--)
|
||||
cmd |= (u64)msgs[0].buf[j] << (8 * i);
|
||||
|
||||
@@ -513,11 +503,6 @@ static bool octeon_i2c_hlc_ext(struct octeon_i2c *i2c, struct i2c_msg msg, u64 *
|
||||
bool set_ext = false;
|
||||
u64 cmd = 0;
|
||||
|
||||
if (msg.flags & I2C_M_TEN)
|
||||
cmd |= SW_TWSI_OP_10_IA;
|
||||
else
|
||||
cmd |= SW_TWSI_OP_7_IA;
|
||||
|
||||
if (msg.len == 2) {
|
||||
cmd |= SW_TWSI_EIA;
|
||||
*ext = (u64)msg.buf[0] << SW_TWSI_IA_SHIFT;
|
||||
@@ -550,7 +535,7 @@ static int octeon_i2c_hlc_comp_read(struct octeon_i2c *i2c, struct i2c_msg *msgs
|
||||
|
||||
octeon_i2c_hlc_enable(i2c);
|
||||
|
||||
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR;
|
||||
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR | SW_TWSI_OP_7_IA;
|
||||
/* SIZE */
|
||||
cmd |= (u64)(msgs[1].len - 1) << SW_TWSI_SIZE_SHIFT;
|
||||
/* A */
|
||||
@@ -587,7 +572,7 @@ static int octeon_i2c_hlc_comp_write(struct octeon_i2c *i2c, struct i2c_msg *msg
|
||||
|
||||
octeon_i2c_hlc_enable(i2c);
|
||||
|
||||
cmd = SW_TWSI_V | SW_TWSI_SOVR;
|
||||
cmd = SW_TWSI_V | SW_TWSI_SOVR | SW_TWSI_OP_7_IA;
|
||||
/* SIZE */
|
||||
cmd |= (u64)(msgs[1].len - 1) << SW_TWSI_SIZE_SHIFT;
|
||||
/* A */
|
||||
|
||||
Reference in New Issue
Block a user