From: NeilBrown <neil@brown.name>
To: Boris Brezillon <boris.brezillon@bootlin.com>,
Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
Cc: linux-mtd@lists.infradead.org,
boris.brezillon@free-electrons.com, frieder.schrempf@exceet.de,
computersforpeace@gmail.com, david.wolfe@nxp.com, han.xu@nxp.com,
festevam@gmail.com, marek.vasut@gmail.com,
prabhakar.kushwaha@nxp.com, linux-spi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: spi-nor: honour max_data_size for spi-nor writes
Date: Tue, 12 Jun 2018 08:05:13 +1000 [thread overview]
Message-ID: <87r2ldj7xi.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20180611114916.351ed272@bbrezillon>
[-- Attachment #1: Type: text/plain, Size: 1796 bytes --]
On Mon, Jun 11 2018, Boris Brezillon wrote:
>
> Also, I'd prefer to have this patch split in 2:
> 1/ one patch removing the check in spi_nor_write()
> 2/ and the second patch removing the while() loop in m25p80_write()
>
> How about the following commit messages for those 2 patches:
>
> 1:
> "
> mtd: spi-nor: Support controllers with limited TX FIFO size
>
> Some SPI controllers can't write nor->page_size bytes in a single step
> because their TX FIFO is too small.
I no longer think this is good justification for changes to m25p80 or to
anything outside the low-level SPI driver. The size of the FIFO is not
related to the maximum message size.
An SPI transaction involves:
- asserting chip-select
- sending/receiving a bunch of bits
- deasserting chip-select
That middle part of sending/receiving bits can be done:
- one bit at a time by bit-banging GPIOs
- 32 bytes at a time by filling a buffer, running the SPI engine, then
reading results out of the buffer (assuming a 32-byte buffer)
- with one single DMA operation if the SPI engine can DMA to/from
main memory
and there are probably other options.
If your SPI engine only handles (say) 32 bytes at a time, then call it
repeatedly, while holding chip-select asserted the whole time. The SPI
clock is controlled by the host and in this case it will not have a
stable frequency for the whole transaction (occasionally pauses), but
that doesn't matter. The slave just watches for the clock transitions
and don't care when they come as long as they don't come too fast.
I recently modified the mt7621 spi driver (in drivers/staging) to work
like this and got much better throughput when reading from spi-nor flash
memory. It handles writes of full pages (36 bytes at at time!) without
problems.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2018-06-11 22:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 9:18 [PATCH] mtd: spi-nor: honour max_data_size for spi-nor writes Yogesh Gaur
2018-06-11 9:49 ` Boris Brezillon
2018-06-11 22:05 ` NeilBrown [this message]
2018-06-12 7:22 ` Boris Brezillon
2018-06-12 22:24 ` NeilBrown
2018-06-12 22:35 ` Boris Brezillon
2018-06-13 6:14 ` Yogesh Narayan Gaur
-- strict thread matches above, loose matches on Subject: below --
2018-06-11 9:32 Yogesh Gaur
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=87r2ldj7xi.fsf@notabene.neil.brown.name \
--to=neil@brown.name \
--cc=boris.brezillon@bootlin.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=david.wolfe@nxp.com \
--cc=festevam@gmail.com \
--cc=frieder.schrempf@exceet.de \
--cc=han.xu@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=prabhakar.kushwaha@nxp.com \
--cc=yogeshnarayan.gaur@nxp.com \
/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).