[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190725145804.8886-1-piotrs@cadence.com>
Date: Thu, 25 Jul 2019 15:58:04 +0100
From: Piotr Sroka <piotrs@...ence.com>
To: <linux-kernel@...r.kernel.org>
CC: Boris Brezillon <bbrezillon@...nel.org>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Marek Vasut <marek.vasut@...il.com>,
Paul Burton <paul.burton@...s.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Arnd Bergmann <arnd@...db.de>,
Marcel Ziswiler <marcel.ziswiler@...adex.com>,
Dmitry Osipenko <digetx@...il.com>,
Stefan Agner <stefan@...er.ch>,
<linux-mtd@...ts.infradead.org>,
Kazuhiro Kasai <kasai.kazuhiro@...ionext.com>,
Piotr Sroka <piotrs@...ence.com>
Subject: [v5 0/2] mtd: nand: Add Cadence NAND controller driver
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
Add Cadence NAND controller driver
.../bindings/mtd/cadence-nand-controller.txt | 50 +
drivers/mtd/nand/raw/Kconfig | 7 +
drivers/mtd/nand/raw/Makefile | 1 +
drivers/mtd/nand/raw/cadence-nand-controller.c | 3021 ++++++++++++++++++++
4 files changed, 3079 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mtd/cadence-nand-controller.txt
create mode 100644 drivers/mtd/nand/raw/cadence-nand-controller.c
--
2.15.0
Powered by blists - more mailing lists