spi/qspi: Add dual/quad spi read support
authorSourav Poddar <sourav.poddar@ti.com>
Fri, 23 Aug 2013 09:42:16 +0000 (15:12 +0530)
committerMark Brown <broonie@linaro.org>
Fri, 23 Aug 2013 11:00:32 +0000 (12:00 +0100)
Support for multiple lines in SPI framework has been picked[1].
[1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420

Hence, adapting ti qspi driver to support multiple data lines for read.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-ti-qspi.c

index 09e241551fccc8b088d88f7a854b5f9b699632a0..c07e04170b910dc28363f605ffa919d0adba1c05 100644 (file)
@@ -267,7 +267,18 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
        u8 *rxbuf;
 
        rxbuf = t->rx_buf;
-       cmd = qspi->cmd | QSPI_RD_SNGL;
+       cmd = qspi->cmd;
+       switch (t->rx_nbits) {
+       case SPI_NBITS_DUAL:
+               cmd |= QSPI_RD_DUAL;
+               break;
+       case SPI_NBITS_QUAD:
+               cmd |= QSPI_RD_QUAD;
+               break;
+       default:
+               cmd |= QSPI_RD_SNGL;
+               break;
+       }
        count = t->len;
        wlen = t->bits_per_word;