All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex <awaterman@dawning.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nand_spl: Fix large page nand_command()
Date: Tue, 05 Apr 2011 10:41:00 -0400	[thread overview]
Message-ID: <4D9B29FC.1040405@dawning.com> (raw)

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

             reply	other threads:[~2011-04-05 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 14:41 Alex [this message]
2011-04-05 18:42 ` [U-Boot] [PATCH] nand_spl: Fix large page nand_command() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D9B29FC.1040405@dawning.com \
    --to=awaterman@dawning.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.