Strange problem related to writing to flash
Okay, so here's the problem I'm running into:
On a hard reset, the board I'm working with always comes up fine. Linux boots, mounts the root filesystem (JFFS2) and all that. It looks happy.
If I don't modify the filesystem, Linux boots fine on a soft reset.
If I modify the filesystem in some way, Linux fails to boot properly on a soft reset. What happens is the bootstrap loads the kernel from the JFFS2 partition and boots the kernel. When the kernel probes the flash, it sees 2 8-bit wide devices instead of the actual 1 16-bit wide device. JFFS2 then get's really unhappy because it's attempts to access the flash device fail.
here are relevant bits of dmesg
First, on success:
AD6489 Residential Gateway flash probe(0x1fc00000,2097152,2): 200000 at 1fc00000
Analog Devices AD6489 Residential Gateway, Rev 2.0: Found 1 x16 devices at 0x0 in 16-bit mode
Found: ST M29W160DB
number of JEDEC chips: 1
0: offset=0x0,size=0x4000,blocks=1
1: offset=0x4000,size=0x2000,blocks=2
2: offset=0x8000,size=0x8000,blocks=1
3: offset=0x10000,size=0x10000,blocks=31
Creating 4 MTD partitions on "Analog Devices AD6489 Residential Gateway, Rev 2.0":
0x00000000-0x00004000 : "Bootstrap 1" 0x00004000-0x00008000 : "Configuration" 0x00008000-0x00020000 : "Bootstrap 2" 0x00020000-0x00200000 : "Root"
Next, on failure:
AD6489 Residential Gateway flash probe(0x1fc00000,2097152,2): 200000 at 1fc00000
Analog Devices AD6489 Residential Gateway, Rev 2.0: Found 2 x8 devices at 0x0 in 16-bit mode
Found: ST M29W160DB
number of JEDEC chips: 1
0: offset=0x0,size=0x8000,blocks=1
1: offset=0x8000,size=0x4000,blocks=2
2: offset=0x10000,size=0x10000,blocks=1
3: offset=0x20000,size=0x20000,blocks=31
Creating 4 MTD partitions on "Analog Devices AD6489 Residential Gateway, Rev 2.0":
0x00000000-0x00004000 : "Bootstrap 1"
0x00004000-0x00008000 : "Configuration" 0x00008000-0x00020000 : "Bootstrap 2"
0x00020000-0x00200000 : "Root"
...jffs2_scan_empty(): Empty block at 0x0000ffc0 ends at 0x00010000 (with 0x1985e002)! Marking dirty
(message repeats for successive 128KB blocks)
CLEANMARKER node found at 0x00150000, not first node in block (0x00140000)jffs2_scan_empty(): Empty block at 0x0016000c ends at 0x00170000 (with 0x19852003)! Marking dirty
CLEANMARKER node found at 0x00170000, not first node in block (0x00160000)jffs2_scan_empty(): Empty block at 0x0018000c ends at 0x00190000 (with 0x19852003)! Marking dirty
CLEANMARKER node found at 0x00190000, not first node in block (0x00180000)jffs2_scan_empty(): Empty block at 0x001a000c ends at 0x001b0000 (with 0x19852003)! Marking dirty
CLEANMARKER node found at 0x001b0000, not first node in block (0x001a0000)jffs2_scan_empty(): Empty block at 0x001c000c ends at 0x001d0000 (with 0x19852003)! Marking dirty
CLEANMARKER node found at 0x001d0000, not first node in block (0x001c0000)
VFS: Mounted root (jffs2 filesystem).
Freeing unused kernel memory: 40k freed
Waiting for chip to read, status = 7
Waiting for chip to read, status = 7
Any pointers on what to look for here?
Signature · 4 lines
------------------------------------------------- Justin Wojdacki [email protected] (408) 350-5032 Communications Processors Group -- Analog Devices
I've been seeing similar things (well, worse, the kernel (yes the kernel) crashes somewhere in the bootloader after a soft reset) on PowerPC. If the root filesystem is mounted read-only, things are just peachy.
In your case, I'd bet that the flash isn't in 'read' mode. You probably want to assure that the flash is in 'read' mode before you soft reset the CPU.
I haven't figured out whats wrong with mine yet.
Quoted 91 lines · Justin Wojdacki
Okay, so here's the problem I'm running into:
On a hard reset, the board I'm working with always comes up fine. Linux boots, mounts the root filesystem (JFFS2) and all that. It looks happy.
If I don't modify the filesystem, Linux boots fine on a soft reset.
If I modify the filesystem in some way, Linux fails to boot properly on a soft reset. What happens is the bootstrap loads the kernel from the JFFS2 partition and boots the kernel. When the kernel probes the flash, it sees 2 8-bit wide devices instead of the actual 1 16-bit wide device. JFFS2 then get's really unhappy because it's attempts to access the flash device fail.
here are relevant bits of dmesg
First, on success:
AD6489 Residential Gateway flashprobe(0x1fc00000,2097152,2): 200000 at1fc00000
Analog Devices AD6489 Residential Gateway, Rev 2.0: Found 1 x16 devices at0x0in 16-bit mode
Found: ST M29W160DB
number of JEDEC chips: 1
0: offset=0x0,size=0x4000,blocks=1
1: offset=0x4000,size=0x2000,blocks=2
2: offset=0x8000,size=0x8000,blocks=1
3: offset=0x10000,size=0x10000,blocks=31
Creating 4 MTD partitions on "Analog Devices AD6489 Residential Gateway, Rev 2.0":
0x00000000-0x00004000 : "Bootstrap 1" 0x00004000-0x00008000 : "Configuration" 0x00008000-0x00020000 : "Bootstrap 2" 0x00020000-0x00200000 : "Root"Next, on failure:
AD6489 Residential Gateway flashprobe(0x1fc00000,2097152,2): 200000 at1fc00000
Analog Devices AD6489 Residential Gateway, Rev 2.0: Found 2 x8 devices at0x0in 16-bit mode
Found: ST M29W160DB
number of JEDEC chips: 1
0: offset=0x0,size=0x8000,blocks=1
1: offset=0x8000,size=0x4000,blocks=2
2: offset=0x10000,size=0x10000,blocks=1
3: offset=0x20000,size=0x20000,blocks=31
Creating 4 MTD partitions on "Analog Devices AD6489 Residential Gateway, Rev 2.0":
0x00000000-0x00004000 : "Bootstrap 1"
0x00004000-0x00008000 : "Configuration" 0x00008000-0x00020000 : "Bootstrap 2"
0x00020000-0x00200000 : "Root"
...jffs2_scan_empty(): Empty block at0x0000ffc0ends at0x00010000(with0x1985e002)! Marking dirty
(message repeats for successive 128KB blocks)
CLEANMARKER node found at0x00150000, not first node in block (0x00140000)jffs2_scan_empty(): Empty block at0x0016000cends at0x00170000(with0x19852003)! Marking dirty
CLEANMARKER node found at0x00170000, not first node in block (0x00160000)jffs2_scan_empty(): Empty block at0x0018000cends at0x00190000(with0x19852003)! Marking dirty
CLEANMARKER node found at0x00190000, not first node in block (0x00180000)jffs2_scan_empty(): Empty block at0x001a000cends at0x001b0000(with0x19852003)! Marking dirty
CLEANMARKER node found at0x001b0000, not first node in block (0x001a0000)jffs2_scan_empty(): Empty block at0x001c000cends at0x001d0000(with0x19852003)! Marking dirty
CLEANMARKER node found at0x001d0000, not first node in block (0x001c0000)
VFS: Mounted root (jffs2 filesystem).
Freeing unused kernel memory: 40k freed
Waiting for chip to read, status = 7
Waiting for chip to read, status = 7Any pointers on what to look for here?
Signature · 8 lines
------------------------------------------------- Justin Wojdacki [email protected] (408) 350-5032 Communications Processors Group -- Analog Devices ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 1 line
"Perl is basically TECO-99." ---Barry Shein
Quoted 6 lines · Jim Thompson
I've been seeing similar things (well, worse, the kernel (yes the kernel) crashes somewhere in the bootloader after a soft reset) on PowerPC. If the root filesystem is mounted read-only, things are just peachy.
Quoted 6 lines
In your case, I'd bet that the flash isn't in 'read' mode. You probably want to assure that the flash is in 'read' mode before you soft reset the CPU.
I haven't figured out whats wrong with mine yet.
That's along the lines of what a few of us discussed here, except for one issue:
The bootstrap isn't part of the kernel. So the bootstrap has no problem running, loading the kernel from flash, and then executing the kernel. Seems to me that that wouldn't be possible if the flash wasn't in read mode (unless I'm missing something). The bootstrap being used has to ID the flash device itself, so if it can ID it and read from it fine, the kernel should be able to also right?
Signature · 4 lines
------------------------------------------------- Justin Wojdacki [email protected] (408) 350-5032 Communications Processors Group -- Analog Devices
Quoted 11 lines · Justin Wojdacki
That's along the lines of what a few of us discussed here, except for one issue:
The bootstrap isn't part of the kernel. So the bootstrap has no problem running, loading the kernel from flash, and then executing the kernel. Seems to me that that wouldn't be possible if the flash wasn't in read mode (unless I'm missing something). The bootstrap being used has to ID the flash device itself, so if it can ID it and read from it fine, the kernel should be able to also right?
Some more information:
The flash is clearly in the read state when the kernel boots.
It looks like the first few passes of cfi_check_qry_or_id() don't actually get the manufacturer or device ID when this fails. It's not until the case where interleave = 2 and device_type = 1 that I see a correct ID happening. I'll post more information when I have more details into what's going on here.
Signature · 4 lines
------------------------------------------------- Justin Wojdacki [email protected] (408) 350-5032 Communications Processors Group -- Analog Devices