diff options
| -rw-r--r-- | drivers/mtd/nand/nand_base.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index f159d5f184bf..ae9790b659b1 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -3087,6 +3087,30 @@ static void nand_decode_bbm_options(struct mtd_info *mtd, | |||
| 3087 | chip->bbt_options |= NAND_BBT_SCAN2NDPAGE; | 3087 | chip->bbt_options |= NAND_BBT_SCAN2NDPAGE; |
| 3088 | } | 3088 | } |
| 3089 | 3089 | ||
| 3090 | static inline bool is_full_id_nand(struct nand_flash_dev *type) | ||
| 3091 | { | ||
| 3092 | return type->id_len; | ||
| 3093 | } | ||
| 3094 | |||
| 3095 | static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 3096 | struct nand_flash_dev *type, u8 *id_data, int *busw) | ||
| 3097 | { | ||
| 3098 | if (!strncmp(type->id, id_data, type->id_len)) { | ||
| 3099 | mtd->writesize = type->pagesize; | ||
| 3100 | mtd->erasesize = type->erasesize; | ||
| 3101 | mtd->oobsize = type->oobsize; | ||
| 3102 | |||
| 3103 | chip->cellinfo = id_data[2]; | ||
| 3104 | chip->chipsize = (uint64_t)type->chipsize << 20; | ||
| 3105 | chip->options |= type->options; | ||
| 3106 | |||
| 3107 | *busw = type->options & NAND_BUSWIDTH_16; | ||
| 3108 | |||
| 3109 | return true; | ||
| 3110 | } | ||
| 3111 | return false; | ||
| 3112 | } | ||
| 3113 | |||
| 3090 | /* | 3114 | /* |
| 3091 | * Get the flash and manufacturer id and lookup if the type is supported. | 3115 | * Get the flash and manufacturer id and lookup if the type is supported. |
| 3092 | */ | 3116 | */ |
| @@ -3138,9 +3162,14 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, | |||
| 3138 | if (!type) | 3162 | if (!type) |
| 3139 | type = nand_flash_ids; | 3163 | type = nand_flash_ids; |
| 3140 | 3164 | ||
| 3141 | for (; type->name != NULL; type++) | 3165 | for (; type->name != NULL; type++) { |
| 3142 | if (*dev_id == type->dev_id) | 3166 | if (is_full_id_nand(type)) { |
| 3143 | break; | 3167 | if (find_full_id_nand(mtd, chip, type, id_data, &busw)) |
| 3168 | goto ident_done; | ||
| 3169 | } else if (*dev_id == type->dev_id) { | ||
| 3170 | break; | ||
| 3171 | } | ||
| 3172 | } | ||
| 3144 | 3173 | ||
| 3145 | chip->onfi_version = 0; | 3174 | chip->onfi_version = 0; |
| 3146 | if (!type->name || !type->pagesize) { | 3175 | if (!type->name || !type->pagesize) { |
