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.

Bad blocks are happening in NAND after Kernel Loads Squashfs in DM365

We are using DM365 with IPNC 5.1, but when kernel loads squashfs then bad blocks becomes in NAND.Actually they are not bad blocks, because these blocks are giving real data after nand dump command.

We are making nine mtd partition, which are :
[    1.373905] Creating 9 MTD partitions on "davinci_nand.0":
[    1.379714] 0x000000000000-0x000000200000 : "bootloader"
[    1.390978] 0x000000200000-0x000000400000 : "params"
[    1.401996] 0x000000400000-0x000000900000 : "kernel"
[    1.413263] 0x000000900000-0x000002900000 : "filesystem"
[    1.424992] 0x000002900000-0x000003000000 : "config"
[    1.436564] 0x000003000000-0x000003500000 : "kernel_recovery"
[    1.448311] 0x000003500000-0x000004500000 : "filesystem_recovery"
[    1.460446] 0x000004500000-0x000004f00000 : "syslog"
[    1.471575] 0x000004f00000-0x000008000000 : "data1"

And first four bad blocks from nand bad command are :
02900000
02920000
02940000
02960000

First bad block is becoming just after filesystem partition.Due to this its not able to find any space on nand and so rest partition will not be made and board gets stucked.

Squashfs is not able to handle bad blocks,so anyone give any idea to resolve this problem.

  • Squashfs and handling bad blocks are independent for each other.

    Basically the handling of bad block in NAND flash should be done in driver like below

    nand_write/read will skip bad block before real read/write, so maybe you can confirm that if the "skip bad block" was real done.

    to skip bad block, it need to check first.

    So please confirm

    1. if "check bad block" was done in read/write 

    2. if "skip bad block" was done in read/write

     

    printf("\nNAND %s: ", read ? "read" : "write");
    ...

    if (read)
    ret = nand_read_skip_bad();
    else
    ret = nand_write_skip_bad();

    ...

    int nand_read_skip_bad()
    {
    ...

    ...

    while (left_to_read > 0) {
    ...

    if (nand_block_isbad () {
    ...
    }

    ...

    rval = nand_read ();
    ...

    }

  • Hi Merry,

    You have not got my issue exactly.'nand bad ' is showing them as bad blocks and 'nand dump' is showing real data from these blocks.After 'nand scrub' , i am able to flash filesystem once, but if i  upgrade the filesystem again then these blocks are coming bad.Location of these blocks and filesystem , i have shared in earlier post.
    I want to know, why these blocks are becoming bad after primary filesystem loading.And second thing , what is causing them to become bad.  

  • After 'nand scrub' , i am able to flash filesystem once.
    I want to know, why these blocks are becoming bad after primary filesystem loading.
    > let me confirm, did you mean your filesystem is broken or fail to run your application or something else?

    'nand dump' is showing real data from these blocks.
    > Did you mean you also dump OOB data and verify the info inside OOB?
  • When i am trying to load filesystem for second time then filesystem is broken and it is not able to up all the modules ,even it is not able to make configuration directory in nand.Because it is not able to get any space left on nand due to bad blocks.

    I used 'nand dump ' to verify bad blocks coming in nand flash.OOB bytes from a block are :
    ff ff 85 19 03 20 ff ff
    ff ff ff ff ff ff ff ff ff ff
    08 00 00 00 ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff

    this data is looking like real.So i am doubting what is making these blocks as bad after once loading filesystem?
  • Nikhil Sahu said:


    I used 'nand dump ' to verify bad blocks coming in nand flash.OOB bytes from a block are :
    ff ff 85 19 03 20 ff ff
    ff ff ff ff ff ff ff ff ff ff
    08 00 00 00 ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff ff ff

    this data is looking like real.So i am doubting what is making these blocks as bad after once loading file-system?

    > 1. is OOB size 16 byte? 

       2. did you store the early bad block before "nand scrub"?

    Nikhil Sahu said:

    When i am trying to load filesystem for second time then filesystem is broken and it is not able to up all the modules 

    > let me confirm your detail behavior...

       did you mean the file system is OK for the first time?

       did you power off then power on after you flash the file-system?

  • > 1. is OOB size 16 byte? --> its 64 byte

    2. did you store the early bad block before "nand scrub" ?  --> First bad blocks become after loading filesystem then i check number of bad blocks then i choose one bad block out of them and take dump of that one.Now i have no option to use this block so i scrub the nand to make this block as good.

     did you mean the file system is OK for the first time? --> Yes , it is working for the first time only

    did you power off then power on after you flash the file-system? --> no, we flash the file system then boot on console and system gets up .

    We have two options to upgrade the filesystem :
    1.Software wise, we call firmware upgrade api to do it without power off/on.
    2.Power off then power on and flash the filesystem again on nand.

    We have tried both options but same output is coming

  • confirm

    1. is OOB size 16 byte? --> its 64 byte
    > As you said, the OOB size is 64 bytes, but why your ECC bytes is only 8 bytes??
    Please show the error message during second time boot-up


    did you power off then power on after you flash the file-system? --> no, we flash the file system then boot on console and system gets up
    > please power off/on after flashing FS and show result, I want to make sure if it's really OK under clean boot for the first time.
  • Please show the error message during second time boot-up
    Logs for second time boot-up are shown below :
    Starting kernel ...

    [ 0.000000] Linux version 2.6.37_IPNC_DM365_5.1.0+ (root@tarun) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Tue Nov 25 13:04:45 IST 2014
    [ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
    [ 0.000000] CPU: VIVT data cache, VIVT instruction cache
    [ 0.000000] Machine: DaVinci DM36x MCAM
    [ 0.000000] Memory policy: ECC disabled, Data cache writeback
    [ 0.000000] DaVinci dm36x_rev1.2 variant 0x8
    [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
    [ 0.000000] Kernel command line: mem=128M console=ttyS0,115200n8 root=/dev/mtdblock3 rootfstype=squashfs ip=off eth=00:01:02:03:04:05 cmemk1
    [ 0.000000] TI DaVinci EMAC: kernel boot params Ethernet address: 00:01:02:03:04:05
    [ 0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
    [ 0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
    [ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
    [ 0.000000] Memory: 128MB = 128MB total
    [ 0.000000] Memory: 125560k/125560k available, 5512k reserved, 0K highmem
    [ 0.000000] Virtual kernel memory layout:
    [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    [ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    [ 0.000000] DMA : 0xff000000 - 0xffe00000 ( 14 MB)
    [ 0.000000] vmalloc : 0xc8800000 - 0xfea00000 ( 866 MB)
    [ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
    [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB)
    [ 0.000000] .init : 0xc0008000 - 0xc002b000 ( 140 kB)
    [ 0.000000] .text : 0xc002b000 - 0xc03f8000 (3892 kB)
    [ 0.000000] .data : 0xc03f8000 - 0xc0420300 ( 161 kB)
    [ 0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] Preemptable hierarchical RCU implementation.
    [ 0.000000] RCU-based detection of stalled CPUs is disabled.
    [ 0.000000] Verbose stalled-CPUs detection is disabled.
    [ 0.000000] NR_IRQS:245
    [ 0.000000] Console: colour dummy device 80x30
    [ 0.000399] Calibrating delay loop... 147.86 BogoMIPS (lpj=739328)
    [ 0.220083] pid_max: default: 32768 minimum: 301
    [ 0.220516] Mount-cache hash table entries: 512
    [ 0.221557] CPU: Testing write buffer coherency: ok
    [ 0.223682] devtmpfs: initialized
    [ 0.227614] DaVinci: 8 gpio irqs
    [ 0.228439] NET: Registered protocol family 16
    [ 0.377394] bio: create slab <bio-0> at 0
    [ 0.384058] SCSI subsystem initialized
    [ 0.389122] usbcore: registered new interface driver usbfs
    [ 0.391320] usbcore: registered new interface driver hub
    [ 0.392527] usbcore: registered new device driver usb
    [ 0.400775] vpss vpss: dm365_vpss vpss probed
    [ 0.400861] vpss vpss: dm365_vpss vpss probe success
    [ 0.403301] Advanced Linux Sound Architecture Driver Version 1.0.23.
    [ 0.405931] Switching to clocksource timer0_1
    [ 0.500322] musb-hdrc: version 6.0, host, debug=0
    [ 0.500586] musb-hdrc musb-hdrc: dma type: pio
    [ 0.516670] musb-hdrc musb-hdrc: MUSB HDRC host driver
    [ 0.516958] musb-hdrc musb-hdrc: new USB bus registered, assigned bus number 1
    [ 0.517283] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [ 0.517353] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 0.517404] usb usb1: Product: MUSB HDRC host driver
    [ 0.517448] usb usb1: Manufacturer: Linux 2.6.37_IPNC_DM365_5.1.0+ musb-hcd
    [ 0.517498] usb usb1: SerialNumber: musb-hdrc
    [ 0.520511] hub 1-0:1.0: USB hub found
    [ 0.520643] hub 1-0:1.0: 1 port detected
    [ 0.522548] musb-hdrc musb-hdrc: USB Host mode controller at fec64000 using PIO, IRQ 12
    [ 0.524052] NET: Registered protocol family 2
    [ 0.524487] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    [ 0.525548] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    [ 0.525865] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
    [ 0.526287] TCP: Hash tables configured (established 4096 bind 4096)
    [ 0.526340] TCP reno registered
    [ 0.526403] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.526490] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [ 0.527245] NET: Registered protocol family 1
    [ 0.528602] RPC: Registered udp transport module.
    [ 0.528661] RPC: Registered tcp transport module.
    [ 0.528700] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 0.621100] squashfs: version 4.0 (2009/01/31) Phillip Lougher
    [ 0.629715] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
    [ 0.634408] JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
    [ 0.639967] msgmni has been set to 245
    [ 0.645764] io scheduler noop registered (default)
    [ 0.648234] CSL: Module install successful, device major num = 253
    [ 0.648298] CSL: Module version 0.10.00, built on Nov 25 2014 12:52:23
    [ 0.648374] I2C: Module install successful, device major num = 252
    [ 0.648434] DMA: Module install successful, device major num = 251
    [ 0.648474] DRV: Module install successful
    [ 0.648510] DRV: Module built on Nov 25 2014 12:52:25
    [ 0.648548] DRV: EDMACC.QUEPRI = 00002777
    [ 0.648579] DRV: SYSTEM.MSTPRI0 = 00440011
    [ 0.648610] DRV: SYSTEM.MSTPRI1 = 00000444
    [ 0.648641] DRV: ISP.BCR = 00000002
    [ 0.648671] DRV: SYSTEM.MISC = 00000399
    [ 0.648703] EDMAK module: built on Nov 25 2014 at 12:52:05
    [ 0.648745] Reference Linux version 2.6.37
    [ 0.648780] File /home/tarun/sprs_mcam/latest_mcam/Source/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/edma/src/modulc
    [ 0.650817] IRQK module: built on Oct 29 2014 at 15:30:50
    [ 0.650884] Reference Linux version 2.6.37
    [ 0.650922] File /home/tarun/sprs_mcam/latest_mcam/Source/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/irq/src/modulec
    [ 0.652974] irqk initialized
    [ 0.653072] CMEMK module: built on Nov 25 2014 at 12:52:03
    [ 0.653128] Reference Linux version 2.6.37
    [ 0.653165] File /home/tarun/sprs_mcam/latest_mcam/Source/dvsdk_ipnctools/linuxutils_2_26_02_05/packages/ti/sdo/linuxutils/cmem/src/modulc
    [ 0.679676] allocated heap buffer 0xc9000000 of size 0x6222000
    [ 0.679740] CMEM Range Overlaps Kernel Physical - allowing overlap
    [ 0.679791] CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x88000000)
    [ 0.679987] cmemk initialized
    [ 0.680065] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
    [ 0.705348] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A
    [ 1.306918] console [ttyS0] enabled
    [ 1.333261] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A
    [ 1.344967] brd: module loaded
    [ 1.360086] NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung )
    [ 1.373905] Creating 9 MTD partitions on "davinci_nand.0":
    [ 1.379714] 0x000000000000-0x000000200000 : "bootloader"
    [ 1.390978] 0x000000200000-0x000000400000 : "params"
    [ 1.401996] 0x000000400000-0x000000900000 : "kernel"
    [ 1.413263] 0x000000900000-0x000002900000 : "filesystem"
    [ 1.424992] 0x000002900000-0x000003000000 : "config"
    [ 1.436564] 0x000003000000-0x000003500000 : "kernel_recovery"
    [ 1.448311] 0x000003500000-0x000004500000 : "filesystem_recovery"
    [ 1.460446] 0x000004500000-0x000004f00000 : "syslog"
    [ 1.471575] 0x000004f00000-0x000008000000 : "data1"
    [ 1.482813] davinci_nand davinci_nand.0: controller rev. 2.3
    [ 1.546166] davinci_mdio davinci_mdio.0: davinci mdio revision 1.4
    [ 1.552403] davinci_mdio davinci_mdio.0: detected phy mask fffeffff
    [ 1.560595] davinci_mdio.0: probed
    [ 1.564071] davinci_mdio davinci_mdio.0: phy[16]: device 0:10, driver unknown
    [ 1.574890] bq32k 1-0068: rtc core: registered bq32k as rtc0
    [ 1.581655] i2c /dev entries driver
    [ 1.588329] Linux media interface: v0.10
    [ 1.593192] Linux video capture interface: v2.00
    [ 1.600945] vpbe-osd vpbe-osd: OSD sub device probe success
    [ 1.607875] vpbe-venc vpbe-venc: VENC sub device probe success
    [ 1.615051] vpbe-v4l2 vpbe-v4l2: vpbe v4l2 device registered
    [ 1.621277] Setting default output to Composite
    [ 1.625857] Setting default mode to ntsc
    [ 1.630196] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
    [ 1.637093] vpbe-v4l2 vpbe-v4l2: layer=c79be000,layer->video_dev=c79be0e8
    [ 1.645109] vpbe-v4l2 vpbe-v4l2: Trying to register VPBE display device.
    [ 1.652196] vpbe-v4l2 vpbe-v4l2: layer=c79c1400,layer->video_dev=c79c14e8
    [ 1.661603] watchdog watchdog: heartbeat 60 sec
    [ 1.673800] Error: Driver 'davinci-mcbsp' is already registered, aborting...
    [ 1.684825] asoc: cq93vc-hifi <-> davinci-vcif mapping ok
    [ 1.695540] ALSA device list:
    [ 1.698966] #0: DaVinci DM365 EVM
    [ 1.704249] TCP cubic registered
    [ 1.707999] NET: Registered protocol family 17
    [ 1.712681] lib80211: common routines for IEEE802.11 drivers
    [ 1.718668] Registering the dns_resolver key type
    [ 1.733951] bq32k 1-0068: hctosys: unable to read the hardware clock
    [ 1.746636] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
    [ 1.758661] devtmpfs: mounted
    [ 1.761833] Freeing init memory: 140K
    INIT: version 2.86 booting
    Starting mounting local filesystems: mount mount: mounting /dev/root on / failed: No such file or directory
    mount: mounting none on /dev/shm failed: No such file or directory
    failed (2: ).
    [ 3.303995] davinci_pwm: PWM Control Module loaded successfully
    mkdir: cannot create directory '/mnt/nand/uploaded_cfg': No space left on device
    Creat queue id:32769
    queue id:32769
    FileMngThread created
    Creat queue id:65538
    queue id:65538
    AlramThread created
    IR-CUT Thread created
    Profile Schedule Thread created
    PtzThread created
    Cam Iris Thread created
    Share memory init success
    IPNC_DM365_5.1.0+ (root@tarun) (gcc version 4.3.3 (GCC) ) #1 PREEMPT Tue Nov 2
    Creat queue id:98307
    queue id:98307
    Creat queue id:131076
    queue id:131076
    queue id:65538
    queue id:98307
    mkdir: cannot create directory '/mnt/nand/config': No space left on device
    FileMng_ascii: Error Can't open config file for reading
    FileMng_ascii: Error Can't open Backup config file for reading
    FileMng_ascii: Error Error reading Config File
    Starting internet superserver: inetd.
    insmod: can't read '/opt/ipnc/modules/deflate.ko': No such file or directory
    insmod: can't read '/opt/ipnc/modules/des_generic.ko': No such file or directory
    insmod: can't read '/opt/ipnc/modules/md5.ko': No such file or directory
    cp: cannot create '/mnt/nand/config/./sys_env.cfg': Path does not exist
    cp: cannot create '/mnt/nand/config/./sys_env_backup.cfg': Path does not exist
    cp: cannot stat '/mnt/nand/config/sys_env.cfg': No such file or directory
    FileMng: Error Can't create log file
    FileMng: Error create_log_file failed
    FileMng: Error Can't create log file
    FileMng: Error create_dmva_log_file failed
    cp: cannot stat '/mnt/nand/config/sys_env.cfg': No such file or directory
    Kill queue id:65538
    Error CleanupFileEnv is called,condition = 2
    FileMsgDrv: Error
    Data read error
    Can't get system info!!
    FileMsgDrv: Error
    Data read error
    [ 5.523800] davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode
    [ 5.653455] mmc0: new high speed SDHC card at address e624
    [ 5.677807] mmcblk0: mmc0:e624 SU04G 3.69 GiB
    [ 5.685952] mmcblk0: p1 p2
    [ 5.760434] Loading iSCSI transport class v2.0-870.
    [ 6.172309] iscsi: registered transport (tcp)
    insmod: can't read '/opt/ipnc/modules/musb_hdrc.ko': No such file or directory
    insmod: can't read '/opt/ipnc/modules/cppi_dma.ko': No such file or directory
    insmod: can't read '/opt/ipnc/modules/davinci.ko': No such file or directory
    [ 6.378813] loop: module loaded
    [ 6.467958] tun: Universal TUN/TAP device driver, 1.6
    [ 6.473060] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
    [ 6.564004] console [netcon0] enabled
    [ 6.568035] netconsole: network logging started
    [ 6.681413] PPP generic driver version 2.4.2
    [ 6.718379] PPP Deflate Compression module registered
    mkdosfs 2.11 (12 Mar 2005)
    unable to get drive geometry, using default 255/63/dev/ram0 has 255 heads and 63 sectors per track,
    logical sector size is 512,
    using 0xf8 media descriptor, with 8192 sectors;
    file system has 2 12-bit FATs and 4 sectors per cluster.
    FAT size is 6 sectors, and provides 2036 clusters.
    Root directory contains 512 slots.
    Volume ID is 00000007, no volume label.
    [ 8.112359]
    [ 8.112392] Version Control: Version Control Module Loaded
    queue id:32769
    TimeOut occure in boot_proc.
    Program exit.
    [ 18.465785] net eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:10, id=8201)
    ApproDrvInit: 3
    Creat queue id:163842
    queue id:163842
    insmod: can't read '/opt/ipnc/module/usb-storage.ko': No such file or directory
    mount: mounting devpts on /dev/pts failed: No such file or directory
    INIT: Entering runlevel: 5
    Starting telnet daemon.
    done
    getty: ioctl() TIOCSPGR
    [ 20.456525] PHY: 0:10 - Link is Up - 100/Full
    _____ _____ _ _
    | _ |___ ___ ___ ___ | _ |___ ___ |_|___ ___| |_
    | | _| .'| . | . | | __| _| . | | | -_| _| _|
    |__|__|_| |__,|_ |___| |__| |_| |___|_| |___|___|_|
    |___| |___|

    Arago Project http://arago-project.org (none) console

    Arago 2009.11 (none) console

    (none) login:

    > please power off/on after flashing FS and show result, I want to make sure if it's really OK under clean boot for the first time.
    As i said in last post , we have two options to flash the filesystem , one with without power on/off and other one with power on/off .
    But for second time loading, it is not working with any case
  • did you power off then power on after you flash the file-system? --> no, we flash the file system then boot on console and system gets up .

    We have two options to upgrade the filesystem :
    1.Software wise, we call firmware upgrade api to do it without power off/on.
    2.Power off then power on and flash the filesystem again on nand.

    > I mean
    after upgrading the filesystem , then power off/on, then boot on console and system gets up .
    did you mean it's impossible?
  • I am not getting your point clearly , what you want to know exactly ?
    Filesystem is not working on second time boot , we do it after power on/off or without power on/off .Simple thing is : its not working on second time boot whatever u can try.
    Here i want to know, why it is not able to find proper size on nand and why these blocks are becoming bad ?
    For first time loading file system , these blocks are working fine , but for second time loading these will become bad block
    So please try to get this thing and give your valuable suggestion on this