]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mtd: nand_flash_detect_onfi propagate busw info
authorMatthieu CASTET <matthieu.castet@parrot.com>
Sun, 26 Jun 2011 16:26:55 +0000 (18:26 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:38 +0000 (08:35 +0200)
there is a bug in nand_flash_detect_onfi, busw need to be passed
by pointer to return it.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
drivers/mtd/nand/nand_base.c

index f016d0fc0d634ebae7c7f543cb2ec61e771e8564..ccad911979fd6340aa6b28f61f1e4613e93318dd 100644 (file)
@@ -2855,7 +2855,7 @@ static u16 onfi_crc16(u16 crc, u8 const *p, size_t len)
  * Check if the NAND chip is ONFI compliant, returns 1 if it is, 0 otherwise
  */
 static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
-                                       int busw)
+                                       int *busw)
 {
        struct nand_onfi_params *p = &chip->onfi_params;
        int i;
@@ -2910,9 +2910,9 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
        mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
        mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
        chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
-       busw = 0;
+       *busw = 0;
        if (le16_to_cpu(p->features) & 1)
-               busw = NAND_BUSWIDTH_16;
+               *busw = NAND_BUSWIDTH_16;
 
        chip->options &= ~NAND_CHIPOPTIONS_MSK;
        chip->options |= (NAND_NO_READRDY |
@@ -2978,7 +2978,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
        chip->onfi_version = 0;
        if (!type->name || !type->pagesize) {
                /* Check is chip is ONFI compliant */
-               ret = nand_flash_detect_onfi(mtd, chip, busw);
+               ret = nand_flash_detect_onfi(mtd, chip, &busw);
                if (ret)
                        goto ident_done;
        }