From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Mon, 20 Apr 2015 18:17:31 -0500 Subject: [U-Boot] [PATCH v2 8/8] mtd: vf610_nfc: enable ONFI detection In-Reply-To: <1428504281-30214-9-git-send-email-stefan@agner.ch> References: <1428504281-30214-1-git-send-email-stefan@agner.ch> <1428504281-30214-9-git-send-email-stefan@agner.ch> Message-ID: <1429571851.4352.45.camel@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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