linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: nand: Add Cadence NAND controller driver
@ 2019-01-29 16:03 Piotr Sroka
  2019-01-29 16:07 ` [PATCH 1/2] " Piotr Sroka
  2019-01-29 16:10 ` [PATCH 2/2] dt-bindings: " Piotr Sroka
  0 siblings, 2 replies; 7+ messages in thread
From: Piotr Sroka @ 2019-01-29 16:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arnd Bergmann, Boris Brezillon, Marcel Ziswiler,
	Richard Weinberger, Stefan Agner, Marek Vasut, Paul Burton,
	Geert Uytterhoeven, Miquel Raynal, linux-mtd, Dmitry Osipenko,
	Brian Norris, David Woodhouse, Piotr Sroka

Driver for Cadence HPNFC NAND flash controller.

HW DMA interface
Page write and page read operations are executed in Command DMA mode.
Commands are defined by DMA descriptors.
In CDMA mode controller own DMA engine is used (Master DMA mode).
Other operations defined by nand_op_instr are executed in "Generic" mode.
In that mode data can be transferred only in by Slave DMA interface.
Slave DMA interface can be connected directly to AXI or to an external
DMA engine.

HW ECC support
Cadence NAND controller supports HW BCH correction.
 ECC is transparent from SW point of view. It means that ECC codes
are calculated and written to flash. In read operation ECC codes 
are removed from user data and correction is made if necessary.

Controller data layout with ECC enabled:
 -------------------------------------------------------------------------
|Sec 1 | ECC | Sec 2 | ECC ...... | Sec n | OOB (32B) | ECC | unused data |
 -------------------------------------------------------------------------

Last sector is extended by a out-bound data. Tha maximum size of
"extra data" is 32 bytes. The oob data are protected by ECC. If we need to 
read only oob data the whole last sector must be read. It is because 
oob data are part of last sector. Reading oob function always reads 
whole sector and writing oob function always writes whole last sector.
Written data are interleaved with the ECC therefore part of the 
last sector is located on oob area and the BBM is overwritten.

SKIP BYTES feature
To protect BBM the "skip byte" HW feature is used. 
Write page function copies BBM value from first byte of oob data to 
BBM offset defined by manufacturer. Read page functions always takes 
BBM from flash manufacturer offset. It causes that for not written 
pages the proper value of BBM marker is used.

ECC size calculation
Information about supported ECC steps and ECC strengths are read 
from controller registers. ECC sector size and ECC strength can be
configurable. Size of ECC depends on maximum supported sector size 
it not depends on selected sector size. Therefore there is a separate
function for calculating ECC size for each of possible 
sector size/step size.


Piotr Sroka (2):
  Add new Cadence NAND driver to MTD subsystem
  dt-bindings: nand: Add Cadence NAND driver

 .../devicetree/bindings/mtd/cadence-nand.txt       |   35 +
 drivers/mtd/nand/raw/Kconfig                       |    8 +
 drivers/mtd/nand/raw/Makefile                      |    1 +
 drivers/mtd/nand/raw/cadence_nand.c                | 2655 ++++++++++++++++++++
 drivers/mtd/nand/raw/cadence_nand.h                |  631 +++++
 5 files changed, 3330 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/cadence-nand.txt
 create mode 100644 drivers/mtd/nand/raw/cadence_nand.c
 create mode 100644 drivers/mtd/nand/raw/cadence_nand.h

-- 
2.15.0


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

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

end of thread, other threads:[~2019-02-07 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 16:03 [PATCH 0/2] mtd: nand: Add Cadence NAND controller driver Piotr Sroka
2019-01-29 16:07 ` [PATCH 1/2] " Piotr Sroka
2019-01-29 18:19   ` Boris Brezillon
2019-02-07 13:20     ` Piotr Sroka
2019-01-29 16:10 ` [PATCH 2/2] dt-bindings: " Piotr Sroka
2019-01-29 17:21   ` Boris Brezillon
2019-02-05 17:08     ` Piotr Sroka

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