Skip to content

Commit 79f42b3

Browse files
jk-ozlabsalexandrebelloni
authored andcommitted
i3c: dw: Create a generic fifo read function
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> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/827204789583dd86addffb47ecaeab9d67cf95d5.1680161823.git.jk@codeconstruct.com.au Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 7dc2e0a commit 79f42b3

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

drivers/i3c/master/dw-i3c-master.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,18 +318,24 @@ static void dw_i3c_master_wr_tx_fifo(struct dw_i3c_master *master,
318318
}
319319
}
320320

321-
static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master,
322-
u8 *bytes, int nbytes)
321+
static void dw_i3c_master_read_fifo(struct dw_i3c_master *master,
322+
int reg, u8 *bytes, int nbytes)
323323
{
324-
readsl(master->regs + RX_TX_DATA_PORT, bytes, nbytes / 4);
324+
readsl(master->regs + reg, bytes, nbytes / 4);
325325
if (nbytes & 3) {
326326
u32 tmp;
327327

328-
readsl(master->regs + RX_TX_DATA_PORT, &tmp, 1);
328+
readsl(master->regs + reg, &tmp, 1);
329329
memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3);
330330
}
331331
}
332332

333+
static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master,
334+
u8 *bytes, int nbytes)
335+
{
336+
return dw_i3c_master_read_fifo(master, RX_TX_DATA_PORT, bytes, nbytes);
337+
}
338+
333339
static struct dw_i3c_xfer *
334340
dw_i3c_master_alloc_xfer(struct dw_i3c_master *master, unsigned int ncmds)
335341
{

0 commit comments

Comments
 (0)