summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2019-03-15 15:14:37 +0100
committerTom Rini <trini@konsulko.com>2019-04-22 11:55:58 -0400
commit317d40eb01a8e194e6e321e71e811d6da03b8365 (patch)
tree6d094aaa96452a5fd416c49ccea0d34220d1314d
parent22daafba25592b79112d21d1662d7b8381827c56 (diff)
drivers: nand: brcmnand: add parameter parameter-page-big-endian
The parameter page isn't always in big endian, so we add an option to choose the endiannes of the parameter page. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
-rw-r--r--drivers/mtd/nand/raw/brcmnand/brcmnand.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 7791077142..e333320808 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -113,6 +113,7 @@ struct brcmnand_controller {
unsigned int irq;
unsigned int dma_irq;
int nand_version;
+ int parameter_page_big_endian;
/* Some SoCs provide custom interrupt status register(s) */
struct brcmnand_soc *soc;
@@ -1439,12 +1440,20 @@ static void brcmnand_cmdfunc(struct mtd_info *mtd, unsigned command,
* Must cache the FLASH_CACHE now, since changes in
* SECTOR_SIZE_1K may invalidate it
*/
- for (i = 0; i < FC_WORDS; i++)
+ for (i = 0; i < FC_WORDS; i++) {
+ u32 fc;
+
+ fc = brcmnand_read_fc(ctrl, i);
+
/*
* Flash cache is big endian for parameter pages, at
* least on STB SoCs
*/
- flash_cache[i] = be32_to_cpu(brcmnand_read_fc(ctrl, i));
+ if (ctrl->parameter_page_big_endian)
+ flash_cache[i] = be32_to_cpu(fc);
+ else
+ flash_cache[i] = le32_to_cpu(fc);
+ }
brcmnand_soc_data_bus_unprepare(ctrl->soc, true);
@@ -2550,6 +2559,10 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc)
nand_hw_control_init(&ctrl->controller);
INIT_LIST_HEAD(&ctrl->host_list);
+ /* Is parameter page in big endian ? */
+ ctrl->parameter_page_big_endian =
+ dev_read_u32_default(dev, "parameter-page-big-endian", 1);
+
/* NAND register range */
#ifndef __UBOOT__
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);