2009-03-27 01:57:18     mount in nand flash

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-03-27 01:57:18     mount in nand flash

jacqueline liu (CHINA)

Message: 71653   

 

hi

 

i'm using the bf527ezkit

 

recently , i want to change my nand flash filesystem into yaffs2 .

 

but there is something strange .

 

i did the follow steps:

 

root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00400000 00020000 "Linux Kernel"

mtd1: 00400000 00020000 "File System"

mtd2: 0f800000 00020000 "User spaces"

mtd3: 00040000 00010000 "bootloader"

mtd4: 001c0000 00010000 "linux kernel"

root:/>eraseall /dev/mtd2

Erased 253952 Kibyte @ 0 -- 100% complete.

root:/>nandwrite /jackie/rootfs.yaffs2 /dev/mtd2 0x00800000

MEMGETINFO: Inappropriate ioctl for device

root:/>mount -t yaffs2 /dev/mtdblock2 /mnt

yaffs: dev is 32505858 name is "mtdblock2"

yaffs: Attempting MTD mount on 31.2, "mtdblock2"

root:/> ls mnt

lost+found

root:/>cd /mnt

root:/>mkdir user

 

 

then after a long time , nothing happened .

 

i wondered why the system stopped.

 

thanks

TranslateQuoteReplyEditDelete

 

 

2009-03-27 03:18:44     Re: mount in nand flash

Yi Li (CHINA)

Message: 71654   

 

Jacqueline,

 

You cannot use "nandwrite" to write a yaffs image. You can just mount the partition as yaffs2, then copy root file system into the nand flash.

 

Please refer to  bug: https://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_id=141&tracker_item_id=4967

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-27 04:33:41     Re: mount in nand flash

jacqueline liu (CHINA)

Message: 71676   

 

thanks for that ,

 

i've rewrite my kernel and file system into the nand flash under u-boot and do the work below:

 

root:/> cat proc/mtd

dev:    size   erasesize  name

mtd0: 00400000 00020000 "Linux Kernel"

mtd1: 00400000 00020000 "File System"

mtd2: 0f800000 00020000 "User spaces"

mtd3: 00040000 00010000 "bootloader"

mtd4: 001c0000 00010000 "linux kernel"

root:/> eraseall /dev/mtd2

Erased 253952 Kibyte @ 0 -- 100% complete.

root:/> mount -t yaffs2 /dev/mtdblock2 /mnt

yaffs: dev is 32505858 name is "mtdblock2"

yaffs: Attempting MTD mount on 31.2, "mtdblock2"

root:/> ls mnt

lost+found

root:/> cd mnt

root:/mnt> mkdir usr

 

i also try other work such as  root:/>cp -rf /usr /mnt

 

but whenever i do some work of the mnt folder , the system stop and seem to be doing nothing .

 

how could i do some thing such like making file or folder in the mnt folder ?

 

thanks

TranslateQuoteReplyEditDelete

 

 

2009-03-27 05:02:38     Re: mount in nand flash

Yi Li (CHINA)

Message: 71677   

 

OK. This is another bug in nand flash driver: https://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4833

 

This has been fixed in svn trunk.

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-27 05:16:05     Re: mount in nand flash

jacqueline liu (CHINA)

Message: 71680   

 

then

 

what should i do now if i want to handle that problem ?

 

should i re-compile the kernel using the svn trunk?

TranslateQuoteReplyEditDelete

 

 

2009-03-27 05:30:03     Re: mount in nand flash

Yi Li (CHINA)

Message: 71681   

 

The fix is also on 2008R1.5 branch.

 

------------------------------------------------------------------------

r6058 | cliff | 2009-02-04 18:41:04 +0800 (Wed, 04 Feb 2009) | 1 line

 

bug[4833]The DMAs have different size on BF52x and BF54x

 

 

If you are using 2008R-1.5 release, you can swith to use the 2008R1.5 svn branch - It includes many bug fixes.

 

Or, you can just merge this single fix to your code.

 

-Yi

QuoteReplyEditDelete

 

 

2009-03-29 23:28:13     Re: mount in nand flash

jacqueline liu (CHINA)

Message: 71735   

 

hi

 

it may because i'm new of this . i'm still wondering how to fix the problem

 

would you please give some detailed steps about what i need to do ?

 

thanks a lot .

TranslateQuoteReplyEditDelete

 

 

2009-03-29 23:46:28     Re: mount in nand flash

Yi Li (CHINA)

Message: 71737   

 

Apply this patch to your 2008R1.5: linux/drivers/mtd/nand/bf5xx_nand.c:

 

Index: bf5xx_nand.c

===================================================================

--- bf5xx_nand.c    (revision 4874)

+++ bf5xx_nand.c    (revision 6059)

@@ -496,11 +496,19 @@

     /* setup DMA register with Blackfin DMA API */

     set_dma_config(CH_NFC, 0x0);

     set_dma_start_addr(CH_NFC, (unsigned long) buf);

+/* The DMAs have different size on BF52x and BF54x */

+#ifdef CONFIG_BF52x

+    set_dma_x_count(CH_NFC, (page_size >> 1));

+    set_dma_x_modify(CH_NFC, 2);

+    val = DI_EN | WDSIZE_16;

+#endif

+

+#ifdef CONFIG_BF54x

     set_dma_x_count(CH_NFC, (page_size >> 2));

     set_dma_x_modify(CH_NFC, 4);

-

+    val = DI_EN | WDSIZE_32;

+#endif

     /* setup write or read operation */

-    val = DI_EN | WDSIZE_32;

     if (is_read)

         val |= WNR;

     set_dma_config(CH_NFC, val);

 

QuoteReplyEditDelete

 

 

