diff options
author | Justin Treon <justin_treon@yahoo.com> | 2008-01-30 13:25:49 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-02-03 02:25:16 -0500 |
commit | e619a75ff6201b567a539e787aa9af9bc63a3187 (patch) | |
tree | f13113ce617958181d5cd6b2c56ae9f7b87d0014 /drivers/mtd/chips | |
parent | 842b1a105c95d22c3e4257879539413d3152629e (diff) |
[MTD] Unlocking all Intel flash that is locked on power up.
Patch for unlocking all Intel flash that has instant locking on power up.
The patch has been tested on Intel M18, P30 and J3D Strata Flash.
1. The automatic unlocking can be disabled for a particular partition
in the map or the command line.
a. For the bit mask in the map it should look like:
.mask_flags = MTD_POWERUP_LOCK,
b. For the command line parsing it should look like:
mtdparts=0x80000(bootloader)lk
2. This will only unlock parts with instant individual block locking.
Intel parts with legacy unlocking will not be unlocked.
Signed-off-by: Justin Treon <justin_treon@yahoo.com>
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 18 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 2 |
2 files changed, 13 insertions, 7 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[] = { |