Commit 08c248fb authored by Matthieu CASTET's avatar Matthieu CASTET Committed by Artem Bityutskiy

mtd: nand_flash_detect_onfi propagate busw info

there is a bug in nand_flash_detect_onfi, busw need to be passed
by pointer to return it.
Signed-off-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
Acked-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <dedekind1@gmail.com>
parent c478d7e4
...@@ -2824,7 +2824,7 @@ static u16 onfi_crc16(u16 crc, u8 const *p, size_t len) ...@@ -2824,7 +2824,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. * 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, 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; struct nand_onfi_params *p = &chip->onfi_params;
int i; int i;
...@@ -2879,9 +2879,9 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, ...@@ -2879,9 +2879,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->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page); mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize; chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
busw = 0; *busw = 0;
if (le16_to_cpu(p->features) & 1) if (le16_to_cpu(p->features) & 1)
busw = NAND_BUSWIDTH_16; *busw = NAND_BUSWIDTH_16;
chip->options &= ~NAND_CHIPOPTIONS_MSK; chip->options &= ~NAND_CHIPOPTIONS_MSK;
chip->options |= (NAND_NO_READRDY | chip->options |= (NAND_NO_READRDY |
...@@ -2948,7 +2948,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -2948,7 +2948,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
chip->onfi_version = 0; chip->onfi_version = 0;
if (!type->name || !type->pagesize) { if (!type->name || !type->pagesize) {
/* Check is chip is ONFI compliant */ /* Check is chip is ONFI compliant */
ret = nand_flash_detect_onfi(mtd, chip, busw); ret = nand_flash_detect_onfi(mtd, chip, &busw);
if (ret) if (ret)
goto ident_done; goto ident_done;
} }
......
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