linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 00/18] mtd: spi-nor: Proposal for 8-8-8 mode support
@ 2018-10-12  8:48 Boris Brezillon
  2018-10-12  8:48 ` [PATCH RFC 01/18] mtd: spi-nor: Add a flash_info entry for Macronix mx25uw51245g Boris Brezillon
                   ` (18 more replies)
  0 siblings, 19 replies; 27+ messages in thread
From: Boris Brezillon @ 2018-10-12  8:48 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, linux-mtd, Yogesh Gaur, Vignesh R,
	Cyrille Pitchen
  Cc: Julien Su, Mark Brown, Mason Yang, linux-spi, zhengxunli

Hello,

The trend has been around octo (or octal) SPI NOR lately, and both
Yogesh and Vignesh proposed patches to support 1-1-8 and 1-8-8 modes
on Micron SPI NORs (plus the associated patches to support that on the
Cadence and FlesSPI controllers). I'll probably take their patches in
4.20 since adding support for stateless octo modes is not invasive, but
I wanted to start a discussion on how we should support stateful modes
(X-X-X and XD-XD-XD, where X is the bus width and D means Double
Transfer Rate).

First question that might come to mind is why should we support such
stateful modes? If you think about it, the gain of transmitting the
opcode on 8 IO lines is rather small compared to the pain it is to
teach the SPI NOR framework how to deal with that. The problem is,
some SPI NOR manufacturers (Macronix for instance) only implement 1-1-1
and 8-8-8 (or 8D-8D-8D), and they want to be able to use their NORs in
8-8-8 mode when the controller supports it.

So, this patchset is aiming at starting a wider discussion on how you
think those modes should be supported. This is just a proposal, and I'm
of course open to other suggestions, as long as the answer is not as
definitive as "too bad for them, they should have supported 1-8-8 or
1-1-8 modes".

Just a few more details about the patches in this series. Some of them
are clearly conflicting with patches posted by Yogesh and Vignesh.
Don't worry guys, I'm still planning to take yours before, it's just
that I was too lazy to rebase on top of your modifications. Also, some
patches might not pass checkpatch or might trigger kbuild errors, but
before fixing those problems, I'd like to get your opinion on the
general approach.

It's also worth mentioning that I focused on spi-mem support only,
because on the long run, I want all SPI NOR controller drivers
converted to this interface, and if I can limit support of octo modes
to those implementing the spi-mem interface, that's an incentive to
push developers to do the conversion. This part is still open to
discussion though.

Also, in this patchset, I merge the m25p80 driver code in spi-nor.c,
which is something I wanted to do for quite some. Indeed, the m25p80 is
just a simple SPI NOR controller driver (a wrapper around the SPI mem
API). Not only it shouldn't be named after a specific SPI NOR chip, but
it also doesn't deserve a specific driver IMO, especially if the end
goal is to get rid of SPI NOR controller drivers found in
drivers/mtd/spi-nor/ and replace them by SPI mem drivers (which would
be placed in drivers/spi/). With this solution, we declare the SPI NOR
driver as a spi_mem_driver, just like the SPI NAND layer is declared as
a spi_mem driver. This solution also allows us to check at a
fined-grain level (thanks to the spi_mem_supports_op() function) which
operations are supported and which ones are not, while the original
m25p80 logic was basing this decision on the
SPI_{RX,TX}_{DUAL,QUAD,OCTO} flags only.

The last set of patches in the series are modifying the framework to
allow entering X-X-X modes in a chip-specific way, and then adds
support for 8-8-8 and 8D-8D-8D modes on a Macronix chip (mx25uw51245g).

Yogesh, Vignesh, Tudor (and maybe Cyrille and Marek if you have some
time), please have a look at this patch series and tell me what you
think.

Regards,

Boris

