All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] i2c: xiic: misc fixes
@ 2022-04-20  7:59 Shubhrajyoti Datta
  2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Shubhrajyoti Datta @ 2022-04-20  7:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

Fix the coding style issues.
Fix the interrupt path for grouped messages.

Michal Simek (1):
  i2c: xiic: Fix coding style issues

Raviteja Narayanam (1):
  i2c: xiic: Fix Tx Interrupt path for grouped messages

Shubhrajyoti Datta (2):
  i2c-xiic: return value of xiic_reinit
  i2c: xiic: Correct the datatype for rx_watermark

 drivers/i2c/busses/i2c-xiic.c | 82 +++++++++++++++++++----------------
 1 file changed, 45 insertions(+), 37 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] i2c-xiic: return value of xiic_reinit
  2022-04-20  7:59 [PATCH 0/4] i2c: xiic: misc fixes Shubhrajyoti Datta
@ 2022-04-20  7:59 ` Shubhrajyoti Datta
  2022-04-21  8:46   ` Michal Simek
  2022-05-14 14:03   ` Wolfram Sang
  2022-04-20  7:59 ` [PATCH 2/4] i2c: xiic: Fix coding style issues Shubhrajyoti Datta
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Shubhrajyoti Datta @ 2022-04-20  7:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

Check the return value of xiic_reinit.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index ffefe3c482e9..8b39f9c7e773 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -381,6 +381,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 	int xfer_more = 0;
 	int wakeup_req = 0;
 	int wakeup_code = 0;
+	int ret;
 
 	/* Get the interrupt Status from the IPIF. There is no clearing of
 	 * interrupts in the IPIF. Interrupts must be cleared at the source.
@@ -415,7 +416,9 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 		 * fifos and the next message is a TX with len 0 (only addr)
 		 * reset the IP instead of just flush fifos
 		 */
-		xiic_reinit(i2c);
+		ret = xiic_reinit(i2c);
+		if (!ret)
+			dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
 
 		if (i2c->rx_msg) {
 			wakeup_req = 1;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] i2c: xiic: Fix coding style issues
  2022-04-20  7:59 [PATCH 0/4] i2c: xiic: misc fixes Shubhrajyoti Datta
  2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
