Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
Cc: linux-spi <linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-rpi-kernel
	<linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: spi: bcm2835: can_dma and scatter/gather question
Date: Thu, 30 Apr 2015 20:26:26 +0100	[thread overview]
Message-ID: <20150430192626.GC22845@sirena.org.uk> (raw)
In-Reply-To: <55420558.6030008-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1772 bytes --]

On Thu, Apr 30, 2015 at 12:35:04PM +0200, Martin Sperl wrote:

> The question is: can the spi-framework fullfill those requirements
> as well? Otherwise there would be the need to add an additional
> translation step inside the driver to translate those...

You can see the code for yourself...  we're mostly not doing anything in
the SPI code, we just throw a list of pages into a scatterlist but the
actual mapping is done by the DMA mapping code which is free to do
things like coalesce adjacent blocks.  If the hardware genuinely
requires that the Tx and Rx scatterlists have entries of exactly the
same length I'm not sure that's going to be reliably satisfied if memory
gets fragmented.

> Maybe we need to make the use of the mapping code configurable
> as well, or should such "custom" things go into prepare_message instead
> without implementing can_dma?

It sounds like the driver should just not DMA anything that isn't page
aligned and 32 bit multiple, or special case the first non-aligned bits.
I'd expect anything doing large DMAs to be trying to make them page
aligned anyway.  A facility to provide an interface for cutting off the
start and end of transfers for separate handling as PIO seems like a
reasonable idea but I'm not immediately seeing a straightforward way to
implement it, it seems like it might require most of the infrastructure
we'd need in order to coalesce adjacent transfers in a message (which
would be really nice to have).

> One more thing: is there a helper to create a sg_table for
> spi_message.is_dma_mapped==1?

is_dma_mapped is legacy and should be going away rather than used in new
code since just providing a single physical address really isn't enough,
if we need something in future it'll be done with the scatterlist.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2015-04-30 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 10:35 spi: bcm2835: can_dma and scatter/gather question Martin Sperl
     [not found] ` <55420558.6030008-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-04-30 19:26   ` Mark Brown [this message]

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=20150430192626.GC22845@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org \
    --cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@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