Message ID | 4D9B29FC.1040405@dawning.com |
---|---|
State | Superseded |
Headers | show |
On Tue, Apr 05, 2011 at 10:41:00AM -0400, Alex wrote: > 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> > --- Patch is whitespace-damaged, and does not apply. Please read: http://www.denx.de/wiki/U-Boot/Patches Also please make sure your full name is in the From: field, so that the git commit authorship information is complete. > 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 ) No space after ( or before ) > + offs += (CONFIG_SYS_NAND_PAGE_SIZE >> 1); Unnecessary parens The semantics of this don't match what's done in the non-SPL code -- there the column/offs is assumed to be in bytes when passed to nand_command(), and dividing by two happens later (after the READOOB adjustment). Don't we also need to fix nand_is_bad_block() to use a 16-bit access? -Scott
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; }