[U-Boot] [PATCH v2 8/8] mtd: vf610_nfc: enable ONFI detection

Scott Wood scottwood at freescale.com
Tue Apr 21 01:17:31 CEST 2015


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




More information about the U-Boot mailing list