[PATCH] mtd: brcmnand: Fix NAND_CMD_PARAM byte order
Clay McClure
clay at daemons.net
Mon Nov 2 15:05:52 PST 2015
On Tue, Oct 27, 2015 at 1:55 PM, Ray Jui <rjui at broadcom.com> wrote:
> Don't you think this may have something to do with the APB bus endianness
> setting that's not used for all non-iProc SoCs? I suspect not just the ONFI
> paramter page, but all other NAND data read into FLASH_CACHE are in BE
> format on those SoCs (or am I completely out of my mind and missing
> something here?)
It's a good question (whether all flash cache data is big-endian), and
I don't know the answer, but I've verified that the below patch does
fix the problem with PARAMETER_READ on the Helix4 (an iProc-based
switch chip). Whether the other uses of
brcmnand_soc_data_bus_prepare() should also be removed, I can't say; I
don't know why they were originally needed.
Clay
----8<----
>From c0ab411165ceedc5afc5a2c49c4d1bf9ba035dc8 Mon Sep 17 00:00:00 2001
From: Clay McClure <clay at daemons.net>
Date: Mon, 2 Nov 2015 13:07:59 -0800
Subject: [PATCH] mtd: brcmnand: Fix NAND_CMD_PARAM on iProc
On Broadcom's iProc-based SoCs, nand_flash_detect_onfi() fails at
boot with:
Could not find valid ONFI parameter page; aborting
The endianness of the in-memory parameter page cache is backwards,
causing the ONFI CRC validation to fail. It seems that the NAND
controllers on these chips handle PARAMETER_READ commands differently
from other commands, filling the flash cache with big endian-like
data. Because of that quirk, we don't need to implicitly swap bytes
on the APB bus while reading the flash cache for parameter pages.
Signed-off-by: Clay McClure <clay at daemons.net>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/brcmnand/brcmnand.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c
b/drivers/mtd/nand/brcmnand/brcmnand.c
index 12c6190..36a676d 100644
--- a/drivers/mtd/nand/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/brcmnand/brcmnand.c
@@ -1190,8 +1190,6 @@ static void brcmnand_cmdfunc(struct mtd_info
*mtd, unsigned command,
native_cmd == CMD_PARAMETER_CHANGE_COL) {
int i;
- brcmnand_soc_data_bus_prepare(ctrl->soc);
-
/*
* Must cache the FLASH_CACHE now, since changes in
* SECTOR_SIZE_1K may invalidate it
@@ -1199,8 +1197,6 @@ static void brcmnand_cmdfunc(struct mtd_info
*mtd, unsigned command,
for (i = 0; i < FC_WORDS; i++)
ctrl->flash_cache[i] = brcmnand_read_fc(ctrl, i);
- brcmnand_soc_data_bus_unprepare(ctrl->soc);
-
/* Cleanup from HW quirk: restore SECTOR_SIZE_1K */
if (host->hwcfg.sector_size_1k)
brcmnand_set_sector_size_1k(host,
--
2.1.4
More information about the linux-mtd
mailing list