mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manikanta Guntupalli <manikanta.guntupalli@xilinx.com>
To: <michal.simek@xilinx.com>, <michal.simek@amd.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <radhey.shyam.pandey@amd.com>, <srinivas.goud@amd.com>,
	<shubhrajyoti.datta@amd.com>,
	Raviteja Narayanam <raviteja.narayanam@xilinx.com>,
	Manikanta Guntupalli <manikanta.guntupalli@xilinx.com>
Subject: [PATCH V2 4/9] i2c: xiic: Add wait for FIFO empty in send_tx
Date: Thu, 22 Sep 2022 14:14:49 +0530	[thread overview]
Message-ID: <1663836294-5698-5-git-send-email-manikanta.guntupalli@xilinx.com> (raw)
In-Reply-To: <1663836294-5698-1-git-send-email-manikanta.guntupalli@xilinx.com>

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

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 <raviteja.narayanam@xilinx.com>
Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@xilinx.com>
---
 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


  parent reply	other threads:[~2022-09-22  8:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  8:44 [PATCH V2 0/9] Added Standard mode and SMBus support Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 1/9] i2c: xiic: Add standard mode support for > 255 byte Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 2/9] i2c: xiic: Fix Rx and Tx paths in standard mode Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 3/9] i2c: xiic: Switch to Xiic standard mode for i2c-read Manikanta Guntupalli
2022-09-22  8:44 ` Manikanta Guntupalli [this message]
2022-09-22  8:44 ` [PATCH V2 5/9] i2c: xiic: Add smbus_block_read functionality Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 6/9] i2c: xiic: Remove interrupt enable/disable in Rx path Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 7/9] dt-bindings: i2c: xiic: Add 'xlnx,axi-iic-2.1' to Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 8/9] i2c: xiic: Update compatible with new IP version Manikanta Guntupalli
2022-09-22  8:44 ` [PATCH V2 9/9] i2c: xiic: Add SCL frequency configuration support Manikanta Guntupalli
2022-09-26 12:16 ` [PATCH V2 0/9] Added Standard mode and SMBus support Michal Simek

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=1663836294-5698-5-git-send-email-manikanta.guntupalli@xilinx.com \
    --to=manikanta.guntupalli@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=michal.simek@xilinx.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=raviteja.narayanam@xilinx.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=srinivas.goud@amd.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

all inboxes | Powered by JetHome®