@ 2022-04-20  7:59 ` Shubhrajyoti Datta
  2022-05-14 14:03   ` Wolfram Sang
  2022-04-20  7:59 ` [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark Shubhrajyoti Datta
  2022-04-20  7:59 ` [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages Shubhrajyoti Datta
  3 siblings, 1 reply; 12+ messages in thread
From: Shubhrajyoti Datta @ 2022-04-20  7:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

From: Michal Simek <michal.simek@xilinx.com>

Most of these stuff are reported by checkpatch.
But fixes are:
- Incorrect indetation
- Missing blank line after variable declaration
- Additional ()
- Missing spaces around +
- Missing parenthesis when if has them
- Newlines
- Remove MODULE_ALIAS - none is really using it

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 37 +++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 8b39f9c7e773..16a7e3164e68 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -78,24 +78,23 @@ struct xiic_i2c {
 	bool singlemaster;
 };
 
-
 #define XIIC_MSB_OFFSET 0
-#define XIIC_REG_OFFSET (0x100+XIIC_MSB_OFFSET)
+#define XIIC_REG_OFFSET (0x100 + XIIC_MSB_OFFSET)
 
 /*
  * Register offsets in bytes from RegisterBase. Three is added to the
  * base offset to access LSB (IBM style) of the word
  */
-#define XIIC_CR_REG_OFFSET   (0x00+XIIC_REG_OFFSET)	/* Control Register   */
-#define XIIC_SR_REG_OFFSET   (0x04+XIIC_REG_OFFSET)	/* Status Register    */
-#define XIIC_DTR_REG_OFFSET  (0x08+XIIC_REG_OFFSET)	/* Data Tx Register   */
-#define XIIC_DRR_REG_OFFSET  (0x0C+XIIC_REG_OFFSET)	/* Data Rx Register   */
-#define XIIC_ADR_REG_OFFSET  (0x10+XIIC_REG_OFFSET)	/* Address Register   */
-#define XIIC_TFO_REG_OFFSET  (0x14+XIIC_REG_OFFSET)	/* Tx FIFO Occupancy  */
-#define XIIC_RFO_REG_OFFSET  (0x18+XIIC_REG_OFFSET)	/* Rx FIFO Occupancy  */
-#define XIIC_TBA_REG_OFFSET  (0x1C+XIIC_REG_OFFSET)	/* 10 Bit Address reg */
-#define XIIC_RFD_REG_OFFSET  (0x20+XIIC_REG_OFFSET)	/* Rx FIFO Depth reg  */
-#define XIIC_GPO_REG_OFFSET  (0x24+XIIC_REG_OFFSET)	/* Output Register    */
+#define XIIC_CR_REG_OFFSET   (0x00 + XIIC_REG_OFFSET)	/* Control Register   */
+#define XIIC_SR_REG_OFFSET   (0x04 + XIIC_REG_OFFSET)	/* Status Register    */
+#define XIIC_DTR_REG_OFFSET  (0x08 + XIIC_REG_OFFSET)	/* Data Tx Register   */
+#define XIIC_DRR_REG_OFFSET  (0x0C + XIIC_REG_OFFSET)	/* Data Rx Register   */
+#define XIIC_ADR_REG_OFFSET  (0x10 + XIIC_REG_OFFSET)	/* Address Register   */
+#define XIIC_TFO_REG_OFFSET  (0x14 + XIIC_REG_OFFSET)	/* Tx FIFO Occupancy  */
+#define XIIC_RFO_REG_OFFSET  (0x18 + XIIC_REG_OFFSET)	/* Rx FIFO Occupancy  */
+#define XIIC_TBA_REG_OFFSET  (0x1C + XIIC_REG_OFFSET)	/* 10 Bit Address reg */
+#define XIIC_RFD_REG_OFFSET  (0x20 + XIIC_REG_OFFSET)	/* Rx FIFO Depth reg  */
+#define XIIC_GPO_REG_OFFSET  (0x24 + XIIC_REG_OFFSET)	/* Output Register    */
 
 /* Control Register masks */
 #define XIIC_CR_ENABLE_DEVICE_MASK        0x01	/* Device enable = 1      */
@@ -233,18 +232,21 @@ static inline int xiic_getreg32(struct xiic_i2c *i2c, int reg)
 static inline void xiic_irq_dis(struct xiic_i2c *i2c, u32 mask)
 {
 	u32 ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
+
 	xiic_setreg32(i2c, XIIC_IIER_OFFSET, ier & ~mask);
 }
 
 static inline void xiic_irq_en(struct xiic_i2c *i2c, u32 mask)
 {
 	u32 ier = xiic_getreg32(i2c, XIIC_IIER_OFFSET);
+
 	xiic_setreg32(i2c, XIIC_IIER_OFFSET, ier | mask);
 }
 
 static inline void xiic_irq_clr(struct xiic_i2c *i2c, u32 mask)
 {
 	u32 isr = xiic_getreg32(i2c, XIIC_IISR_OFFSET);
+
 	xiic_setreg32(i2c, XIIC_IISR_OFFSET, isr & mask);
 }
 
@@ -355,7 +357,8 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
 
 	while (len--) {
 		u16 data = i2c->tx_msg->buf[i2c->tx_pos++];
-		if ((xiic_tx_space(i2c) == 0) && (i2c->nmsgs == 1)) {
+
+		if (!xiic_tx_space(i2c) && i2c->nmsgs == 1) {
 			/* last message in transfer -> STOP */
 			data |= XIIC_TX_DYN_STOP_MASK;
 			dev_dbg(i2c->adap.dev.parent, "%s TX STOP\n", __func__);
@@ -402,8 +405,8 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 
 	/* Service requesting interrupt */
 	if ((pend & XIIC_INTR_ARB_LOST_MASK) ||
-		((pend & XIIC_INTR_TX_ERROR_MASK) &&
-		!(pend & XIIC_INTR_RX_FULL_MASK))) {
+	    ((pend & XIIC_INTR_TX_ERROR_MASK) &&
+	    !(pend & XIIC_INTR_RX_FULL_MASK))) {
 		/* bus arbritration lost, or...
 		 * Transmit error _OR_ RX completed
 		 * if this happens when RX_FULL is not set
@@ -641,6 +644,7 @@ static void xiic_start_send(struct xiic_i2c *i2c)
 static void __xiic_start_xfer(struct xiic_i2c *i2c)
 {
 	int fifo_space = xiic_tx_fifo_space(i2c);
+
 	dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, fifos space: %d\n",
 		__func__, i2c->tx_msg, fifo_space);
 
@@ -742,7 +746,6 @@ static const struct i2c_adapter xiic_adapter = {
 	.quirks = &xiic_quirks,
 };
 
-
 static int xiic_i2c_probe(struct platform_device *pdev)
 {
 	struct xiic_i2c *i2c;
@@ -902,6 +905,7 @@ static const struct dev_pm_ops xiic_dev_pm_ops = {
 	SET_RUNTIME_PM_OPS(xiic_i2c_runtime_suspend,
 			   xiic_i2c_runtime_resume, NULL)
 };
+
 static struct platform_driver xiic_i2c_driver = {
 	.probe   = xiic_i2c_probe,
 	.remove  = xiic_i2c_remove,
@@ -917,4 +921,3 @@ module_platform_driver(xiic_i2c_driver);
 MODULE_AUTHOR("info@mocean-labs.com");
 MODULE_DESCRIPTION("Xilinx I2C bus driver");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:"DRIVER_NAME);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark
  2022-04-20  7:59 [PATCH 0/4] i2c: xiic: misc fixes Shubhrajyoti Datta
  2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
  2022-04-20  7:59 ` [PATCH 2/4] i2c: xiic: Fix coding style issues Shubhrajyoti Datta
@ 2022-04-20  7:59 ` Shubhrajyoti Datta
  2022-04-21  8:50   ` Michal Simek
  2022-04-20  7:59 ` [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages Shubhrajyoti Datta
  3 siblings, 1 reply; 12+ messages in thread
From: Shubhrajyoti Datta @ 2022-04-20  7:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

The message length data type should be u16 as per the i2c_msg structure

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 16a7e3164e68..eb4d34e7c0fe 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -576,7 +576,7 @@ static int xiic_busy(struct xiic_i2c *i2c)
 
 static void xiic_start_recv(struct xiic_i2c *i2c)
 {
-	u8 rx_watermark;
+	u16 rx_watermark;
 	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
 
 	/* Clear and enable Rx full interrupt. */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages
  2022-04-20  7:59 [PATCH 0/4] i2c: xiic: misc fixes Shubhrajyoti Datta
                   ` (2 preceding siblings ...)
  2022-04-20  7:59 ` [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark Shubhrajyoti Datta
@ 2022-04-20  7:59 ` Shubhrajyoti Datta
  2022-04-21  8:51   ` Michal Simek
  2022-05-14 14:04   ` Wolfram Sang
  3 siblings, 2 replies; 12+ messages in thread
From: Shubhrajyoti Datta @ 2022-04-20  7:59 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Raviteja Narayanam, Shubhrajyoti Datta

From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>

When a group of messages are sent from user space as a set, if
the last message has less than Tx FIFO DEPTH number of bytes
to transfer, Tx half empty interrupt is triggered continuously
from the hardware. It is due to Bus not busy interrupt coming
along with Tx half empty and tx empty.

Hence, service the Tx interrupts before Bus not busy interrupt
to update the i2c message status correctly.

Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 38 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index eb4d34e7c0fe..953f7cffe0d8 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -468,24 +468,6 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 			}
 		}
 	}
-	if (pend & XIIC_INTR_BNB_MASK) {
-		/* IIC bus has transitioned to not busy */
-		clr |= XIIC_INTR_BNB_MASK;
-
-		/* The bus is not busy, disable BusNotBusy interrupt */
-		xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
-
-		if (!i2c->tx_msg)
-			goto out;
-
-		wakeup_req = 1;
-
-		if (i2c->nmsgs == 1 && !i2c->rx_msg &&
-		    xiic_tx_space(i2c) == 0)
-			wakeup_code = STATE_DONE;
-		else
-			wakeup_code = STATE_ERROR;
-	}
 	if (pend & (XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_HALF_MASK)) {
 		/* Transmit register/FIFO is empty or ½ empty */
 
@@ -522,6 +504,26 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 			 */
 			xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK);
 	}
+
+	if (pend & XIIC_INTR_BNB_MASK) {
+		/* IIC bus has transitioned to not busy */
+		clr |= XIIC_INTR_BNB_MASK;
+
+		/* The bus is not busy, disable BusNotBusy interrupt */
+		xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
+
+		if (!i2c->tx_msg)
+			goto out;
+
+		wakeup_req = 1;
+
+		if (i2c->nmsgs == 1 && !i2c->rx_msg &&
+		    xiic_tx_space(i2c) == 0)
+			wakeup_code = STATE_DONE;
+		else
+			wakeup_code = STATE_ERROR;
+	}
+
 out:
 	dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] i2c-xiic: return value of xiic_reinit
  2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
@ 2022-04-21  8:46   ` Michal Simek
  2022-05-14 14:03   ` Wolfram Sang
  1 sibling, 0 replies; 12+ messages in thread
From: Michal Simek @ 2022-04-21  8:46 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-i2c; +Cc: michal.simek, git



On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> Check the return value of xiic_reinit.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>   drivers/i2c/busses/i2c-xiic.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index ffefe3c482e9..8b39f9c7e773 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -381,6 +381,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
>   	int xfer_more = 0;
>   	int wakeup_req = 0;
>   	int wakeup_code = 0;
> +	int ret;
>   
>   	/* Get the interrupt Status from the IPIF. There is no clearing of
>   	 * interrupts in the IPIF. Interrupts must be cleared at the source.
> @@ -415,7 +416,9 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
>   		 * fifos and the next message is a TX with len 0 (only addr)
>   		 * reset the IP instead of just flush fifos
>   		 */
> -		xiic_reinit(i2c);
> +		ret = xiic_reinit(i2c);
> +		if (!ret)
> +			dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
>   
>   		if (i2c->rx_msg) {
>   			wakeup_req = 1;

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark
  2022-04-20  7:59 ` [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark Shubhrajyoti Datta
@ 2022-04-21  8:50   ` Michal Simek
  2022-05-14 14:04     ` Wolfram Sang
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Simek @ 2022-04-21  8:50 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-i2c; +Cc: michal.simek, git



On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> The message length data type should be u16 as per the i2c_msg structure
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>   drivers/i2c/busses/i2c-xiic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 16a7e3164e68..eb4d34e7c0fe 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -576,7 +576,7 @@ static int xiic_busy(struct xiic_i2c *i2c)
>   
>   static void xiic_start_recv(struct xiic_i2c *i2c)
>   {
> -	u8 rx_watermark;
> +	u16 rx_watermark;
>   	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
>   
>   	/* Clear and enable Rx full interrupt. */

xiic_setreg8(struct xiic_i2c *i2c, int reg, u8 value) has u8 value it means I 
would expect you will also recast it.
Value can't be more then IIC_RX_FIFO_DEPTH anyway that's why it shouldn't be a 
problem.

xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, (u8)(rx_watermark - 1));

Thanks,
Michal

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages
  2022-04-20  7:59 ` [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages Shubhrajyoti Datta
@ 2022-04-21  8:51   ` Michal Simek
  2022-05-14 14:04   ` Wolfram Sang
  1 sibling, 0 replies; 12+ messages in thread
From: Michal Simek @ 2022-04-21  8:51 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-i2c; +Cc: michal.simek, git, Raviteja Narayanam



On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> 
> When a group of messages are sent from user space as a set, if
> the last message has less than Tx FIFO DEPTH number of bytes
> to transfer, Tx half empty interrupt is triggered continuously
> from the hardware. It is due to Bus not busy interrupt coming
> along with Tx half empty and tx empty.
> 
> Hence, service the Tx interrupts before Bus not busy interrupt
> to update the i2c message status correctly.
> 
> Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>   drivers/i2c/busses/i2c-xiic.c | 38 ++++++++++++++++++-----------------
>   1 file changed, 20 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index eb4d34e7c0fe..953f7cffe0d8 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -468,24 +468,6 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
>   			}
>   		}
>   	}
> -	if (pend & XIIC_INTR_BNB_MASK) {
> -		/* IIC bus has transitioned to not busy */
> -		clr |= XIIC_INTR_BNB_MASK;
> -
> -		/* The bus is not busy, disable BusNotBusy interrupt */
> -		xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
> -
> -		if (!i2c->tx_msg)
> -			goto out;
> -
> -		wakeup_req = 1;
> -
> -		if (i2c->nmsgs == 1 && !i2c->rx_msg &&
> -		    xiic_tx_space(i2c) == 0)
> -			wakeup_code = STATE_DONE;
> -		else
> -			wakeup_code = STATE_ERROR;
> -	}
>   	if (pend & (XIIC_INTR_TX_EMPTY_MASK | XIIC_INTR_TX_HALF_MASK)) {
>   		/* Transmit register/FIFO is empty or ½ empty */
>   
> @@ -522,6 +504,26 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
>   			 */
>   			xiic_irq_dis(i2c, XIIC_INTR_TX_HALF_MASK);
>   	}
> +
> +	if (pend & XIIC_INTR_BNB_MASK) {
> +		/* IIC bus has transitioned to not busy */
> +		clr |= XIIC_INTR_BNB_MASK;
> +
> +		/* The bus is not busy, disable BusNotBusy interrupt */
> +		xiic_irq_dis(i2c, XIIC_INTR_BNB_MASK);
> +
> +		if (!i2c->tx_msg)
> +			goto out;
> +
> +		wakeup_req = 1;
> +
> +		if (i2c->nmsgs == 1 && !i2c->rx_msg &&
> +		    xiic_tx_space(i2c) == 0)
> +			wakeup_code = STATE_DONE;
> +		else
> +			wakeup_code = STATE_ERROR;
> +	}
> +
>   out:
>   	dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr);
>   

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] i2c-xiic: return value of xiic_reinit
  2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
  2022-04-21  8:46   ` Michal Simek
@ 2022-05-14 14:03   ` Wolfram Sang
  1 sibling, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2022-05-14 14:03 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-i2c, michal.simek, git

[-- Attachment #1: Type: text/plain, Size: 218 bytes --]

On Wed, Apr 20, 2022 at 01:29:21PM +0530, Shubhrajyoti Datta wrote:
> Check the return value of xiic_reinit.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] i2c: xiic: Fix coding style issues
  2022-04-20  7:59 ` [PATCH 2/4] i2c: xiic: Fix coding style issues Shubhrajyoti Datta
@ 2022-05-14 14:03   ` Wolfram Sang
  0 siblings, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2022-05-14 14:03 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-i2c, michal.simek, git

[-- Attachment #1: Type: text/plain, Size: 586 bytes --]

On Wed, Apr 20, 2022 at 01:29:22PM +0530, Shubhrajyoti Datta wrote:
> From: Michal Simek <michal.simek@xilinx.com>
> 
> Most of these stuff are reported by checkpatch.
> But fixes are:
> - Incorrect indetation
> - Missing blank line after variable declaration
> - Additional ()
> - Missing spaces around +
> - Missing parenthesis when if has them
> - Newlines
> - Remove MODULE_ALIAS - none is really using it
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages
  2022-04-20  7:59 ` [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages Shubhrajyoti Datta
  2022-04-21  8:51   ` Michal Simek
@ 2022-05-14 14:04   ` Wolfram Sang
  1 sibling, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2022-05-14 14:04 UTC (permalink / raw)
  To: Shubhrajyoti Datta; +Cc: linux-i2c, michal.simek, git, Raviteja Narayanam

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]

On Wed, Apr 20, 2022 at 01:29:24PM +0530, Shubhrajyoti Datta wrote:
> From: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> 
> When a group of messages are sent from user space as a set, if
> the last message has less than Tx FIFO DEPTH number of bytes
> to transfer, Tx half empty interrupt is triggered continuously
> from the hardware. It is due to Bus not busy interrupt coming
> along with Tx half empty and tx empty.
> 
> Hence, service the Tx interrupts before Bus not busy interrupt
> to update the i2c message status correctly.
> 
> Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xilinx.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark
  2022-04-21  8:50   ` Michal Simek
@ 2022-05-14 14:04     ` Wolfram Sang
  0 siblings, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2022-05-14 14:04 UTC (permalink / raw)
  To: Michal Simek; +Cc: Shubhrajyoti Datta, linux-i2c, git

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

On Thu, Apr 21, 2022 at 10:50:32AM +0200, Michal Simek wrote:
> 
> 
> On 4/20/22 09:59, Shubhrajyoti Datta wrote:
> > The message length data type should be u16 as per the i2c_msg structure
> > 
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> > ---
> >   drivers/i2c/busses/i2c-xiic.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> > index 16a7e3164e68..eb4d34e7c0fe 100644
> > --- a/drivers/i2c/busses/i2c-xiic.c
> > +++ b/drivers/i2c/busses/i2c-xiic.c
> > @@ -576,7 +576,7 @@ static int xiic_busy(struct xiic_i2c *i2c)
> >   static void xiic_start_recv(struct xiic_i2c *i2c)
> >   {
> > -	u8 rx_watermark;
> > +	u16 rx_watermark;
> >   	struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
> >   	/* Clear and enable Rx full interrupt. */
> 
> xiic_setreg8(struct xiic_i2c *i2c, int reg, u8 value) has u8 value it means
> I would expect you will also recast it.
> Value can't be more then IIC_RX_FIFO_DEPTH anyway that's why it shouldn't be
> a problem.
> 
> xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, (u8)(rx_watermark - 1));

Waiting for v2 here.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-05-14 14:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20  7:59 [PATCH 0/4] i2c: xiic: misc fixes Shubhrajyoti Datta
2022-04-20  7:59 ` [PATCH 1/4] i2c-xiic: return value of xiic_reinit Shubhrajyoti Datta
2022-04-21  8:46   ` Michal Simek
2022-05-14 14:03   ` Wolfram Sang
2022-04-20  7:59 ` [PATCH 2/4] i2c: xiic: Fix coding style issues Shubhrajyoti Datta
2022-05-14 14:03   ` Wolfram Sang
2022-04-20  7:59 ` [PATCH 3/4] i2c: xiic: Correct the datatype for rx_watermark Shubhrajyoti Datta
2022-04-21  8:50   ` Michal Simek
2022-05-14 14:04     ` Wolfram Sang
2022-04-20  7:59 ` [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages Shubhrajyoti Datta
2022-04-21  8:51   ` Michal Simek
2022-05-14 14:04   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.