2010-08-27 08:49:11     BF527 mtd-utils problems

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

2010-08-27 08:49:11     BF527 mtd-utils problems


Message: 92867   


I use my custom board on BF527 and uclinux-dist-trunk-svn-9497. I can't to use mtd-utils to work with NAND flash.


Below you can see startup log.


Bytes transferred = 4818184 (498508 hex)

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf527-2.6.33-ADI-2010R1-pre

   Created:      2010-08-27   8:19:49 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    4818120 Bytes =  4.6 MB

   Load Address: 00001000

   Entry Point:  002388cc

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 002388cc

Linux version 2.6.33-ADI-2010R1-pre (root@debian) (gcc version 4.1.2 (ADI svn)) #18 Fri Aug 27 12:19:25 MSD 2010

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart1] enabled

early printk enabled on early_BFuart1

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x0017a4e0

  rodata    = 0x0017a4e0-0x001fe970

  bss       = 0x001ff000-0x00212a70

  data      = 0x00212a70-0x0022e000

    stack   = 0x0022c000-0x0022e000

  init      = 0x0022e000-0x0090a000

  available = 0x0090a000-0x03f00000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 3

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

Compiled for ADSP-BF527 Rev 0.2

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 528 MHz core clock and 132 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-back) in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 16002

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=12000000 earlyprintk=serial,uart1,57600 console=ttyBF1,57600 ip=

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

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

Memory available: 54688k/65536k RAM, (7024k init code, 1509k kernel code, 719k data, 1024k dma, 572k reserved)


Configuring Blackfin Priority Driven Interrupts

Console: colour dummy device 80x25

console [ttyBF1] enabled, bootconsole disabled

console [ttyBF1] enabled, bootconsole disabled

Calibrating delay loop... 1048.57 BogoMIPS (lpj=2097152)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

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

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

Blackfin L1 Instruction SRAM: 48 KB (42 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

ezkit_init(): registering device resources

bio: create slab <bio-0> at 0

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

Advanced Linux Sound Architecture Driver Version 1.0.21.

Switching to clocksource jiffies

musb_hdrc: version 6.0, pio, host, debug=0

musb_hdrc: USB Host mode controller at ffc03800 using PIO, IRQ 59

musb_hdrc musb_hdrc.0: MUSB HDRC host driver

musb_hdrc musb_hdrc.0: new USB bus registered, assigned bus number 1

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 1 port detected

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

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

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

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

msgmni has been set to 106

io scheduler noop registered

io scheduler cfq registered (default)

bfin-otp: initialized

bfin-uart: Blackfin serial driver

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART

brd: module loaded

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: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

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

0x000000000000-0x000000400000 : "linux kernel(nand)"

0x000000400000-0x000010000000 : "file system(nand)"

m25p80 spi0.1: non-JEDEC variant of m25p16

m25p80 spi0.1: m25p16 (2048 Kbytes)

Creating 2 MTD partitions on "m25p80":

0x000000000000-0x000000040000 : "bootloader(spi)"

0x000000040000-0x000000200000 : "linux kernel(spi)"

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

bfin_mii_bus: probed

bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=25)@sclk=132MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

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

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

No device for DAI SSM2602

dma rx:5 tx:6, err irq:16, regs:ffc00900

dma_alloc_init: dma_page @ 0x028f5000 - 256 pages at 0x03f00000

asoc: SSM2602 <-> bf5xx-i2s mapping ok

ALSA device list:

  #0: bf5xx_ssm2602 (SSM2602)

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 1989-03-23 03:35:51 UTC (606627351)

IP-Config: Complete:

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

     host=bf527-tiny, domain=, nis-domain=(none),

     bootserver=, rootserver=, rootpath=

Freeing unused kernel memory: 7024k freed


        a8888b.           / Welcome to the uClinux distribution \

       d888888b.         /       _     _                         \

       8P"YP"Y88        /       | |   |_|            __  __ (TM)  |

       8|o||o|88  _____/        | |    _ ____  _   _ \ \/ /       |

       8'    .88       \        | |   | |  _ \| | | | \  /        |

       8`._.' Y8.       \       | |__ | | | | | |_| | /  \        |

      d/      `8b.       \      \____||_|_| |_|\____|/_/\_\       |

     dP   .    Y8b.       \   For embedded processors including   |

    d8:'  "  `::88b        \    the Analog Devices Blackfin      /

   d8"         'Y88b        \___________________________________/

  :8P    '      :888

   8a.   :     _a88P         For further information, check out:

