Commit ba0251fe authored by Thomas Gleixner's avatar Thomas Gleixner

[MTD] NAND Consolidate references and add back default name setting

We have a type pointer. Make use of it instead of the error prone nand_ids[i]
reference.

The NAND driver used to set default name settings from the chip ID
string for the device. The feature got lost during the rework. Add it back.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent cca3b837
...@@ -1954,10 +1954,13 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -1954,10 +1954,13 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
if (!type) if (!type)
return ERR_PTR(-ENODEV); return ERR_PTR(-ENODEV);
chip->chipsize = nand_flash_ids[i].chipsize << 20; if (!mtd->name)
mtd->name = type->name;
chip->chipsize = type->chipsize << 20;
/* Newer devices have all the information in additional id bytes */ /* Newer devices have all the information in additional id bytes */
if (!nand_flash_ids[i].pagesize) { if (!type->pagesize) {
int extid; int extid;
/* The 3rd id byte contains non relevant data ATM */ /* The 3rd id byte contains non relevant data ATM */
extid = chip->read_byte(mtd); extid = chip->read_byte(mtd);
...@@ -1979,10 +1982,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -1979,10 +1982,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
/* /*
* Old devices have chip data hardcoded in the device id table * Old devices have chip data hardcoded in the device id table
*/ */
mtd->erasesize = nand_flash_ids[i].erasesize; mtd->erasesize = type->erasesize;
mtd->writesize = nand_flash_ids[i].pagesize; mtd->writesize = type->pagesize;
mtd->oobsize = mtd->writesize / 32; mtd->oobsize = mtd->writesize / 32;
busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; busw = type->options & NAND_BUSWIDTH_16;
} }
/* Try to identify manufacturer */ /* Try to identify manufacturer */
...@@ -2020,7 +2023,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -2020,7 +2023,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
/* Get chip options, preserve non chip based options */ /* Get chip options, preserve non chip based options */
chip->options &= ~NAND_CHIPOPTIONS_MSK; chip->options &= ~NAND_CHIPOPTIONS_MSK;
chip->options |= nand_flash_ids[i].options & NAND_CHIPOPTIONS_MSK; chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
/* /*
* Set chip as a default. Board drivers can override it, if necessary * Set chip as a default. Board drivers can override it, if necessary
...@@ -2030,7 +2033,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, ...@@ -2030,7 +2033,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
/* Check if chip is a not a samsung device. Do not clear the /* Check if chip is a not a samsung device. Do not clear the
* options for chips which are not having an extended id. * options for chips which are not having an extended id.
*/ */
if (*maf_id != NAND_MFR_SAMSUNG && !nand_flash_ids[i].pagesize) if (*maf_id != NAND_MFR_SAMSUNG && !type->pagesize)
chip->options &= ~NAND_SAMSUNG_LP_OPTIONS; chip->options &= ~NAND_SAMSUNG_LP_OPTIONS;
/* Check for AND chips with 4 page planes */ /* Check for AND chips with 4 page planes */
......
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