Commit 4d1ea982 authored by Anup Patel's avatar Anup Patel Committed by Brian Norris

mtd: brcmnand: Force 8bit mode before doing nand_scan_ident()

Just like other NAND controllers, the NAND READID command only works
in 8bit mode for all versions of BRCMNAND controller.

This patch forces 8bit mode for each NAND CS in brcmnand_init_cs()
before doing nand_scan_ident() to ensure that BRCMNAND controller
is in 8bit mode when NAND READID command is issued.
Signed-off-by: default avatarAnup Patel <anup.patel@broadcom.com>
Reviewed-by: default avatarRay Jui <rjui@broadcom.com>
Reviewed-by: default avatarScott Branden <sbranden@broadcom.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 3f06d2a9
...@@ -1913,6 +1913,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host) ...@@ -1913,6 +1913,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
struct mtd_info *mtd; struct mtd_info *mtd;
struct nand_chip *chip; struct nand_chip *chip;
int ret; int ret;
u16 cfg_offs;
struct mtd_part_parser_data ppdata = { .of_node = dn }; struct mtd_part_parser_data ppdata = { .of_node = dn };
ret = of_property_read_u32(dn, "reg", &host->cs); ret = of_property_read_u32(dn, "reg", &host->cs);
...@@ -1955,6 +1956,15 @@ static int brcmnand_init_cs(struct brcmnand_host *host) ...@@ -1955,6 +1956,15 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
chip->controller = &ctrl->controller; chip->controller = &ctrl->controller;
/*
* The bootloader might have configured 16bit mode but
* NAND READID command only works in 8bit mode. We force
* 8bit mode here to ensure that NAND READID commands works.
*/
cfg_offs = brcmnand_cs_offset(ctrl, host->cs, BRCMNAND_CS_CFG);
nand_writereg(ctrl, cfg_offs,
nand_readreg(ctrl, cfg_offs) & ~CFG_BUS_WIDTH);
if (nand_scan_ident(mtd, 1, NULL)) if (nand_scan_ident(mtd, 1, NULL))
return -ENXIO; return -ENXIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment