Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

atmel_spi: reload RCR before TCR

We have a wifi module connected to the spi bus and got sometimes FIFO
overrun errors on the spi bus.

After some investigation i found that the driver loads the TCR (transmit
count) register before the RCR (receive count). When the transfer list is
not empty the atmel_spi_next_message is called while tx and rx are enabled.
As soon as the TCR is loaded, hardware starts transfer and causes a rx
fifo overrun because the RCR is not loaded yet.

Load the RCR before the TCR. After this patch the fifo overrun disapears
at out setup.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Rini van Zetten <rini@arvoo.nl>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rini van Zetten and committed by
Linus Torvalds
d84248bf 6650e0a5

+1 -1
+1 -1
drivers/spi/atmel_spi.c
··· 195 195 xfer, xfer->len, xfer->tx_buf, xfer->tx_dma, 196 196 xfer->rx_buf, xfer->rx_dma, spi_readl(as, IMR)); 197 197 198 - spi_writel(as, TCR, len); 199 198 spi_writel(as, RCR, len); 199 + spi_writel(as, TCR, len); 200 200 spi_writel(as, PTCR, SPI_BIT(TXTEN) | SPI_BIT(RXTEN)); 201 201 } 202 202