From: Jagan Date: Fri, 13 Jul 2012 07:17:52 +0000 (+0530) Subject: Xilinx: ARM: nand: fixed 16-bit On-Die ECC flash support X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=34143962cd51515be8e844244bac9837cfca2554;p=thirdparty%2Fu-boot.git Xilinx: ARM: nand: fixed 16-bit On-Die ECC flash support NAND 16-bit On-Die support is not detected due to some improper column adjustments while sending commands to NAND device. So adjusted columns for NAND 16-bit bus width to detect the On-Die ECC flash support. Signed-off-by: Jagan --- diff --git a/drivers/mtd/nand/zynq_nand.c b/drivers/mtd/nand/zynq_nand.c index 40b4b1128d7..2586f2d217f 100644 --- a/drivers/mtd/nand/zynq_nand.c +++ b/drivers/mtd/nand/zynq_nand.c @@ -883,7 +883,11 @@ static void xnandps_cmd_function(struct mtd_info *mtd, unsigned int command, /* Change read/write column, read id etc */ else if (column != -1) { /* Adjust columns for 16 bit bus width */ - if (chip->options & NAND_BUSWIDTH_16) + if ((chip->options & NAND_BUSWIDTH_16) && + ((command == NAND_CMD_READ0) || + (command == NAND_CMD_SEQIN) || + (command == NAND_CMD_RNDOUT) || + (command == NAND_CMD_RNDIN))) column >>= 1; cmd_data = column; } else @@ -899,6 +903,7 @@ static void xnandps_cmd_function(struct mtd_info *mtd, unsigned int command, ndelay(100); if ((command == NAND_CMD_READ0) || + (command == NAND_CMD_ERASE1) || (command == NAND_CMD_RESET) || (command == NAND_CMD_PARAM) || (command == NAND_CMD_GET_FEATURES)) { @@ -1183,6 +1188,7 @@ int zynq_nand_init(struct nand_chip *nand_chip) } /* Send the command for reading device ID */ + nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1); nand_chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); /* Read manufacturer and device IDs */