._/"Yaa_:   .| 88P|            -   blackfin.uclinux.org/

\    YP"    `| 8P  `.          -   docs.blackfin.uclinux.org/

/     \.___.d|    .'           -   www.uclinux.org/

`--..__)8888P`._.'  jgs/a:f    -   www.analog.com/blackfin


Have a lot of fun...



BusyBox v1.15.3 (2010-08-26 16:41:21 MSD) hush - the humble shell


root:/> PHY: 0:01 - Link is Up - 100/Full



You can see that mtd0 and mtd1 is NAND flash.


root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00400000 00020000 "linux kernel(nand)"

mtd1: 0fc00000 00020000 "file system(nand)"

mtd2: 00040000 00010000 "bootloader(spi)"

mtd3: 001c0000 00010000 "linux kernel(spi)"



I can mount mtdblock. For example I mount mtdblock0


root:/> mount -t jffs2 /dev/mtd0 /mnt

mount: mounting /dev/mtd0 on /mnt failed: Block device required

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

root:/> mount

rootfs on / type rootfs (rw)

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)

mdev on /dev type tmpfs (rw,nosuid,relatime,mode=0755,size=10M)

devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)

var on /var type ramfs (rw,relatime)

tmp on /tmp type tmpfs (rw,nosuid,nodev,relatime)

usbfs on /proc/bus/usb type usbfs (rw,relatime)

debugfs on /sys/kernel/debug type debugfs (rw,relatime)

/dev/mtdblock0 on /mnt type jffs2 (rw,relatime)


but I can't use mtd-utils.



root:/> flash_eraseall -j /dev/mtdblock0

flash_eraseall: /dev/mtdblock0: unable to get MTD device info

root:/> nandtest /dev/mtdblock0

MEMGETINFO: Inappropriate ioctl for device

root:/> nandtest /dev/mtd0

open: No such device or address




Also I try to write data into NAND.


root:/> tftp -g -r rootfs.jffs2

root:/> ls -l /dev/mtdblock0

brw-rw----    1 root     root      31,   0 Mar 23 03:46 /dev/mtdblock0

root:/> cp rootfs.jffs2 /dev/mtdblock0

root:/> ls -l /dev/mtdblock0

-rw-r--r--    1 root     root      4325376 Mar 23 04:02 /dev/mtdblock0


I see different 31 and 4325376. This is correct size of file footfs.jffs2. After reboot of board this number resets to 31. NAND write and read from u-boot works very good. I can load uImage from u-boot and write it to NAND and load ucLinux from NAND.




2010-08-27 11:58:32     Re: BF527 mtd-utils problems

Mike Frysinger (UNITED STATES)

Message: 92869   


that `cp` isnt do what you think it is.  if you want to write to the device, use `cat`.


what device nodes do you actually have in /dev ?


also, i see you're using a random snapshot.  update to the latest trunk or use the branch.




2010-08-27 12:03:15     Re: BF527 mtd-utils problems

Mike Frysinger (UNITED STATES)

Message: 92871   


also, as we mentioned before, we've never done ethernet + nand on bf527, nor do we have a way of testing it.  you will need to play with things like making sure nand doesnt use dma.




2010-08-31 09:41:03     Re: BF527 mtd-utils problems


Message: 92966   


Thank you for help, Mike.


At this time I use 2010R1-ALPHA2 ucLinux and toolchain. I see same errors as in previous trunk version. Below debug informatin enabled.


root:/mnt> flash_eraseall -j /dev/mtdblock0




: /dev/mtdblock0: unable to get MTD device info

nand_sync: called








NFS uses DMA channel 0


root:/bin> cat /proc/dma

0: BF5XX NFC driver

5: SPORT RX Data

6: SPORT TX Data



12: Blackfin dma_memcpy

13: Blackfin dma_memcpy


I think it's good. But I can't understand why Ethernet and SPI DMA are not present.



BF527 uses DMA 0 for NFC or PPI in default configuration . I don't use PPI.


In future I will try to debug with eclipse.




2010-08-31 09:44:18     Re: BF527 mtd-utils problems


Message: 92967    I forgot to give list of dev.


root:/dev> ls

audio ram13 tty2 tty49

bfin-otp ram14 tty20 tty5

