Skip to content

Commit 6e055b1

Browse files
gastmaieralexandrebelloni
authored andcommitted
i3c: master: dw: Use i3c_writel_fifo() and i3c_readl_fifo()
Use common inline i3c_writel_fifo()/i3c_readl_fifo() methods to simplify code since the FIFO of controller is a 32bit width. Signed-off-by: Jorge Marques <[email protected]> Reviewed-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
1 parent c20d3fa commit 6e055b1

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/reset.h>
2424
#include <linux/slab.h>
2525

26+
#include "../internals.h"
2627
#include "dw-i3c-master.h"
2728

2829
#define DEVICE_CTRL 0x0
@@ -336,37 +337,19 @@ static int dw_i3c_master_get_free_pos(struct dw_i3c_master *master)
336337
static void dw_i3c_master_wr_tx_fifo(struct dw_i3c_master *master,
337338
const u8 *bytes, int nbytes)
338339
{
339-
writesl(master->regs + RX_TX_DATA_PORT, bytes, nbytes / 4);
340-
if (nbytes & 3) {
341-
u32 tmp = 0;
342-
343-
memcpy(&tmp, bytes + (nbytes & ~3), nbytes & 3);
344-
writesl(master->regs + RX_TX_DATA_PORT, &tmp, 1);
345-
}
346-
}
347-
348-
static void dw_i3c_master_read_fifo(struct dw_i3c_master *master,
349-
int reg, u8 *bytes, int nbytes)
350-
{
351-
readsl(master->regs + reg, bytes, nbytes / 4);
352-
if (nbytes & 3) {
353-
u32 tmp;
354-
355-
readsl(master->regs + reg, &tmp, 1);
356-
memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3);
357-
}
340+
i3c_writel_fifo(master->regs + RX_TX_DATA_PORT, bytes, nbytes);
358341
}
359342

360343
static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master,
361344
u8 *bytes, int nbytes)
362345
{
363-
return dw_i3c_master_read_fifo(master, RX_TX_DATA_PORT, bytes, nbytes);
346+
i3c_readl_fifo(master->regs + RX_TX_DATA_PORT, bytes, nbytes);
364347
}
365348

366349
static void dw_i3c_master_read_ibi_fifo(struct dw_i3c_master *master,
367350
u8 *bytes, int nbytes)
368351
{
369-
return dw_i3c_master_read_fifo(master, IBI_QUEUE_STATUS, bytes, nbytes);
352+
i3c_readl_fifo(master->regs + IBI_QUEUE_STATUS, bytes, nbytes);
370353
}
371354

372355
static struct dw_i3c_xfer *

0 commit comments

Comments
 (0)