Skip to contentSkip to conversation

JFFS2 FS not writeable

DISCUSSION Ron Madrid 3 participants 10 messages May 22, 2008 – May 29, 2008

lore
Share & tools
lore

Ron Madrid

author
#0 lore raw

I'm trying to make new directories, create files, save changes to files, etc. and when I reboot my changes are not being saved. I'm sorry if this is vague, but I haven't run into this problem before in previous kernels. I'm using 2.6.25 and my configuration is very similar to mpc8313erdb_defconfig, with changes to include NAND support as my flash device is a NAND. Also, my dts is very similar to mpc8313erdb.dts as well. I don't know where to start looking for the problem as there is no error. Here is what is printed on boot.

## Booting kernel from Legacy Image at 00500000 ...

   Image Name:   Linux-2.6.25
   Created:      2008-05-22  20:17:02 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip

compressed)
Data Size: 1783834 Bytes = 1.7 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
## Flattened Device Tree blob at 007e0000
Booting using the fdt blob at 0x7e0000
Using MPC831x RDB machine description
Linux version 2.6.25 ([email protected]) (gcc version 4.0.0 (DENX ELDK
4.1 4.0.0)) #6 Thu May 22 13:17:01 PDT 2008 console [udbg0] enabled
setup_arch: bootmem
mpc831x_rdb_setup_arch()
arch: exit
Zone PFN ranges:
DMA 0 -> 131072
Normal 131072 -> 131072
Movable zone start PFN for each node early_node_map[1] active PFN ranges

    0:        0 ->   131072

Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 130048
Kernel command line: root=/dev/mtdblock2 rootfstype=jffs2 rw console=ttyS0,115200
IPIC (128 IRQ sources) at fdffb700
PID hash table entries: 2048 (order: 11, 8192 bytes)
clocksource: timebase mult[7800001] shift[22] registered
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 515584k/524288k available (3484k kernel code, 8252k reserved, 132k data, 92k bss, 152k init)
SLUB: Genslabs=12, HWalign=32, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
Mount-cache hash table entries: 512
net_namespace: 152 bytes
NET: Registered protocol family 16

SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4,
65536 bytes)
TCP established hash table entries: 65536 (order: 7,
524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144
bytes)
TCP: Hash tables configured (established 65536 bind
65536)
TCP reno registered
NTFS driver 2.1.29 [Flags: R/O].
JFFS2 version 2.2. (NAND) .. 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports,
IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 18) is a
16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 21) is a
16550A
brd: module loaded
loop: module loaded
Gianfar MII Bus: probed
eth0: Gianfar Ethernet Controller Version 1.2,
00:e0:0c:00:95:01
eth0: Running with NAPI enabled
eth0: 256/256 RX/TX BD ring size
eth1: Gianfar Ethernet Controller Version 1.2,
00:00:00:00:00:00
eth1: Running with NAPI enabled
eth1: 256/256 RX/TX BD ring size
Driver 'sd' needs updating - please use bus_type
methods
Freescale eLBC NAND Driver (C) 2006 Freescale - Ron!
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda
(Micron NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 821 at 0x066a0000
Bad eraseblock 1765 at 0x0dca0000
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x00000000-0x00100000 : "u-boot"
0x00100000-0x00400000 : "kernel"
0x00400000-0x02000000 : "fs"
eLBC NAND device at 0xe2800000, bank 0
usbmon: debugfs is not available
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host
Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned
bus number 1
fsl-ehci fsl-ehci.0: irq 38, io base 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00,
driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Freescale High-Speed USB SOC Device Controller driver
(Apr 20, 2007)
i2c /dev entries driver
rtc-ds1307: probe of 0-0068 failed with error -5
WDT driver for MPC83xx initialized. mode:reset
timeout=65535 (32 seconds)
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
/root/Desktop/linux-2.6.25/drivers/rtc/hctosys.c:
unable to open rtc device (rtc0)
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
VFS: Mounted root (jffs2 filesystem).
Freeing unused kernel memory: 152k init
Setting the hostname to freescale
Mounting filesystems
Running sysctl
Setting up networking on loopback device:
Setting up networking on eth0:
Adding static route for default gateway to
10.196.31.1:
Setting nameserver to 10.196.31.1 in /etc/resolv.conf:
Starting inetd:
Generating keys for the dropbear ssh server:
Will output 1024 bit rsa secret key to
'/etc/dropbear/dropbear_rsa_host_key'
Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwC/UlHirLLkjIKsXFpy4Glx6f3y1mOYU9tCTjs94bxVb1gzQXfNBdUKOc2GXFPT91pqXhesVl6wRtKUuvwqfXjYtAatIxBF3c4dO9ZBnp7B2B1C3T3g3dbv7Ah9NtB+s3d55mI8Z3ml2fMxQI6gtCbda8ZjzZiUcwNXZ2JOcMv4YaEx
Fingerprint: md5
21:aa:fd:a2:cc:53:ba:fd:e3:e9:86:3d:90:c7:9b:22
Starting the dropbear ssh server:

I see this when rebooting

/ # reboot
/ # Stopping the dropbear ssh server:
Stopping inetd:
Unmounting filesystems
The system is going down NOW !!
Sending SIGTERM to all processes.
Please stand by while rebooting the system.
md: stopping all md devices.
Restarting system.

Thank you,
Ron Madrid

#1 lore raw
Quoted 10 lines · Ron Madrid

I'm trying to make new directories, create files, save
changes to files, etc. and when I reboot my changes
are not being saved. I'm sorry if this is vague, but
I haven't run into this problem before in previous
kernels. I'm using 2.6.25 and my configuration is
very similar to mpc8313erdb_defconfig, with changes to
include NAND support as my flash device is a NAND. Also, my dts is very similar to mpc8313erdb.dts as well. I don't know where to start looking for the
problem as there is no error. Here is what is printed
on boot.

Try head-of-tree; there have been several fixes to the eLBC FCM NAND driver.

-Scott

author
#2 lore raw

I have tried the latest code and now, I'm able to write a limited amount. After which when I reboot, more than 100 contiguous blocks have been marked bad, through the end of the device (according to the dts). Is this something that has been seen before? My NAND device is a large page.

Ron

Quoted 24 lines · --- Scott Wood
Quoted 1 line · Ron Madrid

I'm trying to make new directories, create files,

save

Quoted 1 line

changes to files, etc. and when I reboot my

changes

Quoted 1 line

are not being saved. I'm sorry if this is vague,

but

Quoted 3 lines

I haven't run into this problem before in previous kernels. I'm using 2.6.25 and my configuration is very similar to mpc8313erdb_defconfig, with

changes to

Quoted 5 lines

include NAND support as my flash device is a NAND.

Also, my dts is very similar to mpc8313erdb.dts as well. I don't know where to start looking for the problem as there is no error. Here is what is

printed

Quoted 1 line

on boot.

Try head-of-tree; there have been several fixes to the eLBC FCM NAND driver.

-Scott

#3 lore raw
Quoted 4 lines · Ron Madrid

I have tried the latest code and now, I'm able to
write a limited amount. After which when I reboot,
more than 100 contiguous blocks have been marked bad,
through the end of the device (according to the dts). Is this something that has been seen before?

Yes, but not with the latest code.

Quoted 1 line

My NAND device is a large page.

I've only had small page devices to test on, so it's quite likely that there's a large page bug in the driver somewhere.

If your erase block size is not 128K, try the latest set_addr patch in the mtd-2.6.22.1 branch of u-boot-nand-flash (I still need to send it out for Linux).

-Scott

author
#4 lore raw

In which function should I start searching for this problem? What would cause a block to be marked bad?

Ron

Quoted 26 lines · --- Scott Wood
Quoted 2 lines · Ron Madrid

I have tried the latest code and now, I'm able to
write a limited amount. After which when I

reboot,

Quoted 1 line

more than 100 contiguous blocks have been marked

bad,

Quoted 1 line

through the end of the device (according to the

dts).

Quoted 1 line

Is this something that has been seen before?

Yes, but not with the latest code.

Quoted 1 line

My NAND device is a large page.

I've only had small page devices to test on, so it's quite likely that
there's a large page bug in the driver somewhere.

If your erase block size is not 128K, try the latest set_addr patch in
the mtd-2.6.22.1 branch of u-boot-nand-flash (I still need to send it
out for Linux).

-Scott

#5 lore raw
Quoted 2 lines · Ron Madrid

In which function should I start searching for this problem? What would cause a block to be marked bad?

No particular function; just something that causes things to not work. :-P

You may want to try increasing the OR[SCY] field or other timing parameters associated with the NAND flash.

-Scott

author
#6 lore raw
Quoted 3 lines · --- Scott Wood

You may want to try increasing the OR[SCY] field or other timing
parameters associated with the NAND flash.

So are you saying that when this happened in the past it was a timing issue? This change would need to happen in u-boot correct?

Ron

#7 lore raw
Quoted 7 lines · Ron Madrid
Quoted 2 lines · --- Scott Wood

You may want to try increasing the OR[SCY] field or other timing parameters associated with the NAND flash.

So are you saying that when this happened in the past it was a timing issue? This change would need to happen in u-boot correct?

Well, there was a bug that accidentally changed SCY from 1 to 0. :-P

U-boot would be the ideal place to fix it, but if you're only accessing the flash from Linux, it could be changed in platform code.

-Scott

author
#8 lore raw

So I found something that looks suspicious to me. This may not be a fsl_elbc_nand.c problem, but a more general problem.

Shortly after mounting the root filesystem, which is a jffs2 on a large page NAND device (my board is based on the MPC8313) the kernel appears to read the device starting just past the point defined by the 0x1985 . . . markers in the jffs2 filesystem, through the end of the device as defined by the dtb. More specifically in my device, the file system is approximately 0x200000 and resides at 0x400000 with the end of the device being 0x2000000. As it does this it is then writing the oob data into these blocks (0x600000 -
0x1fe0000). The value that it was writing into the
first 4 bytes of the oob are 0xff198520. This was problematic as the 0x20 was being placed into the large page NAND device bad block location (0x0). Given that there is a 0xff at the msb of the oob data, could this possibly be a byte swapping issue? I don't see though how this could be a problem in the large page NAND but not the small page NAND. I verified this by writing 0xffffffff in to the first 4 bytes of the oob data to ensure that 0xff was written into the bad block location.

In the function fsl_elbc_write_buf:
(*(unsigned int *)buf) = 0xffffffff;

I know that this isn't a fix, but I don't know where this problem comes from and also I don't know the exact flow of the NAND device processes.

I would be more than happy to investigate further and provide a patch if someone could point me in the right direction.

Let me know if I'm off base here, but I think this is where my problem is.

Ron Madrid

#9 lore raw
In reply to Ron Madrid
Quoted 11 lines · On Thu, 22 May 2008 13:36:32 -0700 (PDT) "Ron Madrid"…

I'm trying to make new directories, create files, save changes to files, etc. and when I reboot my changes are not being saved. I'm sorry if this is vague, but I haven't run into this problem before in previous kernels. I'm using 2.6.25 and my configuration is very similar to mpc8313erdb_defconfig, with changes to include NAND support as my flash device is a NAND. Also, my dts is very similar to mpc8313erdb.dts as well. I don't know where to start looking for the problem as there is no error. Here is what is printed on boot.

Are you sure the mount is working? What does the output of mount say?

Cheers,
Sean