linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trent Piepho <tpiepho@impinj.com>
To: "geert+renesas@glider.be" <geert+renesas@glider.be>,
	"srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"arnd@arndb.de" <arnd@arndb.de>
Cc: "linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mtd@vger.kernel.org" <linux-mtd@vger.kernel.org>
Subject: Re: [PATCH 3/3] eeprom: at25: Split writes in two SPI transfers to optimize DMA
Date: Wed, 10 Oct 2018 21:47:44 +0000	[thread overview]
Message-ID: <1539208063.1944.12.camel@impinj.com> (raw)
In-Reply-To: <20181010134036.8296-4-geert+renesas@glider.be>

On Wed, 2018-10-10 at 15:40 +0200, Geert Uytterhoeven wrote:
> Currently EEPROM writes are implemented using a single SPI transfer,
> which contains all of command, address, and payload data bytes.
> As some SPI controllers impose limitations on transfers with respect to
> the use of DMA, they may have to fall back to PIO. E.g. DMA may require
> the transfer length to be a multiple of 4 bytes.
> 
> Optimize writes for DMA by splitting writes in two SPI transfers:
>   - The first transfer contains command and address bytes,
>   - The second transfer contains the actual payload data, now stored at
>     the start of the (kmalloc() aligned) buffer, to improve payload
>     alignment.

Does this always optimize?  A master capable of an of aligned 18 byte
DMA xfer would now have a 2 byte xfer that would probably be PIO
followed by a 16 byte DMA.

Or writing 14 bytes to the EEPROM has changed from an aligned 16 byte
write to a 2 byte and a 14 byte, which is now worse for the 4 byte
multiple requirement master which can use any DMA anymore.

It seems like an enhancement to the DMA code to look more like a
efficient memcpy() that aligns the address, then xfers efficient
blocks, then finishes the sub-block tail would be more generally
applicable.

Or more simply, given an aligned 18 byte xfer, the driver should do an
aligned 16 byte DMA and then two more bytes.

  reply	other threads:[~2018-10-10 21:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 13:40 [PATCH 0/3] eeprom: at25: SPI transfer improvements Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 1/3] eeprom: at25: Drop obsolete cast in at25_ee_write() Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding Geert Uytterhoeven
2018-10-10 13:40 ` [PATCH 3/3] eeprom: at25: Split writes in two SPI transfers to optimize DMA Geert Uytterhoeven
2018-10-10 21:47   ` Trent Piepho [this message]
2018-10-11  6:59     ` Geert Uytterhoeven
2018-10-10 13:43 ` [PATCH 0/3] eeprom: at25: SPI transfer improvements Geert Uytterhoeven
2018-10-10 13:43   ` [PATCH 1/3] eeprom: at25: Drop obsolete cast in at25_ee_write() Geert Uytterhoeven
2018-10-10 14:01     ` Arnd Bergmann
2018-10-10 14:42       ` Geert Uytterhoeven
2018-10-10 13:43   ` [PATCH 2/3] eeprom: at25: Use spi_message_init_with_transfers() instead of open coding Geert Uytterhoeven
2018-10-10 14:02     ` Arnd Bergmann
2018-10-10 13:43   ` [PATCH 3/3] eeprom: at25: Split writes in two SPI transfers to optimize DMA Geert Uytterhoeven
2018-10-10 14:03     ` Arnd Bergmann

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=1539208063.1944.12.camel@impinj.com \
    --to=tpiepho@impinj.com \
    --cc=arnd@arndb.de \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.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;
as well as URLs for NNTP newsgroup(s).