OpenWrt Forum Archive

Topic: Add Macronix mx25l12805d flash support to 2.6.30, kirkwood (patch)

The content of this topic has been archived on 11 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I'm trying to porting 2.6.30 kernel on Kirkwood with a board which might not be support currently.
I've encountered some problem about flash driver.
Although I found the flash ID is new to Kirkwood (Macronix mx25l12805d), I still have problem when mount root.jffs2/root.squashfs

Could someone give some suggestion on this circumstance?

The following is the patch file I made.
cat 005-m25p80.patch
---------------------------------patch file starts-----------------------------
--- drivers/mtd/devices/m25p80.c        2009-06-10 11:05:27.000000000 +0800
+++ drivers/mtd/devices/m25p80.c.new    2009-06-19 18:31:21.000000000 +0800
@@ -500,6 +500,9 @@
        { "at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },
        { "at26df321",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },

+       /* Macronix */
+       { "mx25l12805d", 0xc22018, 0, 64 * 1024, 256, },
+
        /* Spansion -- single (large) sector size only, at least
         * for the chips listed here (without boot sectors).
         */
---------------------------------patch file end-----------------------------


I've done some modification to default kernel config which the diff file is following:

--- config-default.openwrt  2009-06-04 17:37:47.000000000 +0800
+++ config-default.new      2009-06-19 17:53:53.000000000 +0800
-CONFIG_CMDLINE="rootdelay=1 root=/dev/mmcblk0p1 noinitrd console=ttyS0,115200"
+CONFIG_CMDLINE="root=/dev/mtdblock2 rw console=ttyS0,115200"
+CONFIG_SPI=y
+CONFIG_SPI_MASTER=y
+CONFIG_SPI_ORION=y
-CONFIG_MACH_SHEEVAPLUG=y
+# CONFIG_MACH_SHEEVAPLUG is not set
+CONFIG_MACH_XXXXXXXXX=y
+CONFIG_PLAT_ORION=y
-# CONFIG_MTD_CFI is not set
-CONFIG_MTD_NAND_ORION=y
-CONFIG_MTD_NAND=y
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_NAND_ORION is not set (Whether I enabled the NAND_ORION I get the same result, my flash device should be a NOR flash)
+# CONFIG_MTD_NAND is not set
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_M25P80=y
+CONFIG_M25PXX_USE_FAST_READ=y
CONFIG_MV643XX_ETH=y
# CONFIG_NATSEMI is not set
# CONFIG_NET_DSA_MV88E6060 is not set

And the boot log is:
## Booting image at 06400000 ...
   Image Name:   Linux-2.6.30
   Created:      2009-06-19  10:05:11 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    938960 Bytes = 917 kB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux.............................................................................................. done, booting the kernel.
Linux version 2.6.30
CPU: Feroceon 88FRXXX [56251311] revision 1 (ARMv5TE), cr=000XXXXX
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyS0,115200 mtdparts=spi0.0:1m(uboot),2m(kernel),6m(rootfs) root=/dev/mtdblock2 rw rootfstype=squashfs,jffs2
NR_IRQS:114
PID hash table entries: 512 (order: 9, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 127232KB available (2268K code, 161K data, 96K init, 0K highmem)
Calibrating delay loop... 992.87 BogoMIPS (lpj=4964352)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 528 bytes
NET: Registered protocol family 16
Kirkwood: MV88F6281-A0, TCLK=200000000.
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
PCI: bus0: Fast back to back transfers disabled
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
squashfs: version 4.0 (2009/01/31) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (SUMMARY)  ? 2001-2006 Red Hat, Inc.
msgmni has been set to 248
alg: No test for lzma (lzma-generic)
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler deadline registered (default)
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
net eth0: port 0 with MAC address 00:50:43:9b:9e:08
m25p80 spi0.0: mx25l12805d (16384 Kbytes)
3 cmdlinepart partitions found on MTD device spi0.0
Creating 3 MTD partitions on "spi0.0":
0x000000000000-0x000000100000 : "uboot"
0x000000100000-0x000000300000 : "kernel"
0x000000300000-0x000000900000 : "rootfs"
rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
i2c /dev entries driver
cpuidle: using governor ladder
TCP westwood registered
NET: Registered protocol family 17
Distributed Switch Architecture driver version 0.1
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
rtc-mv rtc-mv: setting system clock to 2021-10-09 02:12:10 UTC (1633745530)
Node at 0x0000fd48 with length 0x000009bc would run over the end of the erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000fd4c: 0x09bc instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000fd50: 0xfeda instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000fd54: 0x0011 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000fd58: 0x001a instead

(Last edited by macpaul on 19 Jun 2009, 12:22)

Hello,

I think you are using wrong erase parameter for building jffs image. Try -e 65536 as erase size for building image.


Thanks
max

The discussion might have continued from here.