mtd: nand: am335x: Fix 'bit-flip' errors in SPL
authorRostislav Lisovy <lisovy@gmail.com>
Tue, 9 Sep 2014 13:54:30 +0000 (15:54 +0200)
committerScott Wood <scottwood@freescale.com>
Thu, 25 Sep 2014 18:43:00 +0000 (13:43 -0500)
OMAP GPMC driver used with some NAND Flash devices
(e.g. Spansion S34ML08G1) causes that U-boot shows
hundreds of 'nand: bit-flip corrected' error messages.
Possible cause was discussed in the mailinglist thread:
http://lists.denx.de/pipermail/u-boot/2014-April/177508.html

The issue was partially fixed with the cc81a5291910d7a.git
however this has to be done to fix the SPL.

The original author of the code is Belisko Marek
<marek.belisko@gmail.com>

Signed-off-by: Rostislav Lisovy <lisovy@merica.cz>
drivers/mtd/nand/am335x_spl_bch.c

index ce65d8e12b12075714a18581570d4c86d0a4fcb6..bf8b2ee16a390afed94d0f19bba2f0edaaaca398 100644 (file)
@@ -64,14 +64,18 @@ static int nand_command(int block, int page, uint32_t offs,
                       NAND_CTRL_ALE | NAND_CTRL_CHANGE); /* A[7:0] */
        hwctrl(&nand_info[0], (offs >> 8) & 0xff, NAND_CTRL_ALE); /* A[11:9] */
        /* Row address */
-       hwctrl(&nand_info[0], (page_addr & 0xff), NAND_CTRL_ALE); /* A[19:12] */
-       hwctrl(&nand_info[0], ((page_addr >> 8) & 0xff),
+       if (cmd != NAND_CMD_RNDOUT) {
+               hwctrl(&nand_info[0], (page_addr & 0xff),
+                      NAND_CTRL_ALE); /* A[19:12] */
+               hwctrl(&nand_info[0], ((page_addr >> 8) & 0xff),
                       NAND_CTRL_ALE); /* A[27:20] */
 #ifdef CONFIG_SYS_NAND_5_ADDR_CYCLE
-       /* One more address cycle for devices > 128MiB */
-       hwctrl(&nand_info[0], (page_addr >> 16) & 0x0f,
+               /* One more address cycle for devices > 128MiB */
+               hwctrl(&nand_info[0], (page_addr >> 16) & 0x0f,
                       NAND_CTRL_ALE); /* A[31:28] */
 #endif
+       }
+
        hwctrl(&nand_info[0], NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE);
 
        if (cmd == NAND_CMD_READ0) {