console ram15 tty21 tty50

controlC0 ram2 tty22 tty51

cpu_dma_latency ram3 tty23 tty52

dsp ram4 tty24 tty53

fd ram5 tty25 tty54

full ram6 tty26 tty55

i2c-0 ram7 tty27 tty56

kmsg ram8 tty28 tty57

log ram9 tty29 tty58

mdev.seq random tty3 tty59

mem rtc0 tty30 tty6

mixer seq tty31 tty60

mtd0 snd tty32 tty61

mtd0ro stderr tty33 tty62

mtd1 stdin tty34 tty63

mtd1ro stdout tty35 tty7

mtdblock0 timer tty36 tty8

mtdblock1 tty tty37 tty9

network_latency tty0 tty38 ttyBF0

network_throughput tty1 tty39 ttyBF1

null tty10 tty4 ubi_ctrl

pcmC0D0c tty11 tty40 urandom

pcmC0D0p tty12 tty41 usbmon0

ptmx tty13 tty42 usbmon1

pts tty14 tty43 vcs

ram0 tty15 tty44 vcs1

ram1 tty16 tty45 vcsa

ram10 tty17 tty46 vcsa1

ram11 tty18 tty47 watchdog

ram12 tty19 tty48 zero




2010-08-31 10:53:36     Re: BF527 mtd-utils problems

Mike Frysinger (UNITED STATES)

Message: 92972   


you should first disable the bfin_mac driver in your kernel.  then retest the NAND and make sure things are working.  validate one thing at a time.




2010-09-01 07:25:08     Re: BF527 mtd-utils problems


Message: 93017   


I disabled MAC, but it doesn't matter.


root: /> cat /proc/gpio

GPIO_0: bf5xx-nand Peripheral

GPIO_1: bf5xx-nand Peripheral

GPIO_2: bf5xx-nand Peripheral

GPIO_3: bf5xx-nand Peripheral

GPIO_4: bf5xx-nand Peripheral

GPIO_5: bf5xx-nand Peripheral

GPIO_6: bf5xx-nand Peripheral

GPIO_7: bf5xx-nand Peripheral

GPIO_8: soc-audio Peripheral

GPIO_9: soc-audio Peripheral

GPIO_10: soc-audio Peripheral

GPIO_11: soc-audio Peripheral

GPIO_12: soc-audio Peripheral

GPIO_13: soc-audio Peripheral

GPIO_14: bfin-uart Peripheral

GPIO_15: bfin-uart Peripheral

GPIO_17: m25p80 Peripheral

GPIO_18: bfin-spi Peripheral

GPIO_19: bfin-spi Peripheral

GPIO_20: bfin-spi Peripheral

GPIO_23: bfin-uart Peripheral

GPIO_24: bfin-uart Peripheral


GPIO_42: bf5xx-nand Peripheral

GPIO_43: bf5xx-nand Peripheral

GPIO_44: bf5xx-nand Peripheral

GPIO_45: bf5xx-nand Peripheral

GPIO_46: bf5xx-nand Peripheral

GPIO_47: bf5xx-nand Peripheral

root: /> cat /proc/mtd

dev: size erasesize name

mtd0: 00400000 00020000 "linux kernel(nand)"

mtd1: 0fc00000 00020000 "file system(nand)"

root: /> init: /sbin/syslogd respawning too fast

ubiformat /dev/mtd0 -s 512 -O 512

libmtd: error!: cannot open "/dev/mtd0"

error 6 (No such device or address)

ubiformat: error!: cannot get information about "/dev/mtd0"

root: /> ubiformat /dev/mtd1 -s 512 -O 512

libmtd: error!: cannot open "/dev/mtd1"

error 6 (No such device or address)

ubiformat: error!: cannot get information about "/dev/mtd1"

root: /> flash_eraseall -j /dev/mtd0

flash_eraseall: /dev/mtd0: No such device or address

root: /> flash_eraseall -j /dev/mtd1

flash_eraseall: /dev/mtd1: No such device or address



But in dev are present mtd0 and mtd1.




2010-09-01 08:32:04     Re: BF527 mtd-utils problems

Adam Rosenberg (UNITED STATES)

Message: 93023   


root: /> flash_eraseall -j /dev/mtd0

flash_eraseall: /dev/mtd0: No such device or address


I have seen that error when the "mtdchar.ko" module is not loaded.