mtd: mxs_nand_spl: fix nand_command protocol violation
authorAndrea Scian <andrea.scian@dave.eu>
Tue, 21 Jun 2022 20:05:10 +0000 (22:05 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 29 Jun 2022 13:26:44 +0000 (09:26 -0400)
commit05dcb5be507a0580a0fc57dd363c632ac4a6b3c4
tree54a7a9f4786fab29a5da14f40313d3e3a4c455fc
parenta063429c17616007f6c48aaa293683402ae6ea56
mtd: mxs_nand_spl: fix nand_command protocol violation

mxs_nand_command() implementation assume that it's working with a
LP NAND, which is a common case nowadays and thus uses two bytes
for column address.

However this is wrong for NAND_CMD_READID and NAND_CMD_PARAM, which
expects only one byte of column address, even for LP NANDs.
This leads to ONFI detection problem with some NAND manufacturer (like
Winbond) but not with others (like Samsung and Spansion)

We fix this with a simple workaround to avoid the 2nd byte column address
for those two commands.

Also align the code with nand_base to support 16 bit devices.

Tested on an iMX6SX device with:
* Winbond W29N04GVSIAA
* Spansion S34ML04G100TF100
* Samsung K9F4G08U00

Tested on imx8mn device with:
* Windbond W29N04GV

Signed-off-by: Andrea Scian <andrea.scian@dave.eu>
CC: Stefano Babic <sbabic@denx.de>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Fabio Estevam <festevam@denx.de>
drivers/mtd/nand/raw/mxs_nand_spl.c