Message ID | 827204789583dd86addffb47ecaeab9d67cf95d5.1680161823.git.jk@codeconstruct.com.au (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | i3c: dw,ast2600: Add In-Band Interrupt support | expand |
On 30/03/2023 08:50, Jeremy Kerr wrote: > 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); > +} > + Might want to make it inline too. > static struct dw_i3c_xfer * > dw_i3c_master_alloc_xfer(struct dw_i3c_master *master, unsigned int ncmds) > {
Hi Ben, > > +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); > > +} > > + > > Might want to make it inline too. The compiler will almost certainly work that out: $ arm-linux-gnueabihf-objdump -t drivers/i3c/master/dw-i3c-master.o | grep fifo 00000b74 l F .text 000000a4 dw_i3c_master_read_fifo - and I'd prefer to not override any compiler decision not to inline, if that works out better in specific circumstances or with any future changes. Cheers, Jeremy
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) {
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(-)