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
next prev parent reply other threads:[~2017-02-10 19:07 UTC|newest]
Thread overview: 21+ 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 ` [PATCH 1/8] spi: davinci: Use SPI framework to handle DMA mapping Frode Isaksen
2017-02-13 11:30 ` Mark Brown
2017-02-10 15:29 ` [PATCH 2/8] spi: davinci: enable DMA when channels are defined in DT Frode Isaksen
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 19:07 ` Kevin Hilman [this message]
2017-02-13 5:59 ` Sekhar Nori
2017-02-14 11:27 ` Frode Isaksen
2017-02-14 15:29 ` Sekhar Nori
2017-02-14 16:40 ` Frode Isaksen
2017-03-21 22:02 ` Peter Ujfalusi
2017-03-22 11:11 ` Frode Isaksen
2017-03-22 11:35 ` Sekhar Nori
2017-03-22 12:20 ` Peter Ujfalusi
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 ` [PATCH 5/8] spi: davinci: do not use DMA if transfer length is less than 16 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 ` [PATCH 7/8] spi: loopback-test: add option to use vmalloc'ed buffers Frode Isaksen
2017-02-10 15:29 ` [PATCH 8/8] spi: loopback-test: limit length to spi_max_transfer_size() 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@baylibre$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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