Skip to content

Commit d5b4fd6

Browse files
jonasjelonekAndi Shyti
authored andcommitted
i2c: rtl9300: do not set read mode on every transfer
Move the operation to set the read mode from config_xfer to probe. The I2C controller of RTL9300 and RTL9310 support a legacy message mode for READs with 'Read Address Data' instead of the standard format 'Write Address ; Read Data'. There is no way to pass that via smbus_xfer, thus there is no point in supported this in the driver and moreover no point in setting this on every transaction. Setting this once in the probe call is sufficient. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Tested-by: Sven Eckelmann <sven@narfation.org> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> # On RTL9302C based board Tested-by: Markus Stockhausen <markus.stockhausen@gmx.de> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250927101931.71575-6-jelonek.jonas@gmail.com
1 parent d1cef7a commit d5b4fd6

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/i2c/busses/i2c-rtl9300.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,7 @@ static int rtl9300_i2c_config_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_c
130130
if (ret)
131131
return ret;
132132

133-
ret = regmap_field_write(i2c->fields[F_DATA_WIDTH], (len - 1) & 0xf);
134-
if (ret)
135-
return ret;
136-
137-
return regmap_field_write(i2c->fields[F_RD_MODE], 0);
133+
return regmap_field_write(i2c->fields[F_DATA_WIDTH], (len - 1) & 0xf);
138134
}
139135

140136
static int rtl9300_i2c_read(struct rtl9300_i2c *i2c, u8 *buf, int len)
@@ -455,6 +451,11 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
455451
}
456452
i2c->sda_num = 0xff;
457453

454+
/* only use standard read format */
455+
ret = regmap_field_write(i2c->fields[F_RD_MODE], 0);
456+
if (ret)
457+
return ret;
458+
458459
return 0;
459460
}
460461

0 commit comments

Comments
 (0)