Skip to contentSkip to conversation

MVME2100 flash mapping patch - please review

PATCH Oliver Korpilla 2 participants 3 messages Apr 23, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello!

I patched my kernel.org 2.4.25 with an "older" release of mtd (file cfi_cmdset_0002.c is version 1.93 instead of 1.98, release was tagged mtd in CVS), and patched it with my patch as attached below this message.

This is my mtd-related output at booting:

Motorola MVME2100 flash device: 0x400000 at 0xff000000
Found: AMD AM29LV800BT
MVME2100 flash: Found 4 x16 devices at 0x0 in 32-bit mode number of JEDEC chips: 1
Creating 2 MTD partitions on "MVME2100 flash":
0x00000000-0x00100000 : "MVME2100 flash BOOT partition" 0x00100000-0x00400000 : "MVME2100 flash rootfs partition"

I got the following output when executing some commands on it:

/ # eraseall /dev/mtd0
Erasing 256 Kibyte @ 3c0000 -- 93 % complete.
/ # einfo /dev/mtd0
Device /dev/mtd0 has 4 erase regions
Region 0 is at 0x0 with size 0x40000 and has 0xf blocks Region 1 is at 0x3c0000 with size 0x20000 and has 0x1 blocks Region 2 is at 0x3e0000 with size 0x8000 and has 0x2 blocks Region 3 is at 0x3f0000 with size 0x10000 and has 0x1 blocks / # mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 4194304 (4M)
mtd.erasesize = 262144 (256K)
mtd.oobblock = 0
mtd.oobsize = 0
mtd.ecctype = MTD_ECC_NONE
regions = 4

region[0].offset = 0x00000000
region[0].erasesize = 262144 (256K)
region[0].numblocks = 15
region[0].regionindex = 0
region[1].offset = 0x003c0000
region[1].erasesize = 131072 (128K)
region[1].numblocks = 1
region[1].regionindex = 1
region[2].offset = 0x003e0000
region[2].erasesize = 32768 (32K)
region[2].numblocks = 2
region[2].regionindex = 2
region[3].offset = 0x003f0000
region[3].erasesize = 65536 (64K)
region[3].numblocks = 1
region[3].regionindex = 3

Please comment on the patch as found below! I'm a newbie to mtd, and to be honest: My job is getting the board work, not writing a good driver, so hopefully this will suffice. Hope I didn't screw up to badly.

I pasted it into the message, hope it'll work for you.

Thanks in advance,
Oliver Korpilla

Here the patch - vs kernel.org 2.4.25 patched with the MTD with release mtd - modelled after mbx860.c

drivers/mtd/maps/Config.in 2004-04-22 21:54:06.000000000 +0200 renamed from drivers/mtd/maps/Config.in 2004-04-22 22:04:32.000000000 +0200 +7 -2
diff -urN linux-2.4.25/drivers/mtd/maps/Config.in linux-2.4.25-mtd_patch/drivers/mtd/maps/Config.in
@@ -35,8 +35,13 @@
 fi
 
 if [ "$CONFIG_PPC32" = "y" ]; then
-  if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "y" ]; then
-    dep_tristate '  Flash device on SBC8240' CONFIG_MTD_SBC8240 $CONFIG_MTD_JEDECPROBE
+  if [ "$CONFIG_6xx" = "y" ]; then
+    if [ "$CONFIG_8260" = "y" ]; then
+      dep_tristate '  Flash device on SBC8240' CONFIG_MTD_SBC8240 $CONFIG_MTD_JEDECPROBE
+    fi
+    if [ "$CONFIG_MVME2100" = "y" ]; then
+      dep_tristate '  Flash device on MVME2100' CONFIG_MTD_MVME2100 $CONFIG_MTD_JEDECPROBE
+    fi
   fi
   if [ "$CONFIG_8xx" = "y" ]; then
     if [ "$CONFIG_TQM8xxL" = "y" ]; then
