Skip to content

Commit b1c010b

Browse files
Aryan SrivastavaAndi Shyti
authored andcommitted
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 <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Andi Shyti <[email protected]>
1 parent 7202745 commit b1c010b

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

drivers/i2c/busses/i2c-octeon-core.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -421,17 +421,12 @@ static int octeon_i2c_hlc_read(struct octeon_i2c *i2c, struct i2c_msg *msgs)
421421
octeon_i2c_hlc_enable(i2c);
422422
octeon_i2c_hlc_int_clear(i2c);
423423

424-
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR;
424+
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR | SW_TWSI_OP_7;
425425
/* SIZE */
426426
cmd |= (u64)(msgs[0].len - 1) << SW_TWSI_SIZE_SHIFT;
427427
/* A */
428428
cmd |= (u64)(msgs[0].addr & 0x7full) << SW_TWSI_ADDR_SHIFT;
429429

430-
if (msgs[0].flags & I2C_M_TEN)
431-
cmd |= SW_TWSI_OP_10;
432-
else
433-
cmd |= SW_TWSI_OP_7;
434-
435430
octeon_i2c_writeq_flush(cmd, i2c->twsi_base + OCTEON_REG_SW_TWSI(i2c));
436431
ret = octeon_i2c_hlc_wait(i2c);
437432
if (ret)
@@ -463,17 +458,12 @@ static int octeon_i2c_hlc_write(struct octeon_i2c *i2c, struct i2c_msg *msgs)
463458
octeon_i2c_hlc_enable(i2c);
464459
octeon_i2c_hlc_int_clear(i2c);
465460

466-
cmd = SW_TWSI_V | SW_TWSI_SOVR;
461+
cmd = SW_TWSI_V | SW_TWSI_SOVR | SW_TWSI_OP_7;
467462
/* SIZE */
468463
cmd |= (u64)(msgs[0].len - 1) << SW_TWSI_SIZE_SHIFT;
469464
/* A */
470465
cmd |= (u64)(msgs[0].addr & 0x7full) << SW_TWSI_ADDR_SHIFT;
471466

472-
if (msgs[0].flags & I2C_M_TEN)
473-
cmd |= SW_TWSI_OP_10;
474-
else
475-
cmd |= SW_TWSI_OP_7;
476-
477467
for (i = 0, j = msgs[0].len - 1; i < msgs[0].len && i < 4; i++, j--)
478468
cmd |= (u64)msgs[0].buf[j] << (8 * i);
479469

@@ -513,11 +503,6 @@ static bool octeon_i2c_hlc_ext(struct octeon_i2c *i2c, struct i2c_msg msg, u64 *
513503
bool set_ext = false;
514504
u64 cmd = 0;
515505

516-
if (msg.flags & I2C_M_TEN)
517-
cmd |= SW_TWSI_OP_10_IA;
518-
else
519-
cmd |= SW_TWSI_OP_7_IA;
520-
521506
if (msg.len == 2) {
522507
cmd |= SW_TWSI_EIA;
523508
*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
550535

551536
octeon_i2c_hlc_enable(i2c);
552537

553-
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR;
538+
cmd = SW_TWSI_V | SW_TWSI_R | SW_TWSI_SOVR | SW_TWSI_OP_7_IA;
554539
/* SIZE */
555540
cmd |= (u64)(msgs[1].len - 1) << SW_TWSI_SIZE_SHIFT;
556541
/* A */
@@ -587,7 +572,7 @@ static int octeon_i2c_hlc_comp_write(struct octeon_i2c *i2c, struct i2c_msg *msg
587572

588573
octeon_i2c_hlc_enable(i2c);
589574

590-
cmd = SW_TWSI_V | SW_TWSI_SOVR;
575+
cmd = SW_TWSI_V | SW_TWSI_SOVR | SW_TWSI_OP_7_IA;
591576
/* SIZE */
592577
cmd |= (u64)(msgs[1].len - 1) << SW_TWSI_SIZE_SHIFT;
593578
/* A */

0 commit comments

Comments
 (0)