public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>,
	<linux-i2c@vger.kernel.org>
Cc: <michal.simek@xilinx.com>, <git@xilinx.com>,
	Raviteja Narayanam <raviteja.narayanam@xilinx.com>
Subject: Re: [PATCH 4/4] i2c: xiic: Fix Tx Interrupt path for grouped messages
Date: Thu, 21 Apr 2022 10:51:47 +0200	[thread overview]
Message-ID: <cb06daeb-507f-d094-dcc2-4a37fde98241@xilinx.com> (raw)
In-Reply-To: <20220420075924.14546-5-shubhrajyoti.datta@xilinx.com>



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

  reply	other threads:[~2022-04-21  8:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-05-14 14:04   ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb06daeb-507f-d094-dcc2-4a37fde98241@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=git@xilinx.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=raviteja.narayanam@xilinx.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox