This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM8148 nand flashing problem

Hi

I am trying to flash a jffs2 root file system to nand flash.

Followed all the procedure for flashing and ensured that I padded 0x800 bytes while reading from flash during boot.

However, I get the following error

Net: Detected MACID:0:18:31:8a:8c:40
cpsw
Hit any key to stop autoboot: 0
TI8148_EVM#printenv
bootdelay=3
baudrate=115200
autoload=yes
verify=yes
bootfile=uImage
ramdisk_file=ramdisk.gz
loadaddr=0x81000000
script_addr=0x80900000
loadbootscript=fatload mmc 0 ${script_addr} boot.scr
bootscript= echo Running bootscript from MMC/SD to set the ENV...; source ${script_addr}
ethaddr=00:18:31:8a:8c:40
ethact=cpsw
botcmd=mem=128M console=ttyO0,115200n8 noinitrd root=/dev/mtdblock4 rw rootfstype=jffs2 noip
filesize=37075AC
bootcmd=nand read 81000000 280000 220000;nand read 82000000 6c0000 3707800;bootm 81000000
bootargs=mem=128M console=ttyO0,115200n8 noinitrd root=/dev/mtdblock4 rw rootfstype=jffs2 ip=dhcp
stdin=serial
stdout=serial
stderr=serial

Environment size: 654/8188 bytes
TI8148_EVM#setenv bootcmd 'nand read 81000000 280000 220000;nand read 82000000 6c0000 3720000;bootm 81000000'
TI8148_EVM#saveenv
Saving Environment to MMC...
Writing to MMC(0)... done
TI8148_EVM#boot

NAND read: device 0 offset 0x280000, size 0x220000
2228224 bytes read: OK

