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.

Davinci NAND driver and JFFS2

I have a DM355 LeopardBoard and I am trying to set it up to utilize a JFFS2 root filesystem. I am currently using an Arago based kernel 2.6.37. During my kernel boot I see the following messages that pertain to the NAND driver and JFFS2:

JFFS2 version 2.2. (NAND) 2001-2006 Red Hat, Inc.

davinci_nand: probe of davinci_nand.0 failed with error -22

 

Looking at a successful boot from the internet it appears that I should see messages like the following:

JFFS2 version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit) <--- The output line that I don't have

4 cmdlinepart partitions found on MTD device davinci_nand.0
Creating 4 MTD partitions on "davinci_nand.0":
0x000000000000-0x0000000a0000 : "UBOOT"
0x0000000a0000-0x0000000c0000 : "UBOOT_ENV"
0x0000000c0000-0x000000480000 : "KERNEL"
0x000000480000-0x0000019e0000 : "FS"
davinci_nand davinci_nand.0: controller rev. 2.3

Once the NAND device is recognized, then the davanci_nand driver seems to understand how to partition the NAND chip.

My question is what device driver to I need to load to have the NAND device recognized?

  • Please be sure that JFF2 support is enabled in you linux config file.

  • I have the following set:

    CONFIG_MISC_FILESYSTEMS=y
    CONFIG_JFFS2_FS=y
    CONFIG_JFFS2_FS_DEBUG=0
    CONFIG_JFFS2_FS_WRITEBUFFER=y
    # CONFIG_JFFS2_FS_WBUF_VERIFY is not set
    CONFIG_JFFS2_SUMMARY=y
    # CONFIG_JFFS2_FS_XATTR is not set
    # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
    CONFIG_JFFS2_ZLIB=y
    # CONFIG_JFFS2_LZO is not set
    CONFIG_JFFS2_RTIME=y

    Again, the kernel messages show that the JFFS2 driver seems to load. What I do not see is where the NAND device is recognized. I am unsure what to enable for this to happen.

  • Can you explain the steps of how you flashed the JFFS2 filesystem into NAND?

  • Please see below:

     

    Chip initialization passed!                                                    
    TI UBL Version: 1.30                                                           
    Booting Catalog Boot Loader                                                    
    BootMode = NAND                                                                
    Starting NAND Copy...                                                          
    Valid MagicNum found.                                                          
       DONE                                                                        
    Jumping to entry point at 0x81080000.                                          
                                                                                   
                                                                                   
    U-Boot 2010.12-rc2 (May 15 2011 - 18:02:59)                                    
                                                                                   
    Cores: ARM 216 MHz                                                             
    DDR:   171 MHz                                                                 
    I2C:   ready                                                                   
    DRAM:  128 MiB                                                                 
    NAND:  256 MiB                                                                 
    Bad block table found at page 131008, version 0x01                             
    Bad block table found at page 130944, version 0x01                             
    nand_read_bbt: Bad block at 0x000000020000                                     
    nand_read_bbt: Bad block at 0x000000040000                                     
    nand_read_bbt: Bad block at 0x000000060000                                     
    Net:   dm9000                                                                  
    Hit any key to stop autoboot:  0                                               
    DM355 LEOPARD # mtdparts                                                       
                                                                                   
    device nand0 <davinci_nand.0>, # parts = 4                                     
     #: name                size            offset          mask_flags             
     0: uboot               0x00400000      0x00000000      0                      
     1: uboot-env           0x00020000      0x00400000      0                      
     2: kernel              0x00320000      0x00420000      0                      
     3: fs                  0x0f8c0000      0x00740000      0                      
                                                                                   
    active partition: nand0,0 - (uboot) 0x00400000 @ 0x00000000                    
                                                                                   
    defaults:                                                                      
    mtdids  : nand0=davinci_nand.0                                                 
    mtdparts: mtdparts=davinci_nand.0:512k(bootloader)ro,4m(kernel),-(filesystem)  
    DM355 LEOPARD # tftp 82000000 arago-console.jffs2                              
    dm9000 i/o: 0x4000000, id: 0x90000a46                                          
    DM9000: running in 16 bit mode                                                 
    MAC: 00:0a:0a:c0:89:11                                                         
    operating at 100M full duplex mode                                             
    Using dm9000 device                                                            
    TFTP from server 192.168.1.100; our IP address is 192.168.1.108                
    Filename 'arago-console.jffs2'.                                                
    Load address: 0x82000000                                                       
    Loading: #################################################################     
             #################################################################     
             ########################                                              
    done                                                                           
    Bytes transferred = 13762560 (d20000 hex)                                      
    DM355 LEOPARD # nand write.jffs2 82000000 fs d20000                            
                                                                                   
    NAND write: device 0 offset 0x740000, size 0xd20000                            
     13762560 bytes written: OK                                                    
    DM355 LEOPARD # tftp 80700000 uImage                                    
    dm9000 i/o: 0x4000000, id: 0x90000a46                                          
    DM9000: running in 16 bit mode                                                 
    MAC: 00:0a:0a:c0:89:11                                                         
    operating at 100M full duplex mode                                             
    Using dm9000 device                                                            
    TFTP from server 192.168.1.100; our IP address is 192.168.1.108                
    Filename 'uImage'.                                                      
    Load address: 0x80700000                                                       
    Loading: #################################################################     
             #################################################################     
             #################################################################     
             #################################################################     
             #################################################################     
             #############################################################         
    done                                                                           
    Bytes transferred = 1973840 (1e1e50 hex)                                       
    DM355 LEOPARD # printenv                                                       
    baudrate=115200                                                                
    bootargs=console=ttyS0,115200n8 noinitrd root=/dev/mtdblock3 rw rootfstype=jffs2 ip=dhcp eth=00:0C:0C:A0:00:89 video=davincifb:osd0=720x480x16,1350K:osd1=720x480,1350K:vid0=720x480,2025K:vid1=720x480,2025K mtdparts=davinci_nand.0:4096k(uboot),128k(uboot-env),3200k(kernel),-(fs)                                         
    bootcmd=dhcp;bootm                                                             
    bootdelay=3                                                                    
    bootfile="uImage"                                                              
    ethact=dm9000                                                                  
    ethaddr=00:0A:0A:C0:89:11                                                      
    fileaddr=80700000                                                              
    filesize=1E1E50                                                                
    ipaddr=192.168.1.108                                                           
    mtddevname=uboot                                                               
    mtddevnum=0                                                                    
    mtdids=nand0=davinci_nand.0                                                    
    mtdparts=mtdparts=davinci_nand.0:4096k(uboot),128k(uboot-env),3200k(kernel),-(fs)                                                                              
    partition=nand0,0                                                              
    serverip=192.168.1.100                                                         
    stderr=serial                                                                  
    stdin=serial                                                                   
    stdout=serial                                                                  
    ver=U-Boot 2010.12-rc2 (May 15 2011 - 18:02:59)                                
                                                                                   
    Environment size: 749/262140 bytes                                             
    DM355 LEOPARD # bootm 80700000                                                 
    ## Booting kernel from Legacy Image at 80700000 ...                            
       Image Name:   Arago/2.6.37/dm355-leopard                                    
       Created:      2011-06-06   3:52:26 UTC                                      
       Image Type:   ARM Linux Kernel Image (uncompressed)                         
       Data Size:    1973776 Bytes = 1.9 MiB                                       
       Load Address: 80008000                                                      
       Entry Point:  80008000                                                      
       Verifying Checksum ... OK                                                   
       Loading Kernel Image ... OK                                                 
    OK                                                                             
                                                                                   
    Starting kernel ...                                                            
                                                                                   
    Uncompressing Linux... done, booting the kernel.                               
    [    0.000000] Linux version 2.6.37 (user@dev) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #19 PREEMPT Sun Jun 5 18:46:55 HADT 2011                 
    [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177   
    [    0.000000] CPU: VIVT data cache, VIVT instruction cache                    
    [    0.000000] Machine: DaVinci DM355 leopard                                  
    [    0.000000] Memory policy: ECC disabled, Data cache writeback               
    [    0.000000] DaVinci dm355 variant 0x0                                       
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512                                                                      
    [    0.000000] Kernel command line: console=ttyS0,115200n8 noinitrd root=/dev/mtdblock3 rw rootfstype=jffs2 ip=dhcp eth=00:0C:0C:A0:00:89 video=davincifb:osd0=720x480x16,1350K:osd1=720x480,1350K:vid0=720x480,2025K:vid1=720x480,2025K mtdparts=davinci_nand.0:4096k(uboot),128k(uboot-env),3200k(kernel),-(fs)              
    [    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: 125604k/125604k available, 5468k 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 - 0xc0026000   ( 120 kB)               
    [    0.000000]       .text : 0xc0026000 - 0xc03f56e0   (3902 kB)               
    [    0.000000]       .data : 0xc03f6000 - 0xc0417d20   ( 136 kB)               
    [    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.000616] Calibrating delay loop... 107.31 BogoMIPS (lpj=536576)          
    [    0.230123] pid_max: default: 32768 minimum: 301                            
    [    0.231588] Mount-cache hash table entries: 512                             
    [    0.233560] CPU: Testing write buffer coherency: ok                         
    [    0.237585] devtmpfs: initialized                                           
    [    0.241814] DaVinci: 104 gpio irqs                                          
    [    0.244124] NET: Registered protocol family 16                              
    [    0.281033] bio: create slab <bio-0> at 0                                   
    [    0.285002] usbcore: registered new interface driver usbfs                  
    [    0.285722] usbcore: registered new interface driver hub                    
    [    0.286760] usbcore: registered new device driver usb                       
    [    0.289903] vpss vpss: dm355_vpss vpss probed                               
    [    0.290247] vpss vpss: dm355_vpss vpss probe success                        
    [    0.293934] Switching to clocksource timer0_1                               
    [    0.301647] musb-hdrc: version 6.0, peripheral, debug=0                     
    [    0.303133] NET: Registered protocol family 2                               
    [    0.304817] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)  
    [    0.309517] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
    [    0.309964] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)       
    [    0.310275] TCP: Hash tables configured (established 4096 bind 4096)        
    [    0.310333] TCP reno registered                                             
    [    0.310404] UDP hash table entries: 256 (order: 0, 4096 bytes)              
    [    0.310515] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)         
    [    0.312007] NET: Registered protocol family 1                               
    [    0.315320] RPC: Registered udp transport module.                           
    [    0.315417] RPC: Registered tcp transport module.                           
    [    0.315462] RPC: Registered tcp NFSv4.1 backchannel transport module.       
    [    0.330462] JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.            
    [    0.332957] fuse init (API version 7.15)                                    
    [    0.335336] msgmni has been set to 245                                      
    [    0.340658] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)                                                                            
    [    0.340768] io scheduler noop registered (default)                          
    [    1.485921] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled        
    [    1.515902] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A    
    [    1.868322] console [ttyS0] enabled                                         
    [    1.874984] serial8250 serial8250.0: unable to register port at index 1 (IO0MEM1c20400 IRQ41): -22                                                         
    [    1.884403] serial8250 serial8250.0: unable to register port at index 2 (IO0MEM1e06000 IRQ14): -22                                                         
    [    1.896610] brd: module loaded                                              
    [    1.917903] loop: module loaded                                             
    [    1.930307] davinci_nand: probe of davinci_nand.0 failed with error -22     
    [    1.937858] dm9000 Ethernet Driver, V1.31                                   
    [    2.059330] eth0: dm9000b at c8800000,c8804016 IRQ 73 MAC: 00:0a:0a:c0:89:11(chip)                                                                         
    [    2.067839] console [netcon0] enabled                                       
    [    2.071561] netconsole: network logging started                             
    [    2.080629] i2c /dev entries driver                                         
    [    2.086936] Linux video capture interface: v2.00                            
    [    2.095702] sdhci: Secure Digital Host Controller Interface driver          
    [    2.101958] sdhci: Copyright(c) Pierre Ossman                               
    [    2.108610] davinci_mmc davinci_mmc.0: Using DMA, 4-bit mode                
    [    2.117173] davinci_mmc davinci_mmc.1: Using DMA, 4-bit mode                
    [    2.125546] usbcore: registered new interface driver usbhid                 
    [    2.131192] usbhid: USB HID core driver                                     
    [    2.141026] TCP cubic registered                                            
    [    2.144645] NET: Registered protocol family 17                              
    [    2.149296] VFP support v0.3: not present                                   
    [    2.704479] eth0: link down                                                 
    [    3.714371] Sending DHCP requests ...... timed out!                         
    [   81.745294] IP-Config: Reopening network devices...                         
    [   82.294318] eth0: link down                                                 
    [   83.304387] Sending DHCP requests .                                         
    [   83.964274] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1                 
    [   85.764246] ..... timed out!                                                
    [  163.825383] IP-Config: Auto-configuration of network failed.                
    [  163.833505] Root-NFS: no NFS server address                                 
    [  163.838205] VFS: Unable to mount root fs via NFS, trying floppy.            
    [  163.845108] List of all partitions:                                         
    [  163.848723] No filesystem could mount root, tried:  jffs2                   
    [  163.854651] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)                                                                  
    [  163.863290] [<c00300c0>] (unwind_backtrace+0x0/0xec) from [<c02c9084>] (panic+0x6c/0x190)                                                                   
    [  163.871928] [<c02c9084>] (panic+0x6c/0x190) from [<c0008ec4>] (mount_block_root+0x1d0/0x210)                                                                
    [  163.880739] [<c0008ec4>] (mount_block_root+0x1d0/0x210) from [<c0008fa4>] (mount_root+0xa0/0xc0)                                                            
    [  163.889863] [<c0008fa4>] (mount_root+0xa0/0xc0) from [<c0009128>] (prepare_namespace+0x164/0x1c8)                                                           
    [  163.899062] [<c0009128>] (prepare_namespace+0x164/0x1c8) from [<c0008444>] (kernel_init+0x10c/0x14c)                                                        
    [  163.908531] [<c0008444>] (kernel_init+0x10c/0x14c) from [<c002c1c0>] (kernel thread_exit+0x0/0x8)                                                           


  • Try command

    nand erase fs 0xd20000

    before executing

    nand write.jffs2 82000000 fs d20000 

     

  • I did the nand erase, and the outcome was the same...still not finding the filesystem.

  • 1:try nand scrub entirely erase the flash, and after erasing  do nand createbbt which creates bad block table.
    2: then do mtdparts .
    3:Now set a NAND flash offset since later you won't want to write stuffs on the area that contains u-boot for ex: " dynenv set 40000".
    4: Then you can write the jffs2 in your flash and try booting.