From: Stefan Roese <sr-ynQEQJNshbs@public.gmane.org>
To: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Cc: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Nadav Haklai <nadavh-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Gregory CLEMENT
<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Ezequiel Garcia
<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Subject: Re: [PATCH v2] spi: orion.c: Add direct access mode
Date: Thu, 24 Mar 2016 06:45:35 +0100 [thread overview]
Message-ID: <56F37EFF.2090605@denx.de> (raw)
In-Reply-To: <20160323183952.GK5250-g2DYL2Zd6BY@public.gmane.org>
On 23.03.2016 19:39, Andrew Lunn wrote:
>> Please note that this direct access mode is really not suitable
>> for "normal" SPI devices like SPI NOR chips. As the direct read
>> mode (as described in chapter 22.5.1 of the Armada XP datasheet)
>> always generates:
>>
>> a) a write command to the SPI bus (opcode configurable via register)
>>
>> and
>>
>> b) writes 1-4 address bytes to the SPI bus
>>
>> before the data is read from the SPI bus.
>>
>> So its definitely nothing that should be enabled per default for
>> all SPI devices.
>
> Looking at the Kirkwood datasheet, it suggests it can be used with SPI
> flash:
>
> If using SPI flash, set the <Attr> field in the CPU address
> decoding windows to match the SPI interface (see Section 2,
> Address Map, on page 34 for more details). Any CPU read to
> this address space is converted by the SPI controller to a SPI
> flash read transaction, composed of an address phase, followed
> by a data phase.
>
> The actual sequence that is driven on the SPI interface is:
>
> 1. Assert SPI_CSn. Write command to the SPI. The command is
> either Read or Fast_Read, based on the configuration of the
> <DirectRdCommand> field.
>
> 2. Write the address. The Address is driven in 1 to 4 phases
> based on the configuration of the <DirectAddrLen>> field. The order of
> the bytes is MSB to LSB.
>
> 3. In Fast_Read mode, add a one-byte dummy write.
>
> 4. Read the data, according to the length given by the request.
>
> 5. De-assert the SPI_CSn signal.
Right. It is of course possible to use this direct mode to access
SPI flash. Its just not the way how the SPI MTD driver uses the
SPI controller. All information that is written to the SPI flash
(e.g. commands, addresses) are passed as plain tx-data in the SPI
message to the SPI controller. And it would be not easy to detect
commands / addresses vs. "real data" in this orion SPI driver
to put these values into the specific registers.
> There is also something interesting in the Direct Write to SPI
> section:
>
> 4. Address Phase.
>
> This is a 1-4 byte field that is taken from the address of the
> request. The size of the address is configured via the
> <DirectAddrLen> field in the Serial Memory Interface
> Configuration Register (Table 629 p. 686). The entire Address
> phase is omitted when <Direct Wr Addr Enable> field in the
> Serial Memory Direct Write Configuration Register (Table 634
> p. 688) is cleared.
>
> Turning off the address phase may mean it is possible to do normal SPI
> writes using the direct mode.
Correct. And this is exactly why I'm using this direct write mode
for the FPGAs connected via SPI. To implement normal, optimized SPI
writes using this direct write mode.
> Quite a few Kirkwood boards have SPI flash, so if this brings better
> performance, it would be nice to be able to use it.
Yes. But I hope my explanation above makes it clear that this is not
easily implemented. So I suggest to just use the implementation I've
added with this patch for these special SPI devices like FPGAs
for fast bitstream downloading. And for this it is necessary, to make
this direct access mode optionally configurable on a per-SPI-device
basis.
Thanks,
Stefan
--
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
next prev parent reply other threads:[~2016-03-24 5:45 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 16:24 [PATCH v2] spi: orion.c: Add direct access mode Stefan Roese
[not found] ` <1458663893-13766-1-git-send-email-sr-ynQEQJNshbs@public.gmane.org>
2016-03-22 16:35 ` Thomas Petazzoni
2016-03-22 16:44 ` Stefan Roese
[not found] ` <56F17684.2010307-ynQEQJNshbs@public.gmane.org>
2016-03-23 11:33 ` Mark Brown
[not found] ` <20160323113316.GH2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-23 11:59 ` Stefan Roese
[not found] ` <56F2852C.5010006-ynQEQJNshbs@public.gmane.org>
2016-03-23 12:54 ` Mark Brown
[not found] ` <20160323125448.GM2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-23 13:10 ` Stefan Roese
[not found] ` <56F295E1.4030505-ynQEQJNshbs@public.gmane.org>
2016-03-23 13:26 ` Andrew Lunn
[not found] ` <20160323132637.GC19953-g2DYL2Zd6BY@public.gmane.org>
2016-03-23 13:36 ` Mark Brown
[not found] ` <20160323133612.GO2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-23 13:56 ` Andrew Lunn
[not found] ` <20160323135606.GE19953-g2DYL2Zd6BY@public.gmane.org>
2016-03-23 19:51 ` Arnd Bergmann
2016-03-24 7:22 ` Stefan Roese
[not found] ` <56F395BC.6070108-ynQEQJNshbs@public.gmane.org>
2016-03-24 12:42 ` Arnd Bergmann
2016-03-24 16:15 ` Stefan Roese
[not found] ` <56F412B5.2080200-ynQEQJNshbs@public.gmane.org>
2016-03-24 16:42 ` Arnd Bergmann
2016-03-24 17:30 ` Stefan Roese
2016-03-24 16:48 ` Arnd Bergmann
2016-03-24 17:51 ` Stefan Roese
[not found] ` <56F42939.4020803-ynQEQJNshbs@public.gmane.org>
2016-03-24 20:07 ` Arnd Bergmann
2016-03-25 10:32 ` Mark Brown
[not found] ` <20160325103253.GA2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-25 15:11 ` Arnd Bergmann
2016-03-25 15:50 ` Mark Brown
[not found] ` <20160325155032.GH2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-25 20:58 ` Arnd Bergmann
2016-03-25 22:39 ` Mark Brown
[not found] ` <20160325223922.GG5028-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-29 12:39 ` Arnd Bergmann
2016-03-29 16:47 ` Mark Brown
[not found] ` <20160329164758.GQ2350-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-29 19:49 ` Arnd Bergmann
2016-03-29 19:52 ` Mark Brown
2016-03-29 20:04 ` Arnd Bergmann
2016-03-29 21:00 ` Mark Brown
[not found] ` <20160329210018.GL2350-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-29 21:08 ` Arnd Bergmann
2016-03-29 21:28 ` Mark Brown
[not found] ` <20160329212842.GN2350-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-29 22:04 ` Arnd Bergmann
2016-04-05 7:11 ` Stefan Roese
[not found] ` <5703651F.4040901-ynQEQJNshbs@public.gmane.org>
2016-04-05 13:15 ` Andrew Lunn
[not found] ` <20160405131529.GA30881-g2DYL2Zd6BY@public.gmane.org>
2016-04-05 13:20 ` Stefan Roese
[not found] ` <5703BB82.4090204-ynQEQJNshbs@public.gmane.org>
2016-04-05 13:31 ` Andrew Lunn
2016-03-23 13:27 ` Mark Brown
[not found] ` <20160323132732.GN2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-23 17:25 ` Stefan Roese
[not found] ` <56F2D19A.7020604-ynQEQJNshbs@public.gmane.org>
2016-03-23 18:29 ` Mark Brown
2016-03-23 18:39 ` Andrew Lunn
[not found] ` <20160323183952.GK5250-g2DYL2Zd6BY@public.gmane.org>
2016-03-24 5:45 ` Stefan Roese [this message]
2016-03-24 11:23 ` Mark Brown
[not found] ` <20160324112308.GY2566-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-03-24 12:05 ` Stefan Roese
[not found] ` <20160322173546.40d24cc2-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-03-22 17:39 ` 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=56F37EFF.2090605@denx.de \
--to=sr-ynqeqjnshbs@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nadavh-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@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;
as well as URLs for NNTP newsgroup(s).