Skip to content

Commit 0ea4a75

Browse files
Kyungmin ParkThomas Gleixner
authored andcommitted
[MTD] NAND: Early Manufacturer ID lookup
Move manufacturer ID search to display correct ID in case of buswidth mismatch. Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 88ec7c5 commit 0ea4a75

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎drivers/mtd/nand/nand_base.c‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
* The AG-AND chips have nice features for speed improvement,
6060
* which are not supported yet. Read / program 4 pages in one go.
6161
*
62-
* $Id: nand_base.c,v 1.132 2005/02/09 14:49:56 dedekind Exp $
62+
* $Id: nand_base.c,v 1.133 2005/02/16 09:39:35 gleixner Exp $
6363
*
6464
* This program is free software; you can redistribute it and/or modify
6565
* it under the terms of the GNU General Public License version 2 as
@@ -2276,7 +2276,7 @@ static int nand_block_markbad (struct mtd_info *mtd, loff_t ofs)
22762276
*/
22772277
int nand_scan (struct mtd_info *mtd, int maxchips)
22782278
{
2279-
int i, j, nand_maf_id, nand_dev_id, busw;
2279+
int i, j, nand_maf_id, nand_dev_id, busw, maf_id;
22802280
struct nand_chip *this = mtd->priv;
22812281

22822282
/* Get buswidth to select the correct functions*/
@@ -2364,12 +2364,18 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
23642364
busw = nand_flash_ids[i].options & NAND_BUSWIDTH_16;
23652365
}
23662366

2367+
/* Try to identify manufacturer */
2368+
for (maf_id = 0; nand_manuf_ids[maf_id].id != 0x0; maf_id++) {
2369+
if (nand_manuf_ids[maf_id].id == nand_maf_id)
2370+
break;
2371+
}
2372+
23672373
/* Check, if buswidth is correct. Hardware drivers should set
23682374
* this correct ! */
23692375
if (busw != (this->options & NAND_BUSWIDTH_16)) {
23702376
printk (KERN_INFO "NAND device: Manufacturer ID:"
23712377
" 0x%02x, Chip ID: 0x%02x (%s %s)\n", nand_maf_id, nand_dev_id,
2372-
nand_manuf_ids[i].name , mtd->name);
2378+
nand_manuf_ids[maf_id].name , mtd->name);
23732379
printk (KERN_WARNING
23742380
"NAND bus width %d instead %d bit\n",
23752381
(this->options & NAND_BUSWIDTH_16) ? 16 : 8,
@@ -2408,14 +2414,9 @@ int nand_scan (struct mtd_info *mtd, int maxchips)
24082414
if (mtd->oobblock > 512 && this->cmdfunc == nand_command)
24092415
this->cmdfunc = nand_command_lp;
24102416

2411-
/* Try to identify manufacturer */
2412-
for (j = 0; nand_manuf_ids[j].id != 0x0; j++) {
2413-
if (nand_manuf_ids[j].id == nand_maf_id)
2414-
break;
2415-
}
24162417
printk (KERN_INFO "NAND device: Manufacturer ID:"
24172418
" 0x%02x, Chip ID: 0x%02x (%s %s)\n", nand_maf_id, nand_dev_id,
2418-
nand_manuf_ids[j].name , nand_flash_ids[i].name);
2419+
nand_manuf_ids[maf_id].name , nand_flash_ids[i].name);
24192420
break;
24202421
}
24212422

‎drivers/mtd/nand/nand_ids.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (C) 2002 Thomas Gleixner (tglx@linutronix.de)
55
*
6-
* $Id: nand_ids.c,v 1.11 2005/01/17 18:26:27 dmarlin Exp $
6+
* $Id: nand_ids.c,v 1.12 2005/02/16 09:33:27 gleixner Exp $
77
*
88
* This program is free software; you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License version 2 as
@@ -62,8 +62,6 @@ struct nand_flash_dev nand_flash_ids[] = {
6262

6363
{"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0},
6464

65-
{"NAND 512MiB 3,3V 8-bit", 0xDC, 512, 512, 0x4000, 0},
66-
6765
/* These are the new chips with large page size. The pagesize
6866
* and the erasesize is determined from the extended id bytes
6967
*/

0 commit comments

Comments
 (0)