diff options
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 18 | ||||
| -rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 2 | ||||
| -rw-r--r-- | drivers/mtd/cmdlinepart.c | 9 | ||||
| -rw-r--r-- | drivers/mtd/mtdcore.c | 2 | ||||
| -rw-r--r-- | include/mtd/mtd-abi.h | 2 |
5 files changed, 23 insertions, 10 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 350671ec5226..8189adfefaef 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
| @@ -269,10 +269,16 @@ static void fixup_use_write_buffers(struct mtd_info *mtd, void *param) | |||
| 269 | /* | 269 | /* |
| 270 | * Some chips power-up with all sectors locked by default. | 270 | * Some chips power-up with all sectors locked by default. |
| 271 | */ | 271 | */ |
| 272 | static void fixup_use_powerup_lock(struct mtd_info *mtd, void *param) | 272 | static void fixup_unlock_powerup_lock(struct mtd_info *mtd, void *param) |
| 273 | { | 273 | { |
| 274 | printk(KERN_INFO "Using auto-unlock on power-up/resume\n" ); | 274 | struct map_info *map = mtd->priv; |
| 275 | mtd->flags |= MTD_STUPID_LOCK; | 275 | struct cfi_private *cfi = map->fldrv_priv; |
| 276 | struct cfi_pri_intelext *cfip = cfi->cmdset_priv; | ||
| 277 | |||
| 278 | if (cfip->FeatureSupport&32) { | ||
| 279 | printk(KERN_INFO "Using auto-unlock on power-up/resume\n" ); | ||
| 280 | mtd->flags |= MTD_POWERUP_LOCK; | ||
| 281 | } | ||
| 276 | } | 282 | } |
| 277 | 283 | ||
| 278 | static struct cfi_fixup cfi_fixup_table[] = { | 284 | static struct cfi_fixup cfi_fixup_table[] = { |
| @@ -288,7 +294,7 @@ static struct cfi_fixup cfi_fixup_table[] = { | |||
| 288 | #endif | 294 | #endif |
| 289 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct, NULL }, | 295 | { CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct, NULL }, |
| 290 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb, NULL }, | 296 | { CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb, NULL }, |
| 291 | { MANUFACTURER_INTEL, 0x891c, fixup_use_powerup_lock, NULL, }, | 297 | { MANUFACTURER_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock, NULL, }, |
| 292 | { 0, 0, NULL, NULL } | 298 | { 0, 0, NULL, NULL } |
| 293 | }; | 299 | }; |
| 294 | 300 | ||
| @@ -2349,7 +2355,7 @@ static int cfi_intelext_suspend(struct mtd_info *mtd) | |||
| 2349 | struct flchip *chip; | 2355 | struct flchip *chip; |
| 2350 | int ret = 0; | 2356 | int ret = 0; |
| 2351 | 2357 | ||
| 2352 | if ((mtd->flags & MTD_STUPID_LOCK) | 2358 | if ((mtd->flags & MTD_POWERUP_LOCK) |
| 2353 | && extp && (extp->FeatureSupport & (1 << 5))) | 2359 | && extp && (extp->FeatureSupport & (1 << 5))) |
| 2354 | cfi_intelext_save_locks(mtd); | 2360 | cfi_intelext_save_locks(mtd); |
| 2355 | 2361 | ||
| @@ -2460,7 +2466,7 @@ static void cfi_intelext_resume(struct mtd_info *mtd) | |||
| 2460 | spin_unlock(chip->mutex); | 2466 | spin_unlock(chip->mutex); |
| 2461 | } | 2467 | } |
| 2462 | 2468 | ||
| 2463 | if ((mtd->flags & MTD_STUPID_LOCK) | 2469 | if ((mtd->flags & MTD_POWERUP_LOCK) |
| 2464 | && extp && (extp->FeatureSupport & (1 << 5))) | 2470 | && extp && (extp->FeatureSupport & (1 << 5))) |
| 2465 | cfi_intelext_restore_locks(mtd); | 2471 | cfi_intelext_restore_locks(mtd); |
| 2466 | } | 2472 | } |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 796bfeadea21..d072e87ce4e2 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
| @@ -217,7 +217,7 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param) | |||
| 217 | { | 217 | { |
| 218 | mtd->lock = cfi_atmel_lock; | 218 | mtd->lock = cfi_atmel_lock; |
| 219 | mtd->unlock = cfi_atmel_unlock; | 219 | mtd->unlock = cfi_atmel_unlock; |
| 220 | mtd->flags |= MTD_STUPID_LOCK; | 220 | mtd->flags |= MTD_POWERUP_LOCK; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | static struct cfi_fixup cfi_fixup_table[] = { | 223 | static struct cfi_fixup cfi_fixup_table[] = { |
diff --git a/drivers/mtd/cmdlinepart.c b/drivers/mtd/cmdlinepart.c index 23fab14f1637..b44292abd9f7 100644 --- a/drivers/mtd/cmdlinepart.c +++ b/drivers/mtd/cmdlinepart.c | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | * | 9 | * |
| 10 | * mtdparts=<mtddef>[;<mtddef] | 10 | * mtdparts=<mtddef>[;<mtddef] |
| 11 | * <mtddef> := <mtd-id>:<partdef>[,<partdef>] | 11 | * <mtddef> := <mtd-id>:<partdef>[,<partdef>] |
| 12 | * <partdef> := <size>[@offset][<name>][ro] | 12 | * <partdef> := <size>[@offset][<name>][ro][lk] |
| 13 | * <mtd-id> := unique name used in mapping driver/device (mtd->name) | 13 | * <mtd-id> := unique name used in mapping driver/device (mtd->name) |
| 14 | * <size> := standard linux memsize OR "-" to denote all remaining space | 14 | * <size> := standard linux memsize OR "-" to denote all remaining space |
| 15 | * <name> := '(' NAME ')' | 15 | * <name> := '(' NAME ')' |
| @@ -143,6 +143,13 @@ static struct mtd_partition * newpart(char *s, | |||
| 143 | s += 2; | 143 | s += 2; |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | /* if lk is found do NOT unlock the MTD partition*/ | ||
| 147 | if (strncmp(s, "lk", 2) == 0) | ||
| 148 | { | ||
| 149 | mask_flags |= MTD_POWERUP_LOCK; | ||
| 150 | s += 2; | ||
| 151 | } | ||
| 152 | |||
| 146 | /* test if more partitions are following */ | 153 | /* test if more partitions are following */ |
| 147 | if (*s == ',') | 154 | if (*s == ',') |
| 148 | { | 155 | { |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 6c2645e28371..f7e7890e5bc6 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
| @@ -61,7 +61,7 @@ int add_mtd_device(struct mtd_info *mtd) | |||
| 61 | 61 | ||
| 62 | /* Some chips always power up locked. Unlock them now */ | 62 | /* Some chips always power up locked. Unlock them now */ |
| 63 | if ((mtd->flags & MTD_WRITEABLE) | 63 | if ((mtd->flags & MTD_WRITEABLE) |
| 64 | && (mtd->flags & MTD_STUPID_LOCK) && mtd->unlock) { | 64 | && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) { |
| 65 | if (mtd->unlock(mtd, 0, mtd->size)) | 65 | if (mtd->unlock(mtd, 0, mtd->size)) |
| 66 | printk(KERN_WARNING | 66 | printk(KERN_WARNING |
| 67 | "%s: unlock failed, " | 67 | "%s: unlock failed, " |
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index f71dac420394..615072c4da04 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
| @@ -29,7 +29,7 @@ struct mtd_oob_buf { | |||
| 29 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ | 29 | #define MTD_WRITEABLE 0x400 /* Device is writeable */ |
| 30 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ | 30 | #define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ |
| 31 | #define MTD_NO_ERASE 0x1000 /* No erase necessary */ | 31 | #define MTD_NO_ERASE 0x1000 /* No erase necessary */ |
| 32 | #define MTD_STUPID_LOCK 0x2000 /* Always locked after reset */ | 32 | #define MTD_POWERUP_LOCK 0x2000 /* Always locked after reset */ |
| 33 | 33 | ||
| 34 | // Some common devices / combinations of capabilities | 34 | // Some common devices / combinations of capabilities |
| 35 | #define MTD_CAP_ROM 0 | 35 | #define MTD_CAP_ROM 0 |
