On Wed, 2015-04-08 at 16:44 +0200, Stefan Agner wrote:
> +     case ALT_BUF_ONFI:
> +             /* Reverse byte since the controller uses big endianness */
> +             c = nfc->column % 4;
> +             c = nfc->column - c + (3 - c);

These two lines can be simplified to "c = nfc->column ^ 3;"

Doesn't this driver run on some big-endian targets, in which case you
wouldn't want to reverse?  I think you should instead be using in_be32()
and then extracting the byte within the word after it's been put into
cpu byte order.

> +             tmp = *((u8 *)(nfc->regs + NFC_MAIN_AREA(0) + c));
> +             break;
> +     default:
> +             tmp = *((u8 *)(nfc->regs + NFC_MAIN_AREA(0) + c));
> +             break;

Why is the byte order different here?  I guess you've been writing data
backwards onto the NAND chip?  Won't that mess up factory bad block
markers?

-Scott


_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to