mtd: nand: add page status table (pst)

Page status table is an byte array storing pages status.
It defines 3 status:
 - unknown: the page has not been read yet and we do not know its current
   state
 - empty: the page contains only FFs
 - filled: the page has been filled with data

Care must be taken: an empty page does not mean it can be written, because
it might have already been written with only FFs.

These page status are useful to check wether the controller should try to
correct errors (using ECC) or a derandomize data (using a randomizer
block).

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
mtd: nand: introduce a randomizer layer in the NAND framework

This patch introduce a new layer in the NAND framework to support both HW
and SW randomizers.

This randomization is required on some MLC/TLC NAND chips which do not
support large islands of same patterns.

The randomizer layer defines a nand_rnd_ctrl struct which is intended to
be used by NAND core functions or NAND drivers to randomize/derandomize
data stored on NAND chips.

The implementation can implement any of these functions:
- config: prepare a random transfer to/from the NAND chip
- write_buf: randomize and write data to the NAND chip
- read_buf: read and derandomize data from the NAND chip

read/write_buf functions are always called after a config call.
The config call specify the page, the column within the page and the action
that will take place after the config (either read or write).
If column is set to -1, the randomizer is disabled.
If page is set to -1, we keep working on the same page.

The randomizer layer provides helper functions that choose wether the
randomizer or the chip read/write_buf should be used.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
of: mtd: add NAND randomizer mode retrieval

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
mtd: nand: add sunxi randomizer support

Add support for the HW randomizer available in the sunxi IP.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
ARM: sunxi/dt: add cubietruck NAND partitions

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
mtd: nand: add manufacturer specific init code infrastructure

Add new fields in nand_manufacturers and nand_chip struct to provide
manufacturer specific handling like read retries.

Signed-off-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
mtd: nand: add hynix specific initializer

Add an hynix initiliazer to manage read retries on h27uxgt8t2a chip.

Signed-off-by: Boris BREZILLON <b.brezillon.dev@gmail.com>