MTD NOR write issue for files greater than a few hundred bytes

Holmes, Michael A (Mike) Mike.Holmes at lsi.com
Fri Mar 1 13:28:22 EST 2013


All,

The issue I have is as follows.  
When writing to the MTD on NOR in Linux for a file of more than a few bytes, it fails with a MTD software timeout. 

Writing upto 100 bytes are fine, in this test when I jumped to 300 it failed.
I also proved that the small writes do get written; I wrote zeros over my mtd1 "u-boot-env" and had to repair it on reboot.

In Uboot there are no NOR or NAND read/write issues, erase appears to work fine etc. Under Linux MTD for the NAND remains flawless and MTD NOR read has no issues.

Any thoughts appreciated: some information and the tests output below.


LCPSH # flinfo

Bank # 1: CFI conformant FLASH (8 x 8)  Size: 64 MB in 512 Sectors
  AMD Standard command set, Manufacturer ID: 0x15, Device ID: 0x00
  Erase timeout: 4096 ms, write timeout: 25 ms
  Buffer write timeout: 50 ms, buffer size: 1024 bytes

  Sector Start Addresses:
  10000000   RO   10020000   RO   10040000   RO   10060000   RO   10080000
  100A0000        100C0000        100E0000        10100000        10120000
  10140000        10160000        10180000        101A0000        101C0000
  101E0000        10200000        10220000        10240000        10260000
  10280000        102A0000        102C0000        102E0000        10300000
  10320000        10340000        10360000        10380000        103A0000
  103C0000        103E0000        10400000        10420000        10440000
  10460000        10480000        104A0000        104C0000        104E0000
  10500000        10520000        10540000        10560000        10580000
  105A0000        105C0000        105E0000        10600000        10620000
....
....
...

root at lvs15:/# uname -a
Linux lvs15 2.6.35-lcp-arm1 #1 SMP Fri Mar 1 11:59:02 EST 2013 armv6l GNU/Linux

root at lvs15:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00080000 00020000 "u-boot"
mtd1: 00040000 00020000 "u-boot-env"
mtd2: 03f40000 00020000 "unused-nor"
mtd3: 01e00000 00020000 "nand-linuxImg1"
mtd4: 01e00000 00020000 "nand-linuxImg2"
mtd5: 3c400000 00020000 "nandfs"

root at lvs15:/# mtd_debug info /dev/mtd1
MTD_open
MTD_ioctl
MTD_ioctl
MTD_close= MTD_NORFLASH

mtd.flags = MTD_CAP_NORFLASH
mtd.size = 262144 (256K)
mtd.erasesize = 131072 (128K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0


mtd_debug read /dev/mtd1 0 1000 read.txt
Copied 1000 bytes from address 0x00000000 in flash to read.txt

root at lvs15:/# cat read.txt
Åý      ôbootdelay=5baudrate=115200loadaddr=0x05000000mtdids=nor0=physmap-flash.0,nand0=lcp_nandmtdparts=mtdparts=physmap-flash.0:512k(u-boot),256k(u-boot-env),-(unused-nor);lcp_nand:30M(nand-linuxImg1),30M(nand-linuxImg2),-(nandfs)verify=nlcpethmac0cpathchnl=0lcpethmac0ethforcerate=1000lcpethmac0ethforcefulldplx=Ylcpethmac1cpathchnl=0lcpethmac1ethforcerate=1000lcpethmac1ethforcefulldplx=Yethprime=LCP_ETH_MAC0ethrotate=no netretry=no autostart=yessetupbootargs=setenv bootargs earlyprintk=serial,ttyAMA0,$(baudrate) console=ttyAMA0,$(baudrate)n8 root=/dev/ram mtdids=$(mtdids) $(mtdparts)bootcmd=fpgasetup;run setupbootargs;tftp ad_value=0x1e1lcpethmac1bcastfltr=onlcpethmac1mcastfltr=onlcpethmac1pausepktfltr=onlcpethmac1runtpktfltr=onlcpethmac1ucastfltr=onlcpethmac0bcastfltr=onlcpethmac0mcastfltr=onlcpethmac0pausepktfltr=onlcpethmac0runtpktfltr=onlcpethmac0ucastfltr=onlcpethmac0ucastfltrda2=00:00:00:00:00:00lcpethmac0ucastfltrda3=00:00:00:00:00:00lcp<d /dev/mtd2 0 1000 read.txtmtd_debug write /dev/mtd1 0 1000 read.txt



I appreciate I do not do erases between writes but the data is the same and I have not had trouble with this, other than if you do write different data obviously all bets are off!


root at lvs15:/# mtd_debug write /dev/mtd1 0 10 read.txt
MTD_open
MTD_write
MTD do_write_buffer(): WRITE 0x00080000(0x000000c5)
Copied 10 bytes from read.txt to address 0x00000000 in flash

root at lvs15:/# mtd_debug write /dev/mtd1 0 100 read.txt
MTD_open
MTD_write
MTD do_write_buffer(): WRITE 0x00080000(0x000000c5)
Copied 100 bytes from read.txt to address 0x00000000 in flash

root at lvs15:/# mtd_debug write /dev/mtd1 0 300 read.txt
MTD_open
MTD_write
MTD do_write_buffer(): WRITE 0x00080000(0x000000c5)
MTD do_write_buffer(): software timeout
file_to_flash: write, size 0x12c, n 0x12c
write(): Input/output error



More information about the Kernelnewbies mailing list