Skip to content

Commit df49077

Browse files
ehristevldesroches
authored andcommitted
spi: atmel: init FIFOs before spi enable
The datasheet recommends initializing FIFOs before SPI enable. If we do not do it like this, there may be a strange behavior. We noticed that DMA does not work properly with FIFOs if we do not clear them beforehand or enable them before SPIEN. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
1 parent 7276d0d commit df49077

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

drivers/spi/spi-atmel.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,11 @@ static void atmel_spi_init(struct atmel_spi *as)
15121512
{
15131513
spi_writel(as, CR, SPI_BIT(SWRST));
15141514
spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
1515+
1516+
/* It is recommended to enable FIFOs first thing after reset */
1517+
if (as->fifo_size)
1518+
spi_writel(as, CR, SPI_BIT(FIFOEN));
1519+
15151520
if (as->caps.has_wdrbt) {
15161521
spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS)
15171522
| SPI_BIT(MSTR));
@@ -1522,9 +1527,6 @@ static void atmel_spi_init(struct atmel_spi *as)
15221527
if (as->use_pdc)
15231528
spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
15241529
spi_writel(as, CR, SPI_BIT(SPIEN));
1525-
1526-
if (as->fifo_size)
1527-
spi_writel(as, CR, SPI_BIT(FIFOEN));
15281530
}
15291531

15301532
static int atmel_spi_probe(struct platform_device *pdev)

0 commit comments

Comments
 (0)