spi: atmel: init FIFOs before spi enable
[muen/linux.git] / drivers / spi / spi-atmel.c
index 4a11fc0d41367c2dd92a0559f041cd24795ae5fb..b7936f81537358dacb51a417801f5e0dac28b457 100644 (file)
@@ -1512,6 +1512,11 @@ static void atmel_spi_init(struct atmel_spi *as)
 {
        spi_writel(as, CR, SPI_BIT(SWRST));
        spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */
+
+       /* It is recommended to enable FIFOs first thing after reset */
+       if (as->fifo_size)
+               spi_writel(as, CR, SPI_BIT(FIFOEN));
+
        if (as->caps.has_wdrbt) {
                spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS)
                                | SPI_BIT(MSTR));
@@ -1522,9 +1527,6 @@ static void atmel_spi_init(struct atmel_spi *as)
        if (as->use_pdc)
                spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS));
        spi_writel(as, CR, SPI_BIT(SPIEN));
-
-       if (as->fifo_size)
-               spi_writel(as, CR, SPI_BIT(FIFOEN));
 }
 
 static int atmel_spi_probe(struct platform_device *pdev)