NAND read: device 0 offset 0x6c0000, size 0x3720000
57802752 bytes read: OK
## Booting kernel from Legacy Image at 81000000 ...
Image Name: Linux-2.6.37
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2154820 Bytes = 2.1 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.37 (sai@sai-desktop) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #26 Wed Nov 7 09:07:53 IST 2012
CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ti8148evm
reserved size = 0 at 0x0
Memory policy: ECC disabled, Data cache writeback
OMAP chip is TI8148 2.0
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: mem=128M console=ttyO0,115200n8 noinitrd root=/dev/mtdblock4 rw rootfstype=jffs2 ip=dhcp
PID hash table entries: 512 (order: -1, 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: 125264k/125264k available, 5808k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
vmalloc : 0xc8800000 - 0xf8000000 ( 760 MB)
lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.init : 0xc0008000 - 0xc0037000 ( 188 kB)
.text : 0xc0037000 - 0xc0414000 (3956 kB)
.data : 0xc0414000 - 0xc044ea80 ( 235 kB)
SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:407
IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
Total of 128 interrupts on 1 active controller
GPMC revision 6.0
Trying to install interrupt handler for IRQ400
Trying to install interrupt handler for IRQ401
Trying to install interrupt handler for IRQ402
Trying to install interrupt handler for IRQ403
Trying to install interrupt handler for IRQ404
Trying to install interrupt handler for IRQ405
Trying to install interrupt handler for IRQ406
Trying to install type control for IRQ407
Trying to set irq flags for IRQ407
OMAP clockevent source: GPTIMER1 at 20000000 Hz
Console: colour dummy device 80x30
Calibrating delay loop... 599.65 BogoMIPS (lpj=2998272)
pid_max: default: 32768 minimum: 301
Security Framework initialized
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
devtmpfs: initialized
omap_voltage_early_init: voltage driver support not added
regulator: core version 0.5
regulator: dummy:
NET: Registered protocol family 16
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
OMAP GPIO hardware version 0.1
omap_mux_init: Add partition: #1: core, flags: 4
registered ti814x_vpss device
registered TI814x on-chip HDMI device
NOR: Can't request GPMC CS
Debugfs: Only enabling/disabling deep sleep and wakeup timer is supported now
ti81xx_pcie: Invoking PCI BIOS...
ti81xx_pcie: Setting up Host Controller...
ti81xx_pcie: Register base mapped @0xc8820000
ti81xx_pcie: Starting PCI scan...
PCI: bus0: Fast back to back transfers enabled
bio: create slab <bio-0> at 0
vgaarb: loaded
SCSI subsystem initialized
omap_i2c omap_i2c.1: bus 1 rev4.0 at 100 kHz
pcf857x: probe of 1-0021 failed with error -121
omap_i2c omap_i2c.3: bus 3 rev4.0 at 100 kHz
Switching to clocksource gp timer
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
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
PMU: registered new PMU device of type 0
omap-iommu omap-iommu.0: ducati registered
omap-iommu omap-iommu.1: sys registered
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
msgmni has been set to 244
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
omap_uart.0: ttyO0 at MMIO 0x48020000 (irq = 72) is a OMAP UART0
console [ttyO0] enabled
omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
brd: module loaded
loop: module loaded
omap2-nand driver initializing
NAND device: Manufacturer ID: 0x20, Chip ID: 0xf1 (ST Micro )
Creating 6 MTD partitions on "omap2-nand.0":
0x000000000000-0x000000020000 : "U-Boot-min"
0x000000020000-0x000000260000 : "U-Boot"
0x000000260000-0x000000280000 : "U-Boot Env"
0x000000280000-0x0000006c0000 : "Kernel"
0x0000006c0000-0x00000cee0000 : "File System"
mtd: partition "File System" extends beyond the end of device "omap2-nand.0" -- size truncated to 0x7940000
0x000008000000-0x000008000000 : "Reserved"
mtd: partition "Reserved" is out of reach -- disabled
davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
davinci_mdio davinci_mdio.0: detected phy mask fffffffc
davinci_mdio.0: probed
davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
davinci_mdio davinci_mdio.0: phy[1]: device 0:01, driver unknown
mice: PS/2 mouse device common for all mice
qt602240_ts 1-004a: __qt602240_read_reg: i2c transfer failed
qt602240_ts: probe of 1-004a failed with error -5
omap_rtc omap_rtc: rtc core: registered omap_rtc as rtc0
i2c /dev entries driver
OMAP Watchdog Timer Rev 0x00: initial timeout 60 sec
nf_conntrack version 0.5.0 (1957 buckets, 7828 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
Bridge firewalling registered
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
omap_voltage_late_init: Voltage driver support not added
Power Management for TI81XX.
Detected MACID=0:18:31:8a:8c:40
omap_rtc omap_rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
mmc0: new high speed SDHC card at address b368
mmcblk0: mmc0:b368 00000 7.51 GiB
mmcblk0: p1 p2

CPSW phy found : id is : 0x70431

CPSW phy found : id is : 0x70431
Sending DHCP requests .
PHY: 0:01 - Link is Up - 0/Half
PHY: 0:01 - Link is Down
..... timed out!
IP-Config: Reopening network devices...

CPSW phy found : id is : 0x70431

CPSW phy found : id is : 0x70431
Sending DHCP requests ...... timed out!
IP-Config: Auto-configuration of network failed.
mtd->read(0x100 bytes from 0x0) returned ECC error
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 0xff85 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 0x0001 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000008: 0x002b instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000010: 0x00e6 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000014: 0x0026 instead

...

...

...

...

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0792001c: 0x00ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x07920020: 0x00ff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x07920024: 0x00ff instead
Further such events for this erase block will not be printed
mtd->read(0x1ff08 bytes from 0x79200f8) returned ECC error
Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes
empty_blocks 0, bad_blocks 0, c->nr_blocks 970
VFS: Cannot open root device "mtdblock4" or unknown-block(31,4)
Please append a correct "root=" boot option; here are the available partitions:
1f00 128 mtdblock0 (driver?)
1f01 2304 mtdblock1 (driver?)
1f02 128 mtdblock2 (driver?)
1f03 4352 mtdblock3 (driver?)
1f04 124160 mtdblock4 (driver?)
b300 7879680 mmcblk0 driver: mmcblk
b301 72261 mmcblk0p1 00000000-0000-0000-0000-000000000mmcblk0p1
b302 7799557 mmcblk0p2 00000000-0000-0000-0000-000000000mmcblk0p2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,4)
Backtrace:
[<c0045b70>] (dump_backtrace+0x0/0x110) from [<c03115a4>] (dump_stack+0x18/0x1c)
r7:c7813000 r6:c006b758 r5:c002c2c4 r4:c044f1d0
[<c031158c>] (dump_stack+0x0/0x1c) from [<c0311608>] (panic+0x60/0x17c)
[<c03115a8>] (panic+0x0/0x17c) from [<c0009258>] (mount_block_root+0x1e0/0x220)
r3:00000000 r2:00000000 r1:c7823f58 r0:c03b583c
[<c0009078>] (mount_block_root+0x0/0x220) from [<c0009344>] (mount_root+0xac/0xcc)
[<c0009298>] (mount_root+0x0/0xcc) from [<c00094d4>] (prepare_namespace+0x170/0x1d4)
r4:c044eae4
[<c0009364>] (prepare_namespace+0x0/0x1d4) from [<c0008784>] (kernel_init+0x114/0x154)
r5:c0008670 r4:c044ea80
[<c0008670>] (kernel_init+0x0/0x154) from [<c006b758>] (do_exit+0x0/0x5e4)
r5:c0008670 r4:00000000

Can some one help me..?

I am using 128Mx8 flash.

rgds

sai

  • Hi,

    Your logs contain following error

    mtd->read(0x100 bytes from 0x0) returned ECC error


    This means kernel is unable to read the FileSystem image flashed by you, mostly because of difference in ECC schemes.

    There could be 2 reasons for that

    (1) Possible Issue: Kernel driver is build using 'BCH8 (8bit BCH HW) ECC scheme, where as we support only HAM1 (1bit Hamming ECC) when using JFFS2 on NAND.  This constrain is due to conflicts in NAND OOB Area Layout used by BCH8 and JFFS2.

    Solution: Rebuild the kernel with following changes:

    (a) Location: $KERNEL/drivers/mtd/nand/omap2.c:omap_nand_probe()

    +    pdata->ecc_opt        = OMAP_ECC_HAMMING_CODE_HW;

    (b) Location: $KERNEL/arch/arm/mach-omap2/board-flash.c: board_nand_init()

    +       if (cpu_is_ti81xx()) {
            board_nand_data.ecc_opt = OMAP_ECC_HAMMING_CODE_HW;

    (2) Possible Issue: File-System image was incorrectly flashed using BCH8 (8bit BCH HW) ECC nand driver from U-Boot or some-other kernel.

    Solutions:

    (a) If flashing FileSystem image from U-BOOT (general case):   Run following command to change the NAND ECC mode in U-Boot driver "before" flashing the FS image.

    $> nandecc hw 0

    $>  "HW ECC Hamming Code selected"


    (b) If flashing FileSystem image from earlier kernel (specific case): Build the earlier kernel image as given above in (1), then only flash the image.

    Hope that should solve you issue..

    with regards, pekon