mtd: nand: provide valid ->data_interface during NAND detection
authorMiquel Raynal <miquel.raynal@free-electrons.com>
Thu, 30 Nov 2017 17:01:31 +0000 (18:01 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 14 Dec 2017 12:34:18 +0000 (13:34 +0100)
commit17fa8044188c152e8a3b9493f8b8054cacbfb9ba
tree09862c411942ba7b4c62035c11a5b702b736371f
parent25f815f66a141436df8a4c45e5d2765272aea2ac
mtd: nand: provide valid ->data_interface during NAND detection

Right now, the chip->data_interface field is populated in
nand_scan_tail(), so after the whole NAND detection has taken place.
This is fine because these timings are not yet used by the core so
early in the probe process, but the situation is about to change with
the introduction of ->exec_op().

Also, by convention, nand_scan_ident() is not supposed to allocate
resources, only nand_scan_tail() can, so this prevent us from
allocating and initializing the data_interface object in
nand_scan_ident().

In order to solve this problem, directly embed a data_interface object
in nand_chip so that we don't have to allocate it, and initialize it to
ONFI SDR mode 0 at the very beginning of nand_scan_ident().

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nand_timings.c
include/linux/mtd/rawnand.h