spi: davinci: add comment about dummy tx buffer usage
authorFrode Isaksen <fisaksen@baylibre.com>
Fri, 17 Mar 2017 15:41:10 +0000 (16:41 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 17 Mar 2017 22:00:51 +0000 (22:00 +0000)
Add explanation about using the the rx buffer as the
dummy tx buffer.

Signed-off-by: Frode Isaksen <fisaksen@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-davinci.c

index f37bbdd18d61772cf388d45d5327dcef556e803c..595acdcfc7d0832fbe7ef1b232e039b005788541 100644 (file)
@@ -660,7 +660,11 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
                        goto err_desc;
 
                if (!t->tx_buf) {
                        goto err_desc;
 
                if (!t->tx_buf) {
-                       /* use rx buffer as dummy tx buffer */
+                       /* To avoid errors when doing rx-only transfers with
+                        * many SG entries (> 20), use the rx buffer as the
+                        * dummy tx buffer so that dma reloads are done at the
+                        * same time for rx and tx.
+                        */
                        t->tx_sg.sgl = t->rx_sg.sgl;
                        t->tx_sg.nents = t->rx_sg.nents;
                }
                        t->tx_sg.sgl = t->rx_sg.sgl;
                        t->tx_sg.nents = t->rx_sg.nents;
                }