Linux SPI subsystem development
 help / color / mirror / Atom feed
From: "Noralf Trønnes" <noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
To: kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Lee Jones <lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] spi: bcm2835: enable dma modes for transfers meeting certain conditions
Date: Mon, 11 May 2015 18:30:32 +0200	[thread overview]
Message-ID: <5550D928.6020708@tronnes.org> (raw)
In-Reply-To: <1431290849-11151-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>


Den 10.05.2015 22:47, skrev kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org:
> From: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
>
> Conditions per spi_transfer are:
> * transfer.len >= 96 bytes (to avoid mapping overhead costs)
> * transfer.len < 65536 bytes (limitaion by spi-hw block - could get extended)
> * an individual scatter/gather transfer length must be a multiple of 4
>    for anything but the last transfer - spi-hw block limit.
>    (some shortcut has been taken in can_dma to avoid unnecessary mapping of
>     pages which, for which there is a chance that there is a split with a
>     transfer length not a multiple of 4)
>
> If it becomes a necessity these restrictions can get removed by additional
> code.
>
> Note that this patch requires a patch to dma-bcm2835.c by Noralf to
> enable scatter-gather mode inside the dmaengine, which has not been
> merged yet.
>
> That is why no patch to arch/arm/boot/dts/bcm2835.dtsi is included - the
> code works as before without dma when tx/rx are not set, but it writes
> a message warning about dma not used:
> spi-bcm2835 20204000.spi: no tx-dma configuration found - not using dma mode
>
> To enable dma-mode add the following lines to the device-tree:
>          dmas = <&dma 6>, <&dma 7>;
>          dma-names = "tx", "rx";
>
> Tested-by: Noralf Trønnes <noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
> (private communication)
>
> Signed-off-by: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
> ---
>   drivers/spi/spi-bcm2835.c |  303 ++++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 301 insertions(+), 2 deletions(-)
>
> Tested with:
> * 2x mcp251x
> * 1x enc28j60
> * 1x fb_st7735r
>
> Note that to make it work it requires the patch to dma-engine by
> Noralf Tronnes for scatter/gather DMA.
>
> Also it is recommended that the patch for the race-condition in
> spi_finalize_current_message is applied to avoid a free before unmap
> situations (this only happens only in some configurations)

A couple of throughput tests using the fbtft drivers:

I set up 2 SPI display devices running a movie on both framebuffers.
Since I don't have an easy way to hook up 2 displays, the test was run
without anything connected. Throughput was measured to ~2.5MB/s on one
device and ~3.0MB/s on the other in bursts of ~50ms with ~10ms delay
between frames. 'top' shows cpu util of ~25% for each mplayer process
and ~10% for system (30-35% idle).

Log details:
[    2.833071] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB 
video memory, 16 KiB DMA buffer memory, fps=50, spi32766.0 at 48 MHz
[    3.036245] graphics fb2: fb_ili9341 frame buffer, 320x240, 150 KiB 
video memory, 16 KiB DMA buffer memory, fps=50, spi32766.1 at 48 MHz

[   76.863674] fb_ili9341 spi32766.0: Display update: 2576 kB/s (58.217 
ms), fps=14 (69.997 ms)
[   76.894161] fb_ili9341 spi32766.1: Display update: 3077 kB/s (48.735 
ms), fps=16 (59.431 ms)


Only 1 display connected (35ms burst, 15ms delay):
[    2.826042] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB 
video memory, 16 KiB DMA buffer memory, fps=50, spi32766.0 at 48 MHz

[   51.000128] fb_ili9341 spi32766.0: Display update: 4429 kB/s (33.856 
ms), fps=20 (49.968 ms)

--
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

  parent reply	other threads:[~2015-05-11 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-10 20:47 [PATCH] spi: bcm2835: enable dma modes for transfers meeting certain conditions kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found] ` <1431290849-11151-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-05-11 16:30   ` Noralf Trønnes [this message]
2015-05-11 18:24   ` Mark Brown
     [not found]     ` <20150511182448.GW3458-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-05-11 19:38       ` Martin Sperl
     [not found]         ` <F47F6B62-3DC6-47C9-AD72-BE7DDABD3AE6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-05-12  2:45           ` Stephen Warren
     [not found]             ` <55516950.5070105-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2015-05-12 10:32               ` [PATCH] spi: bcm2835: fix kbuild compile warnings/errors and a typo kernel-TqfNSX0MhmxHKSADF0wUEw
     [not found]                 ` <1431426729-2154-1-git-send-email-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-05-12 10:42                   ` 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=5550D928.6020708@tronnes.org \
    --to=noralf-l59+z2yzlopafugrpc6u6w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org \
    --cc=lee-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox