Linux-i3c Archive mirror
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: linux-i3c@lists.infradead.org
Cc: Matt Johnston <matt@codeconstruct.com.au>,
	Vitor Soares <ivitro@gmail.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Jack Chen <zenghuchen@google.com>,
	Billy Tsai <billy_tsai@aspeedtech.com>,
	Dylan Hung <dylan_hung@aspeedtech.com>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>
Subject: [PATCH 1/5] i3c: dw: Create a generic fifo read function
Date: Thu, 30 Mar 2023 15:50:32 +0800	[thread overview]
Message-ID: <827204789583dd86addffb47ecaeab9d67cf95d5.1680161823.git.jk@codeconstruct.com.au> (raw)
In-Reply-To: <cover.1680161823.git.jk@codeconstruct.com.au>

In a future change we'll want to read from the IBI FIFO too, so turn
dw_i3c_read_rx_fifo() into a generic read with the FIFO register as a
parameter.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
---
 drivers/i3c/master/dw-i3c-master.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 9fc03108a5db..cb38ef95f21a 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -318,18 +318,24 @@ static void dw_i3c_master_wr_tx_fifo(struct dw_i3c_master *master,
 	}
 }
 
-static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master,
-				       u8 *bytes, int nbytes)
+static void dw_i3c_master_read_fifo(struct dw_i3c_master *master,
+				    int reg,  u8 *bytes, int nbytes)
 {
-	readsl(master->regs + RX_TX_DATA_PORT, bytes, nbytes / 4);
+	readsl(master->regs + reg, bytes, nbytes / 4);
 	if (nbytes & 3) {
 		u32 tmp;
 
-		readsl(master->regs + RX_TX_DATA_PORT, &tmp, 1);
+		readsl(master->regs + reg, &tmp, 1);
 		memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3);
 	}
 }
 
+static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master,
+				       u8 *bytes, int nbytes)
+{
+	return dw_i3c_master_read_fifo(master, RX_TX_DATA_PORT, bytes, nbytes);
+}
+
 static struct dw_i3c_xfer *
 dw_i3c_master_alloc_xfer(struct dw_i3c_master *master, unsigned int ncmds)
 {
-- 
2.39.2


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2023-03-30 13:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  7:50 [PATCH 0/5] i3c: dw,ast2600: Add In-Band Interrupt support Jeremy Kerr
2023-03-30  7:50 ` Jeremy Kerr [this message]
2023-03-30 19:18   ` [PATCH 1/5] i3c: dw: Create a generic fifo read function Ben Dooks
2023-03-31  2:16     ` Jeremy Kerr
2023-03-30  7:50 ` [PATCH 2/5] i3c: dw: Turn DAT array entry into a struct Jeremy Kerr
2023-03-30  7:50 ` [PATCH 3/5] i3c: dw: Add support for in-band interrupts Jeremy Kerr
2023-03-30  7:50 ` [PATCH 4/5] i3c: dw: Add a platform facility for IBI PEC workarounds Jeremy Kerr
2023-03-30  7:50 ` [PATCH 5/5] i3c: ast2600: enable IBI support Jeremy Kerr
2023-04-05  2:27 ` [PATCH 0/5] i3c: dw,ast2600: Add In-Band Interrupt support Joel Stanley
2023-04-27 22:35 ` Alexandre Belloni
2023-04-28  0:01   ` Jeremy Kerr
2023-04-28  6:51     ` Alexandre Belloni
2023-04-28  7:34       ` Jeremy Kerr

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=827204789583dd86addffb47ecaeab9d67cf95d5.1680161823.git.jk@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@aj.id.au \
    --cc=billy_tsai@aspeedtech.com \
    --cc=dylan_hung@aspeedtech.com \
    --cc=ivitro@gmail.com \
    --cc=joel@jms.id.au \
    --cc=linux-i3c@lists.infradead.org \
    --cc=matt@codeconstruct.com.au \
    --cc=zenghuchen@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).