diff options
author | Eugen Hristev <eugen.hristev@microchip.com> | 2018-02-27 05:25:07 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-27 09:00:45 -0500 |
commit | 9581329eff9db72ab4fbb46a594fd7fdda3c51b0 (patch) | |
tree | aaba81e368d15814f9541364a96fa65792ba211b | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
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>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
-rw-r--r-- | drivers/spi/spi-atmel.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 4a11fc0d4136..b7936f815373 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -1512,6 +1512,11 @@ static void atmel_spi_init(struct atmel_spi *as) | |||
1512 | { | 1512 | { |
1513 | spi_writel(as, CR, SPI_BIT(SWRST)); | 1513 | spi_writel(as, CR, SPI_BIT(SWRST)); |
1514 | spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ | 1514 | 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 | |||
1515 | if (as->caps.has_wdrbt) { | 1520 | if (as->caps.has_wdrbt) { |
1516 | spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS) | 1521 | spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS) |
1517 | | SPI_BIT(MSTR)); | 1522 | | SPI_BIT(MSTR)); |
@@ -1522,9 +1527,6 @@ static void atmel_spi_init(struct atmel_spi *as) | |||
1522 | if (as->use_pdc) | 1527 | if (as->use_pdc) |
1523 | spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); | 1528 | spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); |
1524 | spi_writel(as, CR, SPI_BIT(SPIEN)); | 1529 | spi_writel(as, CR, SPI_BIT(SPIEN)); |
1525 | |||
1526 | if (as->fifo_size) | ||
1527 | spi_writel(as, CR, SPI_BIT(FIFOEN)); | ||
1528 | } | 1530 | } |
1529 | 1531 | ||
1530 | static int atmel_spi_probe(struct platform_device *pdev) | 1532 | static int atmel_spi_probe(struct platform_device *pdev) |