aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-26 19:02:13 -0400
committerThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-26 19:02:13 -0400
commitba0251fe87ea560eb377917e06ba0b5b9ab89094 (patch)
tree9f01452bb883ddcbd2ef1047638f9aeefeb4c89f /drivers/mtd
parentcca3b837bbb4c984165f9f9c7c06846bc0425791 (diff)
[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: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0c8da8fab89d..023224dd12eb 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1954,10 +1954,13 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
1954 if (!type) 1954 if (!type)
1955 return ERR_PTR(-ENODEV); 1955 return ERR_PTR(-ENODEV);
1956 1956
1957 chip->chipsize = nand_flash_ids[i].chipsize << 20; 1957 if (!mtd->name)
1958 mtd->name = type->name;
1959
1960 chip->chipsize = type->chipsize << 20;
1958 1961
1959 /* Newer devices have all the information in additional id bytes */ 1962 /* Newer devices have all the information in additional id bytes */
1960 if (!nand_flash_ids[i].pagesize) { 1963 if (!type->pagesize) {
1961 int extid; 1964 int extid;
1962 /* The 3rd id byte contains non relevant data ATM */ 1965 /* The 3rd id byte contains non relevant data ATM */
1963 extid = chip->read_byte(mtd); 1966 extid = chip->read_byte(mtd);
@@ -1979,10 +1982,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
1979 /* 1982 /*
1980 * Old devices have chip data hardcoded in the device id table 1983 * Old devices have chip data hardcoded in the device id table
1981 */ 1984 */
1982 mtd->erasesize = nand_flash_ids[i].erasesize; 1985 mtd->erasesize = type->erasesize;
1983 mtd->writesize = nand_flash_ids[i].pagesize; 1986 mtd->writesize = type->pagesize;
1984 mtd->oobsize = mtd->writesize / 32; 1987 mtd->oobsize = mtd->writesize / 32;
1985 busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16; 1988 busw = type->options & NAND_BUSWIDTH_16;
1986 } 1989 }
1987 1990
1988 /* Try to identify manufacturer */ 1991 /* Try to identify manufacturer */
@@ -2020,7 +2023,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
2020 2023
2021 /* Get chip options, preserve non chip based options */ 2024 /* Get chip options, preserve non chip based options */
2022 chip->options &= ~NAND_CHIPOPTIONS_MSK; 2025 chip->options &= ~NAND_CHIPOPTIONS_MSK;
2023 chip->options |= nand_flash_ids[i].options & NAND_CHIPOPTIONS_MSK; 2026 chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
2024 2027
2025 /* 2028 /*
2026 * Set chip as a default. Board drivers can override it, if necessary 2029 * 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 /* Check if chip is a not a samsung device. Do not clear the 2033 /* Check if chip is a not a samsung device. Do not clear the
2031 * options for chips which are not having an extended id. 2034 * options for chips which are not having an extended id.
2032 */ 2035 */
2033 if (*maf_id != NAND_MFR_SAMSUNG && !nand_flash_ids[i].pagesize) 2036 if (*maf_id != NAND_MFR_SAMSUNG && !type->pagesize)
2034 chip->options &= ~NAND_SAMSUNG_LP_OPTIONS; 2037 chip->options &= ~NAND_SAMSUNG_LP_OPTIONS;
2035 2038
2036 /* Check for AND chips with 4 page planes */ 2039 /* Check for AND chips with 4 page planes */