Boris Brezillon (18):
  mtd: spi-nor: Add a flash_info entry for Macronix mx25uw51245g
  spi: Prepare things for octo mode support
  spi: spi-mem: Prepare things for DTR mode support
  spi: spi-mem: Prepare things for dual bytes opcodes support
  spi: spi-mem: mxic: Add support for DTR and Octo mode
  mtd: spi-nor: Move m25p80 code in spi-nor.c
  mtd: spi-nor: Rework hwcaps selection for the spi-mem case
  mtd: spi-nor: Define the DPI, QPI and OPI hwcaps
  mtd: spi-nor: Add spi_nor_{read,write}_reg() helpers
  mtd: spi-nor: Add support for X-X-X modes
  mtd: spi-nor: Prepare things for 2byte opcodes
  mtd: spi-nor: Provide a hook to tweak flash parameters
  mtd: spi-nor: Add 8-8-8 mode support to Macronix mx25uw51245g
  mtd: spi-nor: Clarify where DTR mode applies
  mtd: spi-nor: Add DTR support to the spi-mem logic
  mtd: spi-nor: Add the concept of full DTR modes
  mtd: spi-nor: Add 8D-8D-8D mode
  mtd: spi-nor: Make sure the 8D-8D-8D can be selected on mx25uw51245g

 drivers/mtd/devices/Kconfig         |   18 -
 drivers/mtd/devices/Makefile        |    1 -
 drivers/mtd/devices/m25p80.c        |  324 ---------
 drivers/mtd/spi-nor/Kconfig         |    3 +-
 drivers/mtd/spi-nor/atmel-quadspi.c |    5 +-
 drivers/mtd/spi-nor/spi-nor.c       | 1331 +++++++++++++++++++++++++++++++----
 drivers/spi/spi-mem.c               |   15 +-
 drivers/spi/spi-mxic.c              |   27 +-
 drivers/spi/spi.c                   |   12 +-
 include/linux/mtd/spi-nor.h         |  168 ++++-
 include/linux/spi/spi-mem.h         |   69 +-
 include/linux/spi/spi.h             |    2 +
 12 files changed, 1424 insertions(+), 551 deletions(-)
 delete mode 100644 drivers/mtd/devices/m25p80.c

-- 
2.14.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2019-01-14  8:39 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-12  8:48 [PATCH RFC 00/18] mtd: spi-nor: Proposal for 8-8-8 mode support Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 01/18] mtd: spi-nor: Add a flash_info entry for Macronix mx25uw51245g Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 02/18] spi: Prepare things for octo mode support Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 03/18] spi: spi-mem: Prepare things for DTR " Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 04/18] spi: spi-mem: Prepare things for dual bytes opcodes support Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 05/18] spi: spi-mem: mxic: Add support for DTR and Octo mode Boris Brezillon
2018-11-18 17:21   ` Miquel Raynal
2018-11-18 17:32     ` Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 06/18] mtd: spi-nor: Move m25p80 code in spi-nor.c Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 07/18] mtd: spi-nor: Rework hwcaps selection for the spi-mem case Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 08/18] mtd: spi-nor: Define the DPI, QPI and OPI hwcaps Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 09/18] mtd: spi-nor: Add spi_nor_{read, write}_reg() helpers Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 10/18] mtd: spi-nor: Add support for X-X-X modes Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 11/18] mtd: spi-nor: Prepare things for 2byte opcodes Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 12/18] mtd: spi-nor: Provide a hook to tweak flash parameters Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 13/18] mtd: spi-nor: Add 8-8-8 mode support to Macronix mx25uw51245g Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 14/18] mtd: spi-nor: Clarify where DTR mode applies Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 15/18] mtd: spi-nor: Add DTR support to the spi-mem logic Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 16/18] mtd: spi-nor: Add the concept of full DTR modes Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 17/18] mtd: spi-nor: Add 8D-8D-8D mode Boris Brezillon
2018-10-12  8:48 ` [PATCH RFC 18/18] mtd: spi-nor: Make sure the 8D-8D-8D can be selected on mx25uw51245g Boris Brezillon
     [not found]   ` <OF300145A1.D60E7B33-ON48258376.002EDC4B-48258376.0031A14C@LocalDomain>
     [not found]     ` <OF3005248A.454B9B59-ON48258382.002767AE-48258382.00293E8D@mxic.com.tw>
2019-01-14  8:39       ` Boris Brezillon
2018-10-19 12:25 ` [PATCH RFC 00/18] mtd: spi-nor: Proposal for 8-8-8 mode support Mark Brown
2018-10-19 12:59   ` Boris Brezillon
2018-10-21 13:36     ` Mark Brown
2018-10-22  8:21       ` Boris Brezillon
2018-10-22 12:01         ` Mark Brown

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