[U-Boot] [PATCH 2/5] NetStar: Fix NAND

Scott Wood
2009-03-17T19:10:05Z

Ladislav Michl wrote:
> On Tue, Mar 17, 2009 at 12:17:30PM -0500, Scott Wood wrote:
>> On Mon, Mar 16, 2009 at 11:28:24PM +0100, Ladislav Michl wrote:
>>> Fix NAND support broken during new NAND code merge. Move those few lines of
>>> code to board/netstar/netstar.c
>> What was the breakage?
>
> Blocks being considered bad during read. I did not make any deeper analysis,
> just copied proven code.

I think I see the issue -- if NAND_CTRL_CHANGE is not set, it will reset
IO_ADDR_W rather than leaving it alone. There's also a bug for 64-bit
platforms if I/O is over 4GiB, but that's not applicable here.

> The code above is identical to that found in linux driver. I'm considering
> useful to keep it in sync for sake of easier future upgrades.
> Sure it could be written as
> if (ctrl & NAND_CLE)
> mask = 0x02;
> else
> mask = 0;
> if (ctrl & NAND_ALE)
> mask |= 0x04;
> but the former is a bit shorter.

I was thinking more along the lines of:

unsigned long mask = 0;

if (ctrl & NAND_CLE)
mask |= 2;
if (ctrl & NAND_ALE)
mask |= 4;

...simple and symmetric. But it doesn't matter overly much; keeping in
sync with the Linux driver is more important.

ACK, though I would like to see the argument to writeb cast to a pointer
before passing it (or else you'll get warnings if the accessor ever
changes from a macro to an inline function).

-Scott