2022-09-22 09:07:02

by Manikanta Guntupalli

[permalink] [raw]
Subject: [PATCH V2 0/9] Added Standard mode and SMBus support.

-Added standard mode for AXI I2C controller.
-Added Smbus block read support to xiic driver.
-Added 'xlnx,axi-iic-2.1' new IP version support.
-Added dynamic SCL frequency configuration support.
-Removed 'local_irq_save/restore' calls as discussed
here: https://www.spinics.net/lists/linux-i2c/msg46483.html.

Raviteja Narayanam (9):
i2c: xiic: Add standard mode support for > 255 byte read transfers
i2c: xiic: Fix Rx and Tx paths in standard mode repeated start
i2c: xiic: Switch to Xiic standard mode for i2c-read
i2c: xiic: Add wait for FIFO empty in send_tx
i2c: xiic: Add smbus_block_read functionality
i2c: xiic: Remove interrupt enable/disable in Rx path
dt-bindings: i2c: xiic: Add 'xlnx,axi-iic-2.1' to compatible
i2c: xiic: Update compatible with new IP version
i2c: xiic: Add SCL frequency configuration support

.../bindings/i2c/xlnx,xps-iic-2.00.a.yaml | 7 +-
drivers/i2c/busses/i2c-xiic.c | 582 ++++++++++++++++--
2 files changed, 537 insertions(+), 52 deletions(-)

--
2.25.1


2022-09-22 09:18:04

by Manikanta Guntupalli

[permalink] [raw]
Subject: [PATCH V2 6/9] i2c: xiic: Remove interrupt enable/disable in Rx path

From: Raviteja Narayanam <[email protected]>

'DYNAMIC_MODE_READ_BROKEN_BIT' quirk added in the driver,
effected IP versions no longer enter dynamic mode.
So, remove local_irq_save/local_irq_restore APIs from driver.

Signed-off-by: Raviteja Narayanam <[email protected]>
Signed-off-by: Manikanta Guntupalli <[email protected]>
---
drivers/i2c/busses/i2c-xiic.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 8bd33dfdff91..31296e252279 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -741,7 +741,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
u16 rx_watermark;
u8 cr = 0, rfd_set = 0;
struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
- unsigned long flags;

dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n",
__func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET),
@@ -773,8 +772,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
bytes--;
xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, bytes);

- local_irq_save(flags);
-
/* write the address */
xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
i2c_8bit_addr_from_msg(msg) |
@@ -787,8 +784,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, val);

xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK);
-
- local_irq_restore(flags);
} else {
/*
* If previous message is Tx, make sure that Tx FIFO is empty
--
2.25.1

2022-09-22 09:19:55

by Manikanta Guntupalli

[permalink] [raw]
Subject: [PATCH V2 4/9] i2c: xiic: Add wait for FIFO empty in send_tx

From: Raviteja Narayanam <[email protected]>

If the tx_half_empty interrupt comes first instead of tx_empty,
STOP bit is generated even before all the bytes are transmitted
out on the bus.
STOP bit should be sent only after all the bytes in the FIFO are
transmitted out of the FIFO. So wait until FIFO is empty before sending
the STOP bit.

Signed-off-by: Raviteja Narayanam <[email protected]>
Signed-off-by: Manikanta Guntupalli <[email protected]>
---
drivers/i2c/busses/i2c-xiic.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 10e0fafb25f1..1149104074a7 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -436,6 +436,13 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
data |= XIIC_TX_DYN_STOP_MASK;
} else {
u8 cr;
+ int status;
+
+ /* Wait till FIFO is empty so STOP is sent last */
+ status = xiic_wait_tx_empty(i2c);
+ if (status)
+ return;
+
/* Write to CR to stop */
cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET);
xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, cr &
--
2.25.1

2022-09-26 14:20:09

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH V2 0/9] Added Standard mode and SMBus support.



On 9/22/22 10:44, Manikanta Guntupalli wrote:
> -Added standard mode for AXI I2C controller.
> -Added Smbus block read support to xiic driver.
> -Added 'xlnx,axi-iic-2.1' new IP version support.
> -Added dynamic SCL frequency configuration support.
> -Removed 'local_irq_save/restore' calls as discussed
> here: https://www.spinics.net/lists/linux-i2c/msg46483.html.
>
> Raviteja Narayanam (9):
> i2c: xiic: Add standard mode support for > 255 byte read transfers
> i2c: xiic: Fix Rx and Tx paths in standard mode repeated start
> i2c: xiic: Switch to Xiic standard mode for i2c-read
> i2c: xiic: Add wait for FIFO empty in send_tx
> i2c: xiic: Add smbus_block_read functionality
> i2c: xiic: Remove interrupt enable/disable in Rx path
> dt-bindings: i2c: xiic: Add 'xlnx,axi-iic-2.1' to compatible
> i2c: xiic: Update compatible with new IP version
> i2c: xiic: Add SCL frequency configuration support
>
> .../bindings/i2c/xlnx,xps-iic-2.00.a.yaml | 7 +-
> drivers/i2c/busses/i2c-xiic.c | 582 ++++++++++++++++--
> 2 files changed, 537 insertions(+), 52 deletions(-)
>

I was reviewing this code internally that's why

Acked-by: Michal Simek <[email protected]>

Thanks,
Michal