diff mbox series

[v2,1/2] i2c: hisi: Optimized the value setting of maxwrite limit to fifo depth - 1

Message ID 20240201061345.3111600-2-liudingyuan@huawei.com
State New
Headers show
Series i2c: hisi: Clear the interrupt status and optimize writing limitation | expand

Commit Message

Devyn Liu Feb. 1, 2024, 6:13 a.m. UTC
The driver finishs a write cycle by read the fifo tx full status
or write limit decrease to 0. The driver starts to write data to
the FIFO after the I2C FIFO almost empty interrupt is reported.
The threshold for FIFO almost empty interrupt is that the amount
of data in the FIFO is less than or equal to 1.
Reduce write maxwrite to the fifo depth - aempty interrupt
threshold. Limiting the number of data to be written at a time
to remaining fifo capacity.

Signed-off-by: Devyn Liu <liudingyuan@huawei.com>
---
 drivers/i2c/busses/i2c-hisi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andi Shyti Feb. 1, 2024, 6:51 a.m. UTC | #1
Hi Devyn,

...

>  static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
>  {
> -	int max_write = HISI_I2C_TX_FIFO_DEPTH;
> +	int max_write = HISI_I2C_TX_FIFO_DEPTH - HISI_I2C_TX_F_AE_THRESH;

this is one of the differences.

Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Thanks,
Andi
Devyn Liu Feb. 1, 2024, 7:47 a.m. UTC | #2
Hi Andi

Yes, this is the only code change in version 2 compared to version 1. In addition,
in the commit description of PATCH v2 1/2 :
v1->v2
the threshold for FIFO empty interrupt 
->
the threshold for FIFO almost empty interrupt. 

In v2 2/2, there is no change.

Thanks,
Devyn
-----邮件原件-----
发件人: Andi Shyti <andi.shyti@kernel.org> 
发送时间: 2024年2月1日 14:52
收件人: liudingyuan <liudingyuan@huawei.com>
抄送: yangyicong <yangyicong@huawei.com>; Fangjian (Jay) <f.fangjian@huawei.com>; Jonathan Cameron <jonathan.cameron@huawei.com>; linux-i2c@vger.kernel.org
主题: Re: [PATCH v2 1/2] i2c: hisi: Optimized the value setting of maxwrite limit to fifo depth - 1

Hi Devyn,

...

>  static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)  {
> -	int max_write = HISI_I2C_TX_FIFO_DEPTH;
> +	int max_write = HISI_I2C_TX_FIFO_DEPTH - HISI_I2C_TX_F_AE_THRESH;

this is one of the differences.

Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c
index dfad5bad5075..cd37053362ee 100644
--- a/drivers/i2c/busses/i2c-hisi.c
+++ b/drivers/i2c/busses/i2c-hisi.c
@@ -266,7 +266,7 @@  static int hisi_i2c_read_rx_fifo(struct hisi_i2c_controller *ctlr)
 
 static void hisi_i2c_xfer_msg(struct hisi_i2c_controller *ctlr)
 {
-	int max_write = HISI_I2C_TX_FIFO_DEPTH;
+	int max_write = HISI_I2C_TX_FIFO_DEPTH - HISI_I2C_TX_F_AE_THRESH;
 	bool need_restart = false, last_msg;
 	struct i2c_msg *cur_msg;
 	u32 cmd, fifo_state;