diff mbox

[U-Boot] mtd: nand: omap_gpmc: Fix 'bit-flip' errors

Message ID 1409670030-23573-1-git-send-email-lisovy@merica.cz
State Awaiting Upstream
Delegated to: Tom Rini
Headers show

Commit Message

Rostislav Lisovy Sept. 2, 2014, 3 p.m. UTC
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

Quote (Author: Pekon Gupta <pekon@ti.com>): "The issue is mainly
due to a NAND protocol violation in the omap driver since the
Random Data Output command (05h-E0h) expects to see only the
column address that should be addressed within the already loaded
read page into the read buffer. Only 2 address cycles with ALE
active should be provided between the 05h and E0h commands. The
Page read command expects the full address footprint (2bytes for
column address + 3bytes for row address), but once the page is
loaded into the read buffer, Random Data Output should be used
with only 2bytes for column address."

This patch combines the solution proposed in the mailinglist and
the patch provided by the Spansion company (GPLv2 code, source:
http://www.spansion.com/Support/Software/u-boot-psp-04.04.00.01-NAND.zip)

Signed-off-by: Rostislav Lisovy <lisovy@merica.cz>
---
 drivers/mtd/nand/omap_gpmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tom Rini Sept. 4, 2014, 8:48 p.m. UTC | #1
On Tue, Sep 02, 2014 at 05:00:30PM +0200, Rostislav Lisovy wrote:

> 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
> 
> Quote (Author: Pekon Gupta <pekon@ti.com>): "The issue is mainly
> due to a NAND protocol violation in the omap driver since the
> Random Data Output command (05h-E0h) expects to see only the
> column address that should be addressed within the already loaded
> read page into the read buffer. Only 2 address cycles with ALE
> active should be provided between the 05h and E0h commands. The
> Page read command expects the full address footprint (2bytes for
> column address + 3bytes for row address), but once the page is
> loaded into the read buffer, Random Data Output should be used
> with only 2bytes for column address."
> 
> This patch combines the solution proposed in the mailinglist and
> the patch provided by the Spansion company (GPLv2 code, source:
> http://www.spansion.com/Support/Software/u-boot-psp-04.04.00.01-NAND.zip)
> 
> Signed-off-by: Rostislav Lisovy <lisovy@merica.cz>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 1acf06b..7dd7d41 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -478,11 +478,11 @@  static int omap_read_page_bch(struct mtd_info *mtd, struct nand_chip *chip,
 				oob += eccbytes) {
 		chip->ecc.hwctl(mtd, NAND_ECC_READ);
 		/* read data */
-		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_pos, page);
+		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, data_pos, -1);
 		chip->read_buf(mtd, p, eccsize);
 
 		/* read respective ecc from oob area */
-		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_pos, page);
+		chip->cmdfunc(mtd, NAND_CMD_RNDOUT, oob_pos, -1);
 		chip->read_buf(mtd, oob, eccbytes);
 		/* read syndrome */
 		chip->ecc.calculate(mtd, p, &ecc_calc[i]);