Commit 19ea3275 authored by Stephen Boyd's avatar Stephen Boyd Committed by Mark Brown

spi: spi-geni-qcom: Simplify setup_fifo_xfer()

The definition of SPI_FULL_DUPLEX (3) is really SPI_TX_ONLY (1) ORed
with SPI_RX_ONLY (2). Let's drop the define and simplify the code here a
bit by collapsing the setting of 'm_cmd' into conditions that are the
same.

This is a non-functional change, just cleanup to consolidate code.
Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20200620022233.64716-2-swboyd@chromium.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7ba9bdcb
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
/* M_CMD OP codes for SPI */ /* M_CMD OP codes for SPI */
#define SPI_TX_ONLY 1 #define SPI_TX_ONLY 1
#define SPI_RX_ONLY 2 #define SPI_RX_ONLY 2
#define SPI_FULL_DUPLEX 3
#define SPI_TX_RX 7 #define SPI_TX_RX 7
#define SPI_CS_ASSERT 8 #define SPI_CS_ASSERT 8
#define SPI_CS_DEASSERT 9 #define SPI_CS_DEASSERT 9
...@@ -353,12 +352,6 @@ static void setup_fifo_xfer(struct spi_transfer *xfer, ...@@ -353,12 +352,6 @@ static void setup_fifo_xfer(struct spi_transfer *xfer,
mas->tx_rem_bytes = 0; mas->tx_rem_bytes = 0;
mas->rx_rem_bytes = 0; mas->rx_rem_bytes = 0;
if (xfer->tx_buf && xfer->rx_buf)
m_cmd = SPI_FULL_DUPLEX;
else if (xfer->tx_buf)
m_cmd = SPI_TX_ONLY;
else if (xfer->rx_buf)
m_cmd = SPI_RX_ONLY;
spi_tx_cfg &= ~CS_TOGGLE; spi_tx_cfg &= ~CS_TOGGLE;
...@@ -369,12 +362,14 @@ static void setup_fifo_xfer(struct spi_transfer *xfer, ...@@ -369,12 +362,14 @@ static void setup_fifo_xfer(struct spi_transfer *xfer,
len &= TRANS_LEN_MSK; len &= TRANS_LEN_MSK;
mas->cur_xfer = xfer; mas->cur_xfer = xfer;
if (m_cmd & SPI_TX_ONLY) { if (xfer->tx_buf) {
m_cmd |= SPI_TX_ONLY;
mas->tx_rem_bytes = xfer->len; mas->tx_rem_bytes = xfer->len;
writel(len, se->base + SE_SPI_TX_TRANS_LEN); writel(len, se->base + SE_SPI_TX_TRANS_LEN);
} }
if (m_cmd & SPI_RX_ONLY) { if (xfer->rx_buf) {
m_cmd |= SPI_RX_ONLY;
writel(len, se->base + SE_SPI_RX_TRANS_LEN); writel(len, se->base + SE_SPI_RX_TRANS_LEN);
mas->rx_rem_bytes = xfer->len; mas->rx_rem_bytes = xfer->len;
} }
......
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