All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
To: Frode Isaksen <fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
Cc: nsekhar-l0cyMroinI0@public.gmane.org,
	ptitiano-rdvid1DuHRBWk0Htik3J/w@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 3/8] spi: davinci: limit the transfer size if DMA enabled
Date: Fri, 10 Feb 2017 11:07:46 -0800	[thread overview]
Message-ID: <m2tw81hnjx.fsf@baylibre.com> (raw)
In-Reply-To: <1486740584-17875-4-git-send-email-fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org> (Frode Isaksen's message of "Fri, 10 Feb 2017 16:29:39 +0100")

Frode Isaksen <fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org> writes:

> Limit the transfer size to 20 scatter/gather pages if
> DMA is enabled.
> The eDMA DMA engine is limited to 20 SG entries in one DMA
> transaction. If this number is exceeded, DMA receive fails.
> This error occurs with large vmalloc'ed buffers.
>
> Signed-off-by: Frode Isaksen <fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/spi/spi-davinci.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index b7b2da1..f1b46f6 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -485,6 +485,16 @@ static bool davinci_spi_can_dma(struct spi_master *master,
>  	return __davinci_spi_can_dma(spi);
>  }
>  
> +static size_t davinci_spi_max_transfer_size(struct spi_device *spi)
> +{
> +	/*
> +	 * The eDMA DMA engine is limited to 20 SG entries in one DMA
> +	 * transaction. If this number is exceeded, DMA receive fails.
> +	 * An extra SG entry is needed when the buffer is not page aligned.
> +	 */
> +	return (__davinci_spi_can_dma(spi)) ? 19 * PAGE_SIZE : SIZE_MAX;

The number here should be a #define.

Also, comment says 20, code says 19.  This should be clarified.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: khilman@baylibre.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/8] spi: davinci: limit the transfer size if DMA enabled
Date: Fri, 10 Feb 2017 11:07:46 -0800	[thread overview]
Message-ID: <m2tw81hnjx.fsf@baylibre.com> (raw)
In-Reply-To: <1486740584-17875-4-git-send-email-fisaksen@baylibre.com> (Frode Isaksen's message of "Fri, 10 Feb 2017 16:29:39 +0100")

Frode Isaksen <fisaksen@baylibre.com> writes:

> Limit the transfer size to 20 scatter/gather pages if
> DMA is enabled.
> The eDMA DMA engine is limited to 20 SG entries in one DMA
> transaction. If this number is exceeded, DMA receive fails.
> This error occurs with large vmalloc'ed buffers.
>
> Signed-off-by: Frode Isaksen <fisaksen@baylibre.com>
> ---
>  drivers/spi/spi-davinci.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
> index b7b2da1..f1b46f6 100644
> --- a/drivers/spi/spi-davinci.c
> +++ b/drivers/spi/spi-davinci.c
> @@ -485,6 +485,16 @@ static bool davinci_spi_can_dma(struct spi_master *master,
>  	return __davinci_spi_can_dma(spi);
>  }
>  
> +static size_t davinci_spi_max_transfer_size(struct spi_device *spi)
> +{
> +	/*
> +	 * The eDMA DMA engine is limited to 20 SG entries in one DMA
> +	 * transaction. If this number is exceeded, DMA receive fails.
> +	 * An extra SG entry is needed when the buffer is not page aligned.
> +	 */
> +	return (__davinci_spi_can_dma(spi)) ? 19 * PAGE_SIZE : SIZE_MAX;

The number here should be a #define.

Also, comment says 20, code says 19.  This should be clarified.

Kevin

  parent reply	other threads:[~2017-02-10 19:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10 15:29 Enable DMA for daVinci SPI controller Frode Isaksen
2017-02-10 15:29 ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 1/8] spi: davinci: Use SPI framework to handle DMA mapping Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
     [not found]   ` <1486740584-17875-2-git-send-email-fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-02-13 11:30     ` Mark Brown
2017-02-13 11:30       ` Mark Brown
     [not found] ` <1486740584-17875-1-git-send-email-fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-02-10 15:29   ` [PATCH 2/8] spi: davinci: enable DMA when channels are defined in DT Frode Isaksen
2017-02-10 15:29     ` Frode Isaksen
     [not found]     ` <1486740584-17875-3-git-send-email-fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-02-13 11:32       ` Mark Brown
2017-02-13 11:32         ` Mark Brown
2017-02-10 15:29 ` [PATCH 3/8] spi: davinci: limit the transfer size if DMA enabled Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
     [not found]   ` <1486740584-17875-4-git-send-email-fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
2017-02-10 19:07     ` Kevin Hilman [this message]
2017-02-10 19:07       ` Kevin Hilman
2017-02-13  5:59     ` Sekhar Nori
2017-02-13  5:59       ` Sekhar Nori
2017-02-14 11:27       ` Frode Isaksen
2017-02-14 11:27         ` Frode Isaksen
2017-02-14 15:29         ` Sekhar Nori
2017-02-14 15:29           ` Sekhar Nori
     [not found]           ` <c0d6c236-1302-e910-8c41-cd82e0fac39b-l0cyMroinI0@public.gmane.org>
2017-02-14 16:40             ` Frode Isaksen
2017-02-14 16:40               ` Frode Isaksen
2017-03-21 22:02       ` Peter Ujfalusi
2017-03-21 22:02         ` Peter Ujfalusi
     [not found]         ` <b4d8bd90-cd33-560f-5102-20c2375dac70-l0cyMroinI0@public.gmane.org>
2017-03-22 11:11           ` Frode Isaksen
2017-03-22 11:11             ` Frode Isaksen
2017-03-22 11:35             ` Sekhar Nori
2017-03-22 11:35               ` Sekhar Nori
     [not found]               ` <95c7bc96-2de9-043d-880e-4de9f0b2308a-l0cyMroinI0@public.gmane.org>
2017-03-22 12:20                 ` Peter Ujfalusi
2017-03-22 12:20                   ` Peter Ujfalusi
     [not found]                   ` <c85c9e88-c40b-88b3-f47d-6d5f5cc1fa00-l0cyMroinI0@public.gmane.org>
2017-03-22 13:30                     ` Frode Isaksen
2017-03-22 13:30                       ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 4/8] spi: davinci: flush caches when performing DMA Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 5/8] spi: davinci: do not use DMA if transfer length is less than 16 Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 6/8] spi: loopback-test: set HW loopback mode if loopback set Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 7/8] spi: loopback-test: add option to use vmalloc'ed buffers Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen
2017-02-10 15:29 ` [PATCH 8/8] spi: loopback-test: limit length to spi_max_transfer_size() Frode Isaksen
2017-02-10 15:29   ` Frode Isaksen

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=m2tw81hnjx.fsf@baylibre.com \
    --to=khilman-rdvid1duhrbwk0htik3j/w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=fisaksen-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=ptitiano-rdvid1DuHRBWk0Htik3J/w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.