diff options
| author | Guillaume LECERF <glecerf@gmail.com> | 2010-04-24 11:58:22 -0400 |
|---|---|---|
| committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-13 20:39:23 -0400 |
| commit | 83dcd3bb1139060fedb15235f8614d2bac82e18d (patch) | |
| tree | f9edc12a8ff38a7b00763254d9afb1459e840e9f | |
| parent | 412da2f6e083eba6e4bd91ff2e78abb4735357a7 (diff) | |
mtd: cfi_cmdset_0002: add CFI detection for SST 39VF{16, 32}xx chips
SST 39VF{16,32}xx chips use the 0x0701 command set, fully compatible
with the AMD one. This patch adds support for detecting them in CFI
mode.
Signed-off-by: Guillaume LECERF <glecerf@gmail.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 35 | ||||
| -rw-r--r-- | drivers/mtd/chips/gen_probe.c | 1 |
2 files changed, 36 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index c27dd1c936cd..b7d821d61836 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
| @@ -258,6 +258,31 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param) | |||
| 258 | mtd->flags |= MTD_POWERUP_LOCK; | 258 | mtd->flags |= MTD_POWERUP_LOCK; |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | static void fixup_old_sst_eraseregion(struct mtd_info *mtd) | ||
| 262 | { | ||
| 263 | struct map_info *map = mtd->priv; | ||
| 264 | struct cfi_private *cfi = map->fldrv_priv; | ||
| 265 | |||
| 266 | /* | ||
| 267 | * These flashes report two seperate eraseblock regions based on the | ||
| 268 | * sector_erase-size and block_erase-size, although they both operate on the | ||
| 269 | * same memory. This is not allowed according to CFI, so we just pick the | ||
| 270 | * sector_erase-size. | ||
| 271 | */ | ||
| 272 | cfi->cfiq->NumEraseRegions = 1; | ||
| 273 | } | ||
| 274 | |||
| 275 | static void fixup_sst39vf(struct mtd_info *mtd, void *param) | ||
| 276 | { | ||
| 277 | struct map_info *map = mtd->priv; | ||
| 278 | struct cfi_private *cfi = map->fldrv_priv; | ||
| 279 | |||
| 280 | fixup_old_sst_eraseregion(mtd); | ||
| 281 | |||
| 282 | cfi->addr_unlock1 = 0x5555; | ||
| 283 | cfi->addr_unlock2 = 0x2AAA; | ||
| 284 | } | ||
| 285 | |||
| 261 | static void fixup_s29gl064n_sectors(struct mtd_info *mtd, void *param) | 286 | static void fixup_s29gl064n_sectors(struct mtd_info *mtd, void *param) |
| 262 | { | 287 | { |
| 263 | struct map_info *map = mtd->priv; | 288 | struct map_info *map = mtd->priv; |
| @@ -280,6 +305,15 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd, void *param) | |||
| 280 | } | 305 | } |
| 281 | } | 306 | } |
| 282 | 307 | ||
| 308 | /* Used to fix CFI-Tables of chips without Extended Query Tables */ | ||
| 309 | static struct cfi_fixup cfi_nopri_fixup_table[] = { | ||
| 310 | { CFI_MFR_SST, 0x234A, fixup_sst39vf, NULL, }, // SST39VF1602 | ||
| 311 | { CFI_MFR_SST, 0x234B, fixup_sst39vf, NULL, }, // SST39VF1601 | ||
| 312 | { CFI_MFR_SST, 0x235A, fixup_sst39vf, NULL, }, // SST39VF3202 | ||
| 313 | { CFI_MFR_SST, 0x235B, fixup_sst39vf, NULL, }, // SST39VF3201 | ||
| 314 | { 0, 0, NULL, NULL } | ||
| 315 | }; | ||
| 316 | |||
| 283 | static struct cfi_fixup cfi_fixup_table[] = { | 317 | static struct cfi_fixup cfi_fixup_table[] = { |
| 284 | { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL }, | 318 | { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL }, |
| 285 | #ifdef AMD_BOOTLOC_BUG | 319 | #ifdef AMD_BOOTLOC_BUG |
| @@ -413,6 +447,7 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary) | |||
| 413 | cfi->addr_unlock1 = 0x555; | 447 | cfi->addr_unlock1 = 0x555; |
| 414 | cfi->addr_unlock2 = 0x2aa; | 448 | cfi->addr_unlock2 = 0x2aa; |
| 415 | } | 449 | } |
| 450 | cfi_fixup(mtd, cfi_nopri_fixup_table); | ||
| 416 | 451 | ||
| 417 | if (!cfi->addr_unlock1 || !cfi->addr_unlock2) { | 452 | if (!cfi->addr_unlock1 || !cfi->addr_unlock2) { |
| 418 | kfree(mtd); | 453 | kfree(mtd); |
diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c index 1d56887c839b..75a8f9db8e4f 100644 --- a/drivers/mtd/chips/gen_probe.c +++ b/drivers/mtd/chips/gen_probe.c | |||
| @@ -248,6 +248,7 @@ static struct mtd_info *check_cmd_set(struct map_info *map, int primary) | |||
| 248 | #endif | 248 | #endif |
| 249 | #ifdef CONFIG_MTD_CFI_AMDSTD | 249 | #ifdef CONFIG_MTD_CFI_AMDSTD |
| 250 | case P_ID_AMD_STD: | 250 | case P_ID_AMD_STD: |
| 251 | case P_ID_SST_OLD: | ||
| 251 | return cfi_cmdset_0002(map, primary); | 252 | return cfi_cmdset_0002(map, primary); |
| 252 | #endif | 253 | #endif |
| 253 | #ifdef CONFIG_MTD_CFI_STAA | 254 | #ifdef CONFIG_MTD_CFI_STAA |