2009-03-30 02:56:14     Re: mount in nand flash

jacqueline liu (CHINA)

Message: 71743   

 

i've solved the problem after following your steps .

 

thank you very much .

TranslateQuoteReplyEditDelete

 

 

2009-05-04 09:24:12     Re: mount in nand flash

yuan jiang (CHINA)

Message: 73562   

 

hi YI:

i've solved the problem after following your steps in bf527-ezkit .thanks.

 

i changed the 512MiB nandflash to 64MiB nandflash in my custom-bf527 board.

everything looks ok,beside "mount".

it always cost about 1 minute,when i mount 60MiB nandflash partition. how to fix the problem?

 

-yuan

 

the boot list:

 

U-Boot 1.1.6 (ADI-2008R1.5) (Jan 19 2009 - 20:24:33)

 

CPU:   ADSP bf527-0.1 (Detected Rev: 0.0)

Board: ADI BF527 EZ-Kit board

       Support:   blackfin.uclinux.org/

Clock: VCO: 600 MHz, Core: 600 MHz, System: 120 MHz

RAM:   32 MB

Flash:  4 MB

NAND:  64 MiB

In:    serial

Out:   serial

Err:   serial

Hit any key to stop autoboot:  0

bfin> bootm

## Booting image at 20032000 ...

   Image Name:   Linux-2.6.22.19-ADI-2008R1.5-svn

   Created:      2009-04-18  12:58:20 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    1897387 Bytes =  1.8 MB

   Load Address: 00001000

   Entry Point:  00108000

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 108000

Linux version 2.6.22.19-ADI-2008R1.5-svn (root@localhost.localdomain) (gcc version 4.1.2 (ADI svn)) #1144 Sat Apr 18 20:58:16 CST 2009

early printk enabled on early_BFuart0

Hardware Trace Active and Enabled

Reset caused by Software reset

Blackfin support (C) 2004-2007 Analog Devices, Inc.

Compiled for ADSP-BF527 Rev 0.1

Warning: Unsupported Chip Revision ADSP-BF527 Rev 0.1 detected

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 600 MHz core clock and 120 MHz System Clock

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  text      = 0x00001000-0x000bba30

  rodata    = 0x000bc000-0x000f93dc

  data      = 0x000fa000-0x00108000

    stack   = 0x000fa000-0x000fc000

  init      = 0x00108000-0x003b1000

  bss       = 0x003b1000-0x003bce8c

  available = 0x003bce8c-0x01eff000

  DMA Zone  = 0x01f00000-0x02000000

NOMPU: setting up cplb tables for global access

Instruction Cache Enabled

Data Cache Enabled (write-through)

Built 1 zonelists.  Total pages: 7874

Kernel command line: root=/dev/mtdblock0 rw earlyprintk=serial,uart0,57600 console=tty0 console=ttyBF0,57600

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 128 (order: 7, 512 bytes)

console handover: boot [early_BFuart0] -> real [ttyBF0]

Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)

Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)

Memory available: 27616k/32768k RAM, (2724k init code, 746k kernel code, 353k data, 1024k dma, 304k reserved)

Blackfin Scratchpad data SRAM: 4 KB

Blackfin Data A SRAM: 16 KB (10 KB free)

Blackfin Data B SRAM: 16 KB (16 KB free)

Blackfin Instruction SRAM: 48 KB (39 KB free)

Mount-cache hash table entries: 512

Blackfin GPIO Controller

Blackfin DMA Controller

stamp_init(): registering device resources

yaffs Apr 18 2009 20:54:07 Installing.

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART

RAMDISK driver initialized: 8 RAM disks of 4096K size 1024 blocksize

BF5xx on-chip NAND FLash Controller Driver, Version 1.2 (c) 2007 Analog Devices, Inc.

bf5xx-nand bf5xx-nand.0: page_size=256, data_width=8, wr_dly=3, rd_dly=3

NAND device: Manufacturer ID: 0x20, Chip ID: 0x76 (ST Micro NAND 64MiB 3,3V 8-bit)

Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":

0x00000000-0x00400000 : "Linux Kernel"

0x00400000-0x04000000 : "File System"

i2c /dev entries driver

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller Driver, Version 1.8, regs_base@ffc01400

Freeing unused kernel memory: 2724k freed

dma_alloc_init: dma_page @ 0x01d35000 - 256 pages at 0x01f00000

BusyBox v1.4.1 (2009-04-18 20:55:29 CST) Built-in shell (msh)

Enter 'help' for a list of built-in commands.

 

root:/> mount -t yaffs /dev/mtdblock0 /mnt

yaffs: dev is 32505856 name is "mtdblock0"

yaffs: Attempting MTD mount on 31.0, "mtdblock0"    /* cost about 4 seconds*/

root:/> cd /mnt

root:/mnt> mkdir 2

root:/mnt> cd 2

root:/mnt/2>cd /

root:/> umount /mnt

root:/> mount -t yaffs2 /dev/mtdblock1 /mnt

yaffs: dev is 32505857 name is "mtdblock1"

yaffs: Attempting MTD mount on 31.1, "mtdblock1"

yaffs: auto selecting yaffs1        /* coat about 1 minute*/

root:/mnt> mkdir 5

root:/mnt> cd 5

root:/mnt/5>

QuoteReplyEditDelete

 

 

2009-05-04 21:56:14     Re: mount in nand flash

Yi Li (CHINA)

Message: 73600   

 

Yuan,

 

For yaffs, I don't know why the mount time is so slow.

 

If you are going to use jffs2, you may refer to:   docs.blackfin.uclinux.org/doku.php?id=linux-kernel:jffs&s[]=jffs2#jffs2_mount_process_speedup

 

-Yi

Attachments

    Outcomes