Skip to content

Commit 3d7db0f

Browse files
andy-shevbroonie
authored andcommitted
spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config
It's better to understand what bits are set for DMA and for IRQ handling in mid_spi_dma_setup() if they are grouped accordingly. Thus, refactor mid_spi_dma_setup() to separate DMA and IRQ configuration. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b3f82dc commit 3d7db0f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/spi/spi-dw-dma.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,17 +375,17 @@ static int dw_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer)
375375
dw_writel(dws, DW_SPI_DMARDLR, dws->rxburst - 1);
376376
dw_writel(dws, DW_SPI_DMATDLR, dws->fifo_len - dws->txburst);
377377

378-
if (xfer->tx_buf) {
378+
if (xfer->tx_buf)
379379
dma_ctrl |= SPI_DMA_TDMAE;
380-
imr |= SPI_INT_TXOI;
381-
}
382-
if (xfer->rx_buf) {
380+
if (xfer->rx_buf)
383381
dma_ctrl |= SPI_DMA_RDMAE;
384-
imr |= SPI_INT_RXUI | SPI_INT_RXOI;
385-
}
386382
dw_writel(dws, DW_SPI_DMACR, dma_ctrl);
387383

388384
/* Set the interrupt mask */
385+
if (xfer->tx_buf)
386+
imr |= SPI_INT_TXOI;
387+
if (xfer->rx_buf)
388+
imr |= SPI_INT_RXUI | SPI_INT_RXOI;
389389
spi_umask_intr(dws, imr);
390390

391391
reinit_completion(&dws->dma_completion);

0 commit comments

Comments
 (0)