[U-Boot] [PATCH] nand_spl: Fix large page nand_command()

Alex awaterman at dawning.com
Tue Apr 5 16:41:00 CEST 2011


From: Alex Waterman <awaterman at dawning.com>
Date: Tue, 5 Apr 2011 10:32:38 -0400
Subject: [PATCH] nand_spl: Fix large page nand_command()

The large page nand_command() function addresses all chips by byte offset;
when using a 16 bit chip the NAND_CMD_READOOB emulation would then address
the OOB as though it were a byte offset instead of a word offset. This leads
to addressing data that doesnt exist; to fix, simply divide the byte offset
by two.

Signed-off-by: Alex Waterman <awaterman at dawning.com>
---
 nand_spl/nand_boot.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c
index 76b8566..4ef9aea 100644
--- a/nand_spl/nand_boot.c
+++ b/nand_spl/nand_boot.c
@@ -86,7 +86,10 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 
     /* Emulate NAND_CMD_READOOB */
     if (cmd == NAND_CMD_READOOB) {
-        offs += CONFIG_SYS_NAND_PAGE_SIZE;
+        if ( this->options & NAND_BUSWIDTH_16 )
+            offs += (CONFIG_SYS_NAND_PAGE_SIZE >> 1);
+        else
+            offs += CONFIG_SYS_NAND_PAGE_SIZE;
         cmd = NAND_CMD_READ0;
     }
 
-- 
1.7.3.1



More information about the U-Boot mailing list