Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@microchip.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] spi: atmel: init FIFOs before spi enable
Date: Tue, 27 Feb 2018 11:29:33 +0100	[thread overview]
Message-ID: <9650154b-c0b4-48aa-1c98-8d86aa834202@microchip.com> (raw)
In-Reply-To: <1519727107-5821-1-git-send-email-eugen.hristev@microchip.com>

On 27/02/2018 at 11:25, Eugen Hristev wrote:
> 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>

Ok, good:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/spi/spi-atmel.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
> index 6694709..0478758 100644
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1489,6 +1489,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));
> @@ -1499,9 +1504,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)
> 


-- 
Nicolas Ferre

  reply	other threads:[~2018-02-27 10:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 10:25 [PATCH] spi: atmel: init FIFOs before spi enable Eugen Hristev
2018-02-27 10:29 ` Nicolas Ferre [this message]
2018-02-28 11:06 ` Applied "spi: atmel: init FIFOs before spi enable" to the spi tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9650154b-c0b4-48aa-1c98-8d86aa834202@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox