aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJane Wan <Jane.Wan@nokia.com>2018-05-08 17:19:53 -0400
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-05-09 10:04:21 -0400
commita75bbe71a27875fdc61cde1af6d799037cef6bed (patch)
tree7982dfb2b5588bcd8f46172d0d9f592004ac6a5d
parentbb415dff3ab73b0e97f031dbc7ca708f76739643 (diff)
mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages
Per ONFI specification (Rev. 4.0), if the CRC of the first parameter page read is not valid, the host should read redundant parameter page copies. Fix FSL NAND driver to read the two redundant copies which are mandatory in the specification. Signed-off-by: Jane Wan <Jane.Wan@nokia.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
-rw-r--r--drivers/mtd/nand/raw/fsl_ifc_nand.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c
index 00a609d4473e..382b67e97174 100644
--- a/drivers/mtd/nand/raw/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c
@@ -342,9 +342,16 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
342 342
343 case NAND_CMD_READID: 343 case NAND_CMD_READID:
344 case NAND_CMD_PARAM: { 344 case NAND_CMD_PARAM: {
345 /*
346 * For READID, read 8 bytes that are currently used.
347 * For PARAM, read all 3 copies of 256-bytes pages.
348 */
349 int len = 8;
345 int timing = IFC_FIR_OP_RB; 350 int timing = IFC_FIR_OP_RB;
346 if (command == NAND_CMD_PARAM) 351 if (command == NAND_CMD_PARAM) {
347 timing = IFC_FIR_OP_RBCD; 352 timing = IFC_FIR_OP_RBCD;
353 len = 256 * 3;
354 }
348 355
349 ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 356 ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
350 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | 357 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) |
@@ -354,12 +361,8 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
354 &ifc->ifc_nand.nand_fcr0); 361 &ifc->ifc_nand.nand_fcr0);
355 ifc_out32(column, &ifc->ifc_nand.row3); 362 ifc_out32(column, &ifc->ifc_nand.row3);
356 363
357 /* 364 ifc_out32(len, &ifc->ifc_nand.nand_fbcr);
358 * although currently it's 8 bytes for READID, we always read 365 ifc_nand_ctrl->read_bytes = len;
359 * the maximum 256 bytes(for PARAM)
360 */
361 ifc_out32(256, &ifc->ifc_nand.nand_fbcr);
362 ifc_nand_ctrl->read_bytes = 256;
363 366
364 set_addr(mtd, 0, 0, 0); 367 set_addr(mtd, 0, 0, 0);
365 fsl_ifc_run_command(mtd); 368 fsl_ifc_run_command(mtd);