2008-07-15 06:26:46     about flash driver

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

2008-07-15 06:26:46     about flash driver

sj tian (CHINA)

Message: 58842   


I want to write flash. I know I need add MTD module. My CPU is bfin537, flash is SST39VF3201.



Question 1:

Need I write a new flash driver? Or I can modify some flash driver file exited? where is such ifile?



Question 2:

I chose jsff2 filesystem, right?



Question 3:

I edited kernel following the file :



I have some doubt about Mapping drivers part:


    Mapping drivers for chip access --->

    <*> CFI Flash device in physical memory map

         (the address/length options are ignored)

  < > Generic uClinux RAM/ROM filesystem support (disable this option)


Why disable Generic uClinux RAM/ROM filesystem support? If disabled it,

did it affect the running of romfs it is my root filesystem?


Another doubt about Partitioning part:

  Device Drivers --->

    Memory Technology Devices (MTD) --->

    <*> Memory Technology Device (MTD) support

    [*]  MTD partitioning support

    [*]     Command line partition table parsing


About the the item MTD partitioning support, when run make menuconfig,under

Memory Technology Devices (MTD), it show --- MTD partitioning support, not

[ ]MTD partitioning support.So I can not choose it.


PLS give me some hints,THANKS!





2008-07-15 07:22:17     Re: about flash driver

Mike Frysinger (UNITED STATES)

Message: 58846   


the document you're reading already explains chip drivers:



you use whatever flash filesystem you want.  most people will use jffs2.


the documentation says you probably want to disable the Generic uClinux map, but it does not say doing so is required.


the [*] vs --- does not matter ... read the kconfig documentation about the output differences.




2008-07-17 06:23:14     Re: about flash driver

sj tian (CHINA)

Message: 59010   


I modified 2 file:




static struct mtd_partition bf5xx_partitions[] = {


           name: "Bootloader",

           size: 0x1FFFF,

           offset: 0,


           name: "Fpga",

           //size: 0xE0000,

           size: 0x4FFFF,

           offset: 0x30000,


#ifdef CONFIG_BF537


           name: " Kernel ",

           //size: 0x2f0000,

           size: 0x27ffff,

           offset: 0x80000,




           name: " Kernel ",

           //size: 0x300000,

           size: 0x27ffff,

           offset: 0x80000,









add  1 #define SST39VF3201   0x235b





           2  in  static const struct amd_flash_info jedec_table[]  add



               .mfr_id         = MANUFACTURER_SST,     /* should be CFI */

               .dev_id         = SST39VF3201,

               .name           = "SST 39VF3201",

