[U-Boot] fsl_elbc_nand bug
Scott Wood
scottwood at freescale.com
Mon May 18 23:17:40 CEST 2015
On Fri, 2015-05-15 at 14:48 -0700, Andrei Yakimov wrote:
> Hi,
> I just found, if NAND ONFI parameter page first copy is
> bad, u-boot will never read extra copes:
>
> fsl_elbc_nand.c:
> 342 out_be32(&lbc->fbcr, 256);
> 343 ctrl->read_bytes = 256;
>
> this code cause "read beyond buffer" error message:
>
> nand_base.c:
> chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
> 3243 for (i = 0; i < 3; i++) {
> 3244 for (j = 0; j < sizeof(*p); j++)
> 3245 ((uint8_t *)p)[j] = chip->read_byte(mtd);
> 3246 if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
> 3247 le16_to_cpu(p->crc)) {
> 3248 break;
> 3249 }
> 3250 }
>
> Unfortunately I do not working with latest u-boot now,
> so can not provide a patch, read size should be increased to
> at least 768 ( 3 copy mandatory for ONFI spec). Linux kernel should be
> updated too.
Could you send a patch (both here and Linux)? Especially since you have
a test case. :-)
Though a better fix than just increasing the byte count would be to add
a read_id() callback so that the NAND subsystem can actually tell the
driver how much data it's expecting, rather than forcing it to go
through cmdfunc that makes high-level drivers (poorly) emulate
low-level hardware.
> I am also not expert for other NAND controllers drivers.
At least IFC will have the same issue.
-Scott
More information about the U-Boot
mailing list