Skip to content

Commit a8e98d6

Browse files
author
Linus Torvalds
committed
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits) [MTD] Fix mtdoops.c compilation [MTD] [NOR] fix startup lock when using multiple nor flash chips [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true [MTD] Fix maps/physmap.c compilation with CONFIG_PM [MTD] onenand: Add panic_write function to the onenand driver [MTD] mtdoops: Use the panic_write function when present [MTD] Add mtd panic_write function pointer [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support. [MTD] physmap.c: Add support for multiple resources [MTD] [NAND] Fix misparenthesization introduced by commit 78b6517... [MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes [MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver [MTD] [NAND] Remove unused variable in plat_nand_remove [MTD] Unlocking all Intel flash that is locked on power up. [MTD] [NAND] at91_nand: Make mtdparts option can override board info [MTD] mtdoops: Various minor cleanups [MTD] mtdoops: Ensure sequential write to the buffer [MTD] mtdoops: Perform write operations in a workqueue [MTD] mtdoops: Add further error return code checking [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c ...
2 parents f0f1b33 + f9f7dd2 commit a8e98d6

66 files changed

Lines changed: 4848 additions & 2085 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/mtd/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ config MTD_AFS_PARTS
150150
for your particular device. It won't happen automatically. The
151151
'armflash' map driver (CONFIG_MTD_ARMFLASH) does this, for example.
152152

153+
config MTD_OF_PARTS
154+
tristate "Flash partition map based on OF description"
155+
depends on PPC_OF && MTD_PARTITIONS
156+
help
157+
This provides a partition parsing function which derives
158+
the partition map from the children of the flash node,
159+
as described in Documentation/powerpc/booting-without-of.txt.
160+
153161
comment "User Modules And Translation Layers"
154162

155163
config MTD_CHAR
@@ -286,6 +294,9 @@ config MTD_OOPS
286294
buffer in a flash partition where it can be read back at some
287295
later point.
288296

297+
To use, add console=ttyMTDx to the kernel command line,
298+
where x is the MTD device number to use.
299+
289300
source "drivers/mtd/chips/Kconfig"
290301

291302
source "drivers/mtd/maps/Kconfig"

‎drivers/mtd/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
1111
obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
1212
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
1313
obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
14+
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
1415

1516
# 'Users' - code which presents functionality to userspace.
1617
obj-$(CONFIG_MTD_CHAR) += mtdchar.o

‎drivers/mtd/chips/cfi_cmdset_0001.c‎

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#define I82802AC 0x00ac
5151
#define MANUFACTURER_ST 0x0020
5252
#define M50LPW080 0x002F
53+
#define AT49BV640D 0x02de
5354

5455
static int cfi_intelext_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
5556
static int cfi_intelext_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
@@ -157,6 +158,47 @@ static void cfi_tell_features(struct cfi_pri_intelext *extp)
157158
}
158159
#endif
159160

161+
/* Atmel chips don't use the same PRI format as Intel chips */
162+
static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
163+
{
164+
struct map_info *map = mtd->priv;
165+
struct cfi_private *cfi = map->fldrv_priv;
166+
struct cfi_pri_intelext *extp = cfi->cmdset_priv;
167+
struct cfi_pri_atmel atmel_pri;
168+
uint32_t features = 0;
169+
170+
/* Reverse byteswapping */
171+
extp->FeatureSupport = cpu_to_le32(extp->FeatureSupport);
172+
extp->BlkStatusRegMask = cpu_to_le16(extp->BlkStatusRegMask);
173+
extp->ProtRegAddr = cpu_to_le16(extp->ProtRegAddr);
174+
175+
memcpy(&atmel_pri, extp, sizeof(atmel_pri));
176+
memset((char *)extp + 5, 0, sizeof(*extp) - 5);
177+
178+
printk(KERN_ERR "atmel Features: %02x\n", atmel_pri.Features);
179+
180+
if (atmel_pri.Features & 0x01) /* chip erase supported */
181+
features |= (1<<0);
182+
if (atmel_pri.Features & 0x02) /* erase suspend supported */
183+
features |= (1<<1);
184+
if (atmel_pri.Features & 0x04) /* program suspend supported */
185+
features |= (1<<2);
186+
if (atmel_pri.Features & 0x08) /* simultaneous operations supported */
187+
features |= (1<<9);
188+
if (atmel_pri.Features & 0x20) /* page mode read supported */
189+
features |= (1<<7);
190+
if (atmel_pri.Features & 0x40) /* queued erase supported */
191+
features |= (1<<4);
192+
if (atmel_pri.Features & 0x80) /* Protection bits supported */
193+
features |= (1<<6);
194+
195+
extp->FeatureSupport = features;
196+
197+
/* burst write mode not supported */
198+
cfi->cfiq->BufWriteTimeoutTyp = 0;
199+
cfi->cfiq->BufWriteTimeoutMax = 0;
200+
}
201+
160202
#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
161203
/* Some Intel Strata Flash prior to FPO revision C has bugs in this area */
162204
static void fixup_intel_strataflash(struct mtd_info *mtd, void* param)
@@ -227,13 +269,20 @@ static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
227269
/*
228270
* Some chips power-up with all sectors locked by default.
229271
*/
230-
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)
231273
{
232-
printk(KERN_INFO "Using auto-unlock on power-up/resume\n" );
233-
mtd->flags |= MTD_STUPID_LOCK;
274+
struct map_info *map = mtd->priv;
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+
}
234282
}
235283

236284
static struct cfi_fixup cfi_fixup_table[] = {
285+
{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
237286
#ifdef CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE
238287
{ CFI_MFR_ANY, CFI_ID_ANY, fixup_intel_strataflash, NULL },
239288
#endif
@@ -245,7 +294,7 @@ static struct cfi_fixup cfi_fixup_table[] = {
245294
#endif
246295
{ CFI_MFR_ST, 0x00ba, /* M28W320CT */ fixup_st_m28w320ct, NULL },
247296
{ CFI_MFR_ST, 0x00bb, /* M28W320CB */ fixup_st_m28w320cb, NULL },
248-
{ MANUFACTURER_INTEL, 0x891c, fixup_use_powerup_lock, NULL, },
297+
{ MANUFACTURER_INTEL, CFI_ID_ANY, fixup_unlock_powerup_lock, NULL, },
249298
{ 0, 0, NULL, NULL }
250299
};
251300

@@ -277,7 +326,7 @@ read_pri_intelext(struct map_info *map, __u16 adr)
277326
return NULL;
278327

279328
if (extp->MajorVersion != '1' ||
280-
(extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
329+
(extp->MinorVersion < '0' || extp->MinorVersion > '5')) {
281330
printk(KERN_ERR " Unknown Intel/Sharp Extended Query "
282331
"version %c.%c.\n", extp->MajorVersion,
283332
extp->MinorVersion);
@@ -752,6 +801,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
752801
static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode)
753802
{
754803
int ret;
804+
DECLARE_WAITQUEUE(wait, current);
755805

756806
retry:
757807
if (chip->priv && (mode == FL_WRITING || mode == FL_ERASING
@@ -808,6 +858,20 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
808858
spin_unlock(contender->mutex);
809859
}
810860

861+
/* Check if we already have suspended erase
862+
* on this chip. Sleep. */
863+
if (mode == FL_ERASING && shared->erasing
864+
&& shared->erasing->oldstate == FL_ERASING) {
865+
spin_unlock(&shared->lock);
866+
set_current_state(TASK_UNINTERRUPTIBLE);
867+
add_wait_queue(&chip->wq, &wait);
868+
spin_unlock(chip->mutex);
869+
schedule();
870+
remove_wait_queue(&chip->wq, &wait);
871+
spin_lock(chip->mutex);
872+
goto retry;
873+
}
874+
811875
/* We now own it */
812876
shared->writing = chip;
813877
if (mode == FL_ERASING)
@@ -2294,7 +2358,7 @@ static int cfi_intelext_suspend(struct mtd_info *mtd)
22942358
struct flchip *chip;
22952359
int ret = 0;
22962360

2297-
if ((mtd->flags & MTD_STUPID_LOCK)
2361+
if ((mtd->flags & MTD_POWERUP_LOCK)
22982362
&& extp && (extp->FeatureSupport & (1 << 5)))
22992363
cfi_intelext_save_locks(mtd);
23002364

@@ -2405,7 +2469,7 @@ static void cfi_intelext_resume(struct mtd_info *mtd)
24052469
spin_unlock(chip->mutex);
24062470
}
24072471

2408-
if ((mtd->flags & MTD_STUPID_LOCK)
2472+
if ((mtd->flags & MTD_POWERUP_LOCK)
24092473
&& extp && (extp->FeatureSupport & (1 << 5)))
24102474
cfi_intelext_restore_locks(mtd);
24112475
}

‎drivers/mtd/chips/cfi_cmdset_0002.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
185185
extp->TopBottom = 2;
186186
else
187187
extp->TopBottom = 3;
188+
189+
/* burst write mode not supported */
190+
cfi->cfiq->BufWriteTimeoutTyp = 0;
191+
cfi->cfiq->BufWriteTimeoutMax = 0;
188192
}
189193

190194
static void fixup_use_secsi(struct mtd_info *mtd, void *param)
@@ -213,10 +217,11 @@ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
213217
{
214218
mtd->lock = cfi_atmel_lock;
215219
mtd->unlock = cfi_atmel_unlock;
216-
mtd->flags |= MTD_STUPID_LOCK;
220+
mtd->flags |= MTD_POWERUP_LOCK;
217221
}
218222

219223
static struct cfi_fixup cfi_fixup_table[] = {
224+
{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
220225
#ifdef AMD_BOOTLOC_BUG
221226
{ CFI_MFR_AMD, CFI_ID_ANY, fixup_amd_bootblock, NULL },
222227
#endif
@@ -229,7 +234,6 @@ static struct cfi_fixup cfi_fixup_table[] = {
229234
#if !FORCE_WORD_WRITE
230235
{ CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, },
231236
#endif
232-
{ CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL },
233237
{ 0, 0, NULL, NULL }
234238
};
235239
static struct cfi_fixup jedec_fixup_table[] = {
@@ -338,10 +342,12 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
338342
/* Modify the unlock address if we are in compatibility mode */
339343
if ( /* x16 in x8 mode */
340344
((cfi->device_type == CFI_DEVICETYPE_X8) &&
341-
(cfi->cfiq->InterfaceDesc == 2)) ||
345+
(cfi->cfiq->InterfaceDesc ==
346+
CFI_INTERFACE_X8_BY_X16_ASYNC)) ||
342347
/* x32 in x16 mode */
343348
((cfi->device_type == CFI_DEVICETYPE_X16) &&
344-
(cfi->cfiq->InterfaceDesc == 4)))
349+
(cfi->cfiq->InterfaceDesc ==
350+
CFI_INTERFACE_X16_BY_X32_ASYNC)))
345351
{
346352
cfi->addr_unlock1 = 0xaaa;
347353
cfi->addr_unlock2 = 0x555;

‎drivers/mtd/chips/cfi_probe.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,27 +370,27 @@ static void print_cfi_ident(struct cfi_ident *cfip)
370370
printk("Device size: 0x%X bytes (%d MiB)\n", 1 << cfip->DevSize, 1<< (cfip->DevSize - 20));
371371
printk("Flash Device Interface description: 0x%4.4X\n", cfip->InterfaceDesc);
372372
switch(cfip->InterfaceDesc) {
373-
case 0:
373+
case CFI_INTERFACE_X8_ASYNC:
374374
printk(" - x8-only asynchronous interface\n");
375375
break;
376376

377-
case 1:
377+
case CFI_INTERFACE_X16_ASYNC:
378378
printk(" - x16-only asynchronous interface\n");
379379
break;
380380

381-
case 2:
381+
case CFI_INTERFACE_X8_BY_X16_ASYNC:
382382
printk(" - supports x8 and x16 via BYTE# with asynchronous interface\n");
383383
break;
384384

385-
case 3:
385+
case CFI_INTERFACE_X32_ASYNC:
386386
printk(" - x32-only asynchronous interface\n");
387387
break;
388388

389-
case 4:
389+
case CFI_INTERFACE_X16_BY_X32_ASYNC:
390390
printk(" - supports x16 and x32 via Word# with asynchronous interface\n");
391391
break;
392392

393-
case 65535:
393+
case CFI_INTERFACE_NOT_ALLOWED:
394394
printk(" - Not Allowed / Reserved\n");
395395
break;
396396

‎drivers/mtd/chips/gen_probe.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
112112
max_chips = 1;
113113
}
114114

115-
mapsize = (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG;
115+
mapsize = sizeof(long) * ( (max_chips + BITS_PER_LONG-1) / BITS_PER_LONG );
116116
chip_map = kzalloc(mapsize, GFP_KERNEL);
117117
if (!chip_map) {
118118
printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);

0 commit comments

Comments
 (0)