Skip to content

Commit 55284a8

Browse files
Rustam AdilovAndi Shyti
authored andcommitted
i2c: rtl9300: introduce F_BUSY to the reg_fields struct
In RTL9607C i2c controller the busy check operation is done on the separate bit of the command register as opposed to self clearing command trigger bit on the rtl9300 and rtl9310 i2c controllers. Introduce a new F_BUSY field to the reg_fields struct for that and change the regmap read poll function to use F_BUSY instead of I2C_TRIG. Signed-off-by: Rustam Adilov <adilov@disroot.org> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260401180648.337834-4-adilov@disroot.org
1 parent 98773df commit 55284a8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/i2c/busses/i2c-rtl9300.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum rtl9300_i2c_reg_fields {
5353
F_SCL_SEL,
5454
F_SDA_OUT_SEL,
5555
F_SDA_SEL,
56+
F_BUSY,
5657

5758
/* keep last */
5859
F_NUM_FIELDS
@@ -262,7 +263,7 @@ static int rtl9300_i2c_do_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_xfer
262263
if (ret)
263264
return ret;
264265

265-
ret = regmap_field_read_poll_timeout(i2c->fields[F_I2C_TRIG], val, !val, 100, 100000);
266+
ret = regmap_field_read_poll_timeout(i2c->fields[F_BUSY], val, !val, 100, 100000);
266267
if (ret)
267268
return ret;
268269

@@ -505,6 +506,7 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
505506
[F_MEM_ADDR_WIDTH] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL2, 2, 3),
506507
[F_SCL_FREQ] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL2, 0, 1),
507508
[F_SDA_SEL] = GLB_REG_FIELD(RTL9300_I2C_MST_GLB_CTRL, 0, 7),
509+
[F_BUSY] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL1, 0, 0),
508510
},
509511
.select_scl = rtl9300_i2c_select_scl,
510512
.rd_reg = RTL9300_I2C_MST_DATA_WORD0,
@@ -527,6 +529,7 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
527529
[F_I2C_FAIL] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 1, 1),
528530
[F_I2C_TRIG] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 0, 0),
529531
[F_MEM_ADDR] = MST_REG_FIELD(RTL9310_I2C_MST_MEMADDR_CTRL, 0, 23),
532+
[F_BUSY] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 0, 0),
530533
},
531534
.select_scl = rtl9310_i2c_select_scl,
532535
.rd_reg = RTL9310_I2C_MST_DATA_CTRL,

0 commit comments

Comments
 (0)