fsl_ifc_read_byte16: beyond end of buffer on ONFI redundant parameter

Anthony Pighin (Nokia) anthony.pighin at nokia.com
Wed Nov 20 08:43:17 PST 2024


commit a75bbe71a278 corrected the reading of all ONFI redundant parameter page copies:
    mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages

However, it does not appear to handle 16-bit NAND parts correctly
(i.e. Micron MT29F4G16ABBDAH4).

If the primary parameters page is incorrect, there is the following:
 [    5.196463] fsl,ifc-nand 60000000.nand: fsl_ifc_read_byte16: beyond end of buffer
 [    5.203966] fsl,ifc-nand 60000000.nand: fsl_ifc_read_byte16: beyond end of buffer
 [    5.211468] fsl,ifc-nand 60000000.nand: fsl_ifc_read_byte16: beyond end of buffer
    ...
 [    6.133237] Could not find a valid ONFI parameter page, trying bit-wise majority to recover it
 [    6.141916] ONFI parameter recovery failed, aborting

I have made the following change, which appears to remedy the issue:

--- a/drivers/mtd/nand/raw/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c
@@ -349,6 +349,9 @@ static void fsl_ifc_cmdfunc(struct nand_chip *chip, unsigned int command,
                         &ifc->ifc_nand.nand_fcr0);
               ifc_out32(column, &ifc->ifc_nand.row3);

+              if (ifc_in32(&ctrl->gregs->cspr_cs[priv->bank].cspr)
+                  & CSPR_PORT_SIZE_16)
+                      len *= 2;
               ifc_out32(len, &ifc->ifc_nand.nand_fbcr);
               ifc_nand_ctrl->read_bytes = len;

However, that only addresses the NAND_CMD_PARAM and NAND_CMD_READID commands.
I believe there is a more general issue with 16-bit NAND support in fsl_ifc_nand.

Anthony




More information about the linux-mtd mailing list