aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Bonn <jonas@norrbonn.se>2019-01-30 03:40:05 -0500
committerMark Brown <broonie@kernel.org>2019-01-30 18:02:11 -0500
commit473a78a7bbeb7c77b81b596095f59ce4fbbd49dc (patch)
tree8e499db920a1f02fd4ac2a20f1105442c92aa64b
parentb7bb367afa4bf9de60830683305c63030c3e581d (diff)
spi-atmel: support inter-word delay
If the SPI slave requires an inter-word delay, configure the DLYBCT register accordingly. Tested on a SAMA5D2 board (derived from SAMA5D2-Xplained reference board). Signed-off-by: Jonas Bonn <jonas@norrbonn.se> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> CC: Nicolas Ferre <nicolas.ferre@microchip.com> CC: Mark Brown <broonie@kernel.org> CC: Alexandre Belloni <alexandre.belloni@bootlin.com> CC: Ludovic Desroches <ludovic.desroches@microchip.com> CC: linux-spi@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-atmel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index f53f0c5e63da..4954f0ab1606 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1201,13 +1201,14 @@ static int atmel_spi_setup(struct spi_device *spi)
1201 csr |= SPI_BIT(CSAAT); 1201 csr |= SPI_BIT(CSAAT);
1202 1202
1203 /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs. 1203 /* DLYBS is mostly irrelevant since we manage chipselect using GPIOs.
1204 *
1205 * DLYBCT would add delays between words, slowing down transfers.
1206 * It could potentially be useful to cope with DMA bottlenecks, but
1207 * in those cases it's probably best to just use a lower bitrate.
1208 */ 1204 */
1209 csr |= SPI_BF(DLYBS, 0); 1205 csr |= SPI_BF(DLYBS, 0);
1210 csr |= SPI_BF(DLYBCT, 0); 1206
1207 /* DLYBCT adds delays between words. This is useful for slow devices
1208 * that need a bit of time to setup the next transfer.
1209 */
1210 csr |= SPI_BF(DLYBCT,
1211 (as->spi_clk / 1000000 * spi->word_delay_usecs) >> 5);
1211 1212
1212 asd = spi->controller_state; 1213 asd = spi->controller_state;
1213 if (!asd) { 1214 if (!asd) {