diff options
Diffstat (limited to 'drivers/mtd/nand/nand_base.c')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 7acb1a0e7409..ba1bdf787323 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2229,6 +2229,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2229 | { | 2229 | { |
2230 | struct nand_flash_dev *type = NULL; | 2230 | struct nand_flash_dev *type = NULL; |
2231 | int i, dev_id, maf_idx; | 2231 | int i, dev_id, maf_idx; |
2232 | int tmp_id, tmp_manf; | ||
2232 | 2233 | ||
2233 | /* Select the device */ | 2234 | /* Select the device */ |
2234 | chip->select_chip(mtd, 0); | 2235 | chip->select_chip(mtd, 0); |
@@ -2240,6 +2241,26 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
2240 | *maf_id = chip->read_byte(mtd); | 2241 | *maf_id = chip->read_byte(mtd); |
2241 | dev_id = chip->read_byte(mtd); | 2242 | dev_id = chip->read_byte(mtd); |
2242 | 2243 | ||
2244 | /* Try again to make sure, as some systems the bus-hold or other | ||
2245 | * interface concerns can cause random data which looks like a | ||
2246 | * possibly credible NAND flash to appear. If the two results do | ||
2247 | * not match, ignore the device completely. | ||
2248 | */ | ||
2249 | |||
2250 | chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1); | ||
2251 | |||
2252 | /* Read manufacturer and device IDs */ | ||
2253 | |||
2254 | tmp_manf = chip->read_byte(mtd); | ||
2255 | tmp_id = chip->read_byte(mtd); | ||
2256 | |||
2257 | if (tmp_manf != *maf_id || tmp_id != dev_id) { | ||
2258 | printk(KERN_INFO "%s: second ID read did not match " | ||
2259 | "%02x,%02x against %02x,%02x\n", __func__, | ||
2260 | *maf_id, dev_id, tmp_manf, tmp_id); | ||
2261 | return ERR_PTR(-ENODEV); | ||
2262 | } | ||
2263 | |||
2243 | /* Lookup the flash id */ | 2264 | /* Lookup the flash id */ |
2244 | for (i = 0; nand_flash_ids[i].name != NULL; i++) { | 2265 | for (i = 0; nand_flash_ids[i].name != NULL; i++) { |
2245 | if (dev_id == nand_flash_ids[i].id) { | 2266 | if (dev_id == nand_flash_ids[i].id) { |