From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Date: Tue, 05 Apr 2011 10:41:00 -0400 Subject: [U-Boot] [PATCH] nand_spl: Fix large page nand_command() Message-ID: <4D9B29FC.1040405@dawning.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Alex Waterman 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 --- 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