drivers/mtd/maps/Makefile 2004-04-22 21:54:06.000000000 +0200 renamed from drivers/mtd/maps/Makefile 2004-04-22 22:04:32.000000000 +0200 +1 -0
diff -urN linux-2.4.25/drivers/mtd/maps/Makefile linux-2.4.25-mtd_patch/drivers/mtd/maps/Makefile
@@ -63,6 +63,7 @@
 obj-$(CONFIG_MTD_ARCTIC)       += arctic-mtd.o
 obj-$(CONFIG_MTD_H720X)                += h720x-flash.o
 obj-$(CONFIG_MTD_SBC8240)      += sbc8240.o
+obj-$(CONFIG_MTD_MVME2100)     += mvme2100.o
 obj-$(CONFIG_MTD_NOR_TOTO)     += omap-toto-flash.o
 obj-$(CONFIG_MTD_MPC1211)      += mpc1211.o
 obj-$(CONFIG_MTD_IXP425)       += ixp425.o
drivers/mtd/maps/mvme2100.c 2004-04-22 21:54:06.000000000 +0200 renamed from drivers/mtd/maps/mvme2100.c 1970-01-01 01:00:00.000000000 +0100 +114 -0

114 lines not on this page · raw message

#1 lore raw
Quoted 1 line

cfi_cmdset_0002.c is version 1.93

If your flash chips support suspending erases then this version is broken. You'll need either 1.94 or 1.98.

David Vrabel

#2 lore raw
Quoted 4 lines · David Vrabel
Quoted 1 line

cfi_cmdset_0002.c is version 1.93

If your flash chips support suspending erases then this version is broken. You'll need either 1.94 or 1.98.

Thanks, I've tried now with both, 1.93 and 1.98, too:

When trying with my patch against the old revision, I get this:

/ # cat tmp/rootfs.jffs2.img > /dev/mtd2
MTD do_write_oneword(): FLASH internal timeout: 0x00200020 0x7aa6fe27 0x851901e0
cat: Write Error: Input/output error

/ # eraseall /dev/mtd2
Erasing 256 Kibyte @ 2c0000 -- 91 % complete.
/ # cat tmp/rootfs.jffs2.img > /dev/mtd2
MTD do_write_oneword(): FLASH internal timeout: 0x00200000 0xd4a70000 0x2b000000 / # mount -t jffs2 -o ro /dev/mtdblock2 tmp
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0x0100 instead jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0x0100 instead Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes empty_blocks 11, bad_blocks 0, c->nr_blocks 12
mount: Mounting /dev/mtdblock2 on /tmp failed: Invalid argument

When trying with the newest revision from CVS, I get this:

On boot:

Motorola MVME2100 flash device: 0x400000 at 0xff000000
Found: AMD AM29LV800BT
MVME2100 flash: Found 4 x16 devices at 0x0 in 32-bit mode number of JEDEC chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. Creating 2 MTD partitions on "MVME2100 flash":
0x00000000-0x00100000 : "MVME2100 flash BOOT partition" 0x00100000-0x00400000 : "MVME2100 flash rootfs partition"

When I try to use it:

/ # eraseall /dev/mtd2
Erasing 256 Kibyte @ 2c0000 -- 91 % complete.
/ # cat tmp/rootfs.jffs2.img > /dev/mtd2
MTD do_write_oneword(): software timeout
cat: Write Error: Input/output error
/ # mount -t jffs2 /dev/mtdblock2 /tmp
mountjffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0x0100 instead : /dev/mtdblock2jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0x0100 instead
is write-protected, mounting reCowardly refusing to erase blocks on
filesystem with no valid JFFS2 nodes
ad-only

empty_blocks 11, bad_blocks 0, c->nr_blocks 12
mount: Mounting /dev/mtdblock2 on /tmp failed: Invalid argument

The write error in cat is described as follows in /var/log/messages:

Apr 24 09:59:42 mvme2100 kern.warn klogd: MTD do_write_oneword(): software timeout

What am I doing wrong?

Thanks in advance,
Oliver Korpilla