public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nand_spl: Fix large page nand_command()
@ 2011-04-05 14:41 Alex
  2011-04-05 18:42 ` Scott Wood
  0 siblings, 1 reply; 6+ messages in thread
From: Alex @ 2011-04-05 14:41 UTC (permalink / raw)
  To: u-boot

From: Alex Waterman <awaterman@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@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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-03 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 14:41 [U-Boot] [PATCH] nand_spl: Fix large page nand_command() Alex
2011-04-05 18:42 ` Scott Wood
2011-04-06 20:01   ` [U-Boot] [PATCH v2] " Alex Waterman
2011-04-11 18:58     ` Scott Wood
2011-05-01 14:43     ` Wolfgang Denk
2011-05-03 16:08       ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox