Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1248499

[PATCH v2 3/4] mtd: brcmnand: Force 8bit mode before doing nand_scan_ident()

From Anup Patel <anup.patel@broadcom.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/4] mtd: brcmnand: Force 8bit mode before doing nand_scan_ident()
Date 2015-10-16 11:10 +0200
Message-ID <qk9bt-1EB-21@gated-at.bofh.it> (permalink)
References <qk9br-1EB-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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: Anup Patel <anup.patel@broadcom.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
Reviewed-by: Scott Branden <sbranden@broadcom.com>
---
 drivers/mtd/nand/brcmnand/brcmnand.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
index 4cba03d..0be8ef9 100644
--- a/drivers/mtd/nand/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/brcmnand/brcmnand.c
@@ -1888,6 +1888,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
 	struct mtd_info *mtd;
 	struct nand_chip *chip;
 	int ret;
+	u16 cfg_offs;
 	struct mtd_part_parser_data ppdata = { .of_node = dn };
 
 	ret = of_property_read_u32(dn, "reg", &host->cs);
@@ -1930,6 +1931,14 @@ static int brcmnand_init_cs(struct brcmnand_host *host)
 
 	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) & ~BIT(23));
+
 	if (nand_scan_ident(mtd, 1, NULL))
 		return -ENXIO;
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] NAND support for Broadcom NS2 SoC Anup Patel <anup.patel@broadcom.com> - 2015-10-16 11:10 +0200
  [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64 Anup Patel <anup.patel@broadcom.com> - 2015-10-16 11:10 +0200
    Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected  for ARM64 Ray Jui <rjui@broadcom.com> - 2015-10-16 17:40 +0200
      Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected  for ARM64 Brian Norris <computersforpeace@gmail.com> - 2015-10-16 18:50 +0200
    Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64 Arnd Bergmann <arnd@arndb.de> - 2015-10-16 18:30 +0200
      Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected  for ARM64 Brian Norris <computersforpeace@gmail.com> - 2015-10-16 19:00 +0200
        Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected  for ARM64 Florian Fainelli <f.fainelli@gmail.com> - 2015-10-16 21:30 +0200
          Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64 Arnd Bergmann <arnd@arndb.de> - 2015-10-16 21:40 +0200
        Re: [PATCH v2 2/4] mtd: nand: Allow MTD_NAND_BRCMNAND to be selected for ARM64 Arnd Bergmann <arnd@arndb.de> - 2015-10-16 21:30 +0200
  [PATCH v2 4/4] arm64: dts: Add BRCM IPROC NAND DT node for NS2 Anup Patel <anup.patel@broadcom.com> - 2015-10-16 11:10 +0200
  [PATCH v2 3/4] mtd: brcmnand: Force 8bit mode before doing nand_scan_ident() Anup Patel <anup.patel@broadcom.com> - 2015-10-16 11:10 +0200
  [PATCH v2 1/4] mtd: brcmnand: Fix pointer type-cast in brcmnand_write() Anup Patel <anup.patel@broadcom.com> - 2015-10-16 11:20 +0200
    Re: [PATCH v2 1/4] mtd: brcmnand: Fix pointer type-cast in  brcmnand_write() Ray Jui <rjui@broadcom.com> - 2015-10-16 17:40 +0200
      Re: [PATCH v2 1/4] mtd: brcmnand: Fix pointer type-cast in  brcmnand_write() Brian Norris <computersforpeace@gmail.com> - 2015-10-16 18:50 +0200
      RE: [PATCH v2 1/4] mtd: brcmnand: Fix pointer type-cast in  brcmnand_write() Anup Patel <anup.patel@broadcom.com> - 2015-10-17 05:00 +0200

csiph-web