Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374779
b: refs/heads/master
c: ec6e87e
h: refs/heads/master
i:
  374777: 3660f10
  374775: 049285a
v: v3
  • Loading branch information
Huang Shijie authored and David Woodhouse committed Apr 5, 2013
1 parent cb59152 commit 5a1afd1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f22d5f638b0ea40e7cceb4639a608bd2c3eff97c
refs/heads/master: ec6e87e378e209fda3eb4dfdf3c6164afb5cc7f5
35 changes: 32 additions & 3 deletions trunk/drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3087,6 +3087,30 @@ static void nand_decode_bbm_options(struct mtd_info *mtd,
chip->bbt_options |= NAND_BBT_SCAN2NDPAGE;
}

static inline bool is_full_id_nand(struct nand_flash_dev *type)
{
return type->id_len;
}

static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
struct nand_flash_dev *type, u8 *id_data, int *busw)
{
if (!strncmp(type->id, id_data, type->id_len)) {
mtd->writesize = type->pagesize;
mtd->erasesize = type->erasesize;
mtd->oobsize = type->oobsize;

chip->cellinfo = id_data[2];
chip->chipsize = (uint64_t)type->chipsize << 20;
chip->options |= type->options;

*busw = type->options & NAND_BUSWIDTH_16;

return true;
}
return false;
}

/*
* Get the flash and manufacturer id and lookup if the type is supported.
*/
Expand Down Expand Up @@ -3138,9 +3162,14 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
if (!type)
type = nand_flash_ids;

for (; type->name != NULL; type++)
if (*dev_id == type->dev_id)
break;
for (; type->name != NULL; type++) {
if (is_full_id_nand(type)) {
if (find_full_id_nand(mtd, chip, type, id_data, &busw))
goto ident_done;
} else if (*dev_id == type->dev_id) {
break;
}
}

chip->onfi_version = 0;
if (!type->name || !type->pagesize) {
Expand Down

0 comments on commit 5a1afd1

Please sign in to comment.