Re: [PATCH v2 2/2] i2c: amlogic: Add Amlogic A9 I2C controller driver

From: Xianwei Zhao

Date: Mon Oct 26 2026 - 23:19:01 EST


Hi Markus,
Thanks for your review.

On 2026/10/27 01:28, Markus Elfring wrote:
…
+++ b/drivers/i2c/busses/i2c-amlogic-a9.c
@@ -0,0 +1,469 @@
…

How do you think about to avoid a bit of duplicate source code?

This one has a different IP from the existing controller. They only share some similarities in register access, and most other logics are incompatible. Therefore, it is not considered for the time being.
> …
+static void aml_i2c_prepare_xfer(struct aml_i2c *i2c, enum fifo_fill_mode mode)
+{
…
+ if (mode == A9_FIFO_FILL_FULL)
+ i2c->count = min(i2c->msg->len - i2c->pos, A9_I2C_FIFO_DEPTH);
+ else
+ i2c->count = min(i2c->msg->len - i2c->pos, A9_I2C_HALF_FIFO);
…

+ i2c->count = min(i2c->msg->len - i2c->pos,
+ (mode == A9_FIFO_FILL_FULL ? A9_I2C_FIFO_DEPTH : A9_I2C_HALF_FIFO));



Will do.

…
+static int aml_i2c_xfer_msg(struct aml_i2c *i2c, struct i2c_msg *msg, bool last)
+{
…
+ if (last)
+ aml_i2c_set_mask(i2c, REG_CFG_BUS, BUS_NO_STOP, 0);
+ else
+ aml_i2c_set_mask(i2c, REG_CFG_BUS, BUS_NO_STOP, BUS_NO_STOP);
…

+ aml_i2c_set_mask(i2c, REG_CFG_BUS, BUS_NO_STOP, (last ? 0 : BUS_NO_STOP));


Will do.


Regards,
Markus