Skip to content
Permalink
Browse files
spi: spi-geni-qcom: Slightly optimize setup of bidirectional xfters
When setting up a bidirectional transfer we need to program both the
TX and RX lengths.  We don't need a memory barrier between those two
writes.  Factor out the __iowmb() and use writel_relaxed().  This
saves a fraction of a microsecond of setup overhead on bidirectional
transfers.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
  • Loading branch information
dianders authored and intel-lab-lkp committed Sep 12, 2020
1 parent c8f785b commit 4458adf4007926cfaaa505b54a83059c9ba813ad
Showing 1 changed file with 10 additions and 3 deletions.
@@ -376,15 +376,22 @@ static void setup_fifo_xfer(struct spi_transfer *xfer,
len &= TRANS_LEN_MSK;

mas->cur_xfer = xfer;

/*
* Factor out the __iowmb() so that we can use writel_relaxed() for
* both writes below and thus only incur the overhead once even if
* we execute both of them.
*/
__iowmb();

if (xfer->tx_buf) {
m_cmd |= SPI_TX_ONLY;
mas->tx_rem_bytes = xfer->len;
writel(len, se->base + SE_SPI_TX_TRANS_LEN);
writel_relaxed(len, se->base + SE_SPI_TX_TRANS_LEN);
}

if (xfer->rx_buf) {
m_cmd |= SPI_RX_ONLY;
writel(len, se->base + SE_SPI_RX_TRANS_LEN);
writel_relaxed(len, se->base + SE_SPI_RX_TRANS_LEN);
mas->rx_rem_bytes = xfer->len;
}

0 comments on commit 4458adf

Please sign in to comment.