Commit 79f42b31 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Alexandre Belloni

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: default avatarJeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: default avatarJoel Stanley <joel@jms.id.au>
Link: https://lore.kernel.org/r/827204789583dd86addffb47ecaeab9d67cf95d5.1680161823.git.jk@codeconstruct.com.auSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 7dc2e0a8
...@@ -318,18 +318,24 @@ static void dw_i3c_master_wr_tx_fifo(struct dw_i3c_master *master, ...@@ -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, static void dw_i3c_master_read_fifo(struct dw_i3c_master *master,
u8 *bytes, int nbytes) 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) { if (nbytes & 3) {
u32 tmp; u32 tmp;
readsl(master->regs + RX_TX_DATA_PORT, &tmp, 1); readsl(master->regs + reg, &tmp, 1);
memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3); 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 * static struct dw_i3c_xfer *
dw_i3c_master_alloc_xfer(struct dw_i3c_master *master, unsigned int ncmds) dw_i3c_master_alloc_xfer(struct dw_i3c_master *master, unsigned int ncmds)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment