Skip to content

Commit

Permalink
spi: rspi: Fix loopback mode for Dual/Quad SPI Transfers
Browse files Browse the repository at this point in the history
While normal Dual and Quad SPI Transfers are unidirectional, we must do
a bidirectional transfer if loopback mode is enabled, else rx_buf is not
filled.

With spidev it seemed to work, as spidev uses the same buffer for
tranmission and reception.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Geert Uytterhoeven authored and Mark Brown committed Feb 23, 2014
1 parent ab98fcb commit ba824d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/spi/spi-rspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,9 @@ static int qspi_transfer_one(struct spi_master *master, struct spi_device *spi,
{
struct rspi_data *rspi = spi_master_get_devdata(master);

if (xfer->tx_buf && xfer->tx_nbits > SPI_NBITS_SINGLE) {
if (spi->mode & SPI_LOOP) {
return qspi_transfer_out_in(rspi, xfer);
} else if (xfer->tx_buf && xfer->tx_nbits > SPI_NBITS_SINGLE) {
/* Quad or Dual SPI Write */
return qspi_transfer_out(rspi, xfer);
} else if (xfer->rx_buf && xfer->rx_nbits > SPI_NBITS_SINGLE) {
Expand Down

0 comments on commit ba824d4

Please sign in to comment.