               .uaddr          = {

                       [0] = MTD_UADDR_0x5555_0x2AAA, /* x8 */

                       [1] = MTD_UADDR_0x5555_0x2AAA   /* x16 */


               .DevSize        = SIZE_4MiB,

               .CmdSet         = P_ID_AMD_STD,

               .NumEraseRegions= 4,

               .regions        = {












afer download image, when system starting, it show:


Starting Kernel at = 1000

Linux version (root@tpdhdg-linux) (gcc 版本 4.1.1 (ADI

07R1)) #122 Thu Jul 17 18:17:14 CST 2008

Warning: limiting memory to 31MB due to hardware anomaly 05000263

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

Compiled for ADSP-BF537 Rev 0.2

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 100 Mhz System Clock

Board Memory: 32MB

Kernel Managed Memory: 32MB

Memory map:

  text      = 0x00001000-0x0014c074

  init      = 0x0014d000-0x0015c080

  data      = 0x0015e194-0x0019a2dc

  stack     = 0x00160000-0x00162000

  bss       = 0x0019a2e0-0x001a8c80

  available = 0x001a8c80-0x01eff000

  DMA Zone  = 0x01f00000-0x02000000

Instruction Cache Enabled

Data Cache Enabled (write-through)

Hardware Trace Enabled

Built 1 zonelists.  Total pages: 7874

Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600 ip=


Configuring Blackfin Priority Driven Interrupts

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

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

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

Physical pages: 1eff

Memory available: 29744k/31367k RAM, (60k init code, 1324k kernel code, 58k data

, 1024k dma)

Blackfin Scratchpad data SRAM: 4 KB

Blackfin DATA_A SRAM: 16 KB

Blackfin DATA_B SRAM: 16 KB

Blackfin Instruction SRAM: 48 KB

Security Framework v1.0.0 initialized

Mount-cache hash table entries: 512

NET: Registered protocol family 16

Blackfin GPIO Controller

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 23

NET: Registered protocol family 2

IP route cache hash table entries: 256 (order: -2, 1024 bytes)

TCP established hash table entries: 1024 (order: 0, 4096 bytes)

TCP bind hash table entries: 512 (order: -1, 2048 bytes)

TCP: Hash tables configured (established 1024 bind 512)

TCP reno registered

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

JFFS2: default compression mode: priority

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Dynamic Power Management Controller Driver v0.1: major=10, minor = 254

fpga: register major 250

Serial: Blackfin serial driver

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

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

Blackfin mac net device registered

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

bfin_mac: Link is down, please check your network connection

IP-Config: Complete:

      device=eth0, addr=, mask=, gw=,

     host=BF537, domain=, nis-domain=(none),

     bootserver=, rootserver=, rootpath=

VFS: Cannot open root device "mtdblock0" or unknown-block(0,0)

Please append a correct "root=" boot option

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)


why image can not normal run? why can not open root device"mtdblock0"?

I configure kernel according the docs:








2008-07-17 09:01:01     Re: about flash driver

Mike Frysinger (UNITED STATES)

Message: 59016   


you didnt build any mtd drivers into the kernel.  if you want to use mtd for your root filesystem, you need to build things into your kernel.




2008-07-18 05:33:33     Re: about flash driver

sj tian (CHINA)

Message: 59080   




   I enable the item < > Generic uClinux RAM/ROM filesystem support. for I did not use jffs2 as rootfs. Now uImage can  normally  run.


  But There is another problem, When kenel run ,the system show:


BF5xx flash: probing 8-bit flash bus

BF5xx flash: Probing for STM MW320D compatible flash...

mfr id 0x90, dev_id 0x10

BF5xx flash: Found no STM MW320D compatible device at location zero


I know there are some problem on my flash driver . my flash is SST39VF3201, 8bit*4M,


In linux-2.6.x\drivers\mtd\chips\jedec_probe.c, I found SST39VF1601chip define,such as:




#define SST39VF1601 0x234b



               .mfr_id         = MANUFACTURER_SST,     /* should be CFI */

               .dev_id         = SST39VF1601,

               .name           = "SST 39VF1601",

               .uaddr          = {

                       [0] = MTD_UADDR_0x5555_0x2AAA,  /* x8 */

                       [1] = MTD_UADDR_0x5555_0x2AAA   /* x16 */


               .DevSize        = SIZE_2MiB,

               .CmdSet         = P_ID_AMD_STD,

               .NumEraseRegions= 2,

               .regions        = {







Can these  information  say  sysytem suport SST39VF1601chip,that is , there is  flash driver in linux-2.6.x\drivers\mtd\chips\ already.


If yes, when I use SST39VF3201chip,I can modify on  this flash driver , but I didt know which driver file under "linux-2.6.x\drivers\mtd\chips\ "SST39VF1601chip used. can you tell me?


if no, I need a new flash driver for SST39VF3201chip, which driver file under "linux-2.6.x\drivers\mtd\chips\ "I can refer ?


that is which driver file is compatible with SST39VF3201chip?


My kernel is 2007R1.1-RC3.


I write flash driver for the first time, so I have so much problems.


PLS give me some suggests,THANKS!




2008-07-18 05:40:38     Re: about flash driver

Mike Frysinger (UNITED STATES)

Message: 59081   


you should upgrade to 2008R1.  then there is no need to use the bf5xx-flash mapping driver.  just use the simple physmap flashing driver as documented.


you need to see if your flash is CFI compliant.  if it is, you can use the normal CFI code.  if it isnt, you need to write your own chip driver, but we have no documentation nor examples for how to do this.  really you're on your own.  as the documentation clearly states, dont waste your time doing this ... just design in a CFI compliant flash chip.




2008-07-18 06:01:16     Re: about flash driver

sj tian (CHINA)

Message: 59084   


Thanks, Mike! 


SST39VF3201 support CFI.  If  I still use 2007-R1.1-RC3 kernel, I need write flash driver?


There is only 2.5M free space left for uImage on my board, so  If updating kernel, I am afraid the space will short.




2008-07-18 06:30:13     Re: about flash driver

Mike Frysinger (UNITED STATES)

Message: 59086   


i havent tested the flash stuff in 2007R1 so i cant really make statements about it.  the documentation in the wiki reflects 2008R1 and newer.  if you use the physmap flashing map driver, it should be easy.