mtd: nand: gpmi: Fix subpage reads
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 23 Jan 2018 10:13:17 +0000 (11:13 +0100)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 25 Jan 2018 08:14:20 +0000 (09:14 +0100)
commit4c7e95b1b3286a2ba704790018a35510344958f2
tree7894f9f33418684d6ac80d2e076285bade5c9a2c
parentc1a72e2dbb4abb90bd408480d7c48ba40cb799ce
mtd: nand: gpmi: Fix subpage reads

Commit 25f815f66a14 ("mtd: nand: force drivers to explicitly send
READ/PROG commands") added a call to nand_read_page_op() in
gpmi_ecc_read_page(), which means this function now sends a READ0
command and place the data pointer at the beginning of the page. This
logic is breaking gpmi_ecc_read_subpage() which was calling
gpmi_ecc_read_page() and expected it to only retrieve the data without
sending the READ0 command.

Create a gpmi_ecc_read_page_data() helper which only does the data
retrieval and ECC correction steps and implement gpmi_ecc_read_page()
as a wrapper that calls nand_read_page_op()+gpmi_ecc_read_page_data().

This way, gpmi_ecc_read_subpage() can call gpmi_ecc_read_page_data()
which restores the logic we had before commit 25f815f66a14 ("mtd: nand:
force drivers to explicitly send READ/PROG commands").

Fixes: 25f815f66a14 ("mtd: nand: force drivers to explicitly send READ/PROG commands")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Han Xu <han.xu@nxp.com>
drivers/mtd/nand/gpmi-nand/gpmi-nand.c