AnsweredAssumed Answered

how to mount nand as data nand

Question asked by ye yue on Jan 14, 2015

I use  mpc8313erdb to control nand as data nand and hope to use is as harddisk.

and do as follows I can't get what I want.

can anyone give some help to resolve this.

thank you!

 

nand flash is K9F5608U0D,

I  put the uboot,rootfs(ext2.gz.uboot),kernel ,dtb on the nor flash,

first I write a file to the nand by mtd_debug tool,and can read it back correctly

 

~ # ./mtd_debug write /dev/mtdblock5 0x40000 502388 aa.txt

~ # ./mtd_debug read /dev/mtdblock5 0x4000 0x09 bb

 

after I reboot the system it still works well,

but after I poweroff and repower on it goes wrong.

~ # ./mtd_debug read /dev/mtdblock5 0x40000 0x09 bb

end_request: I/O error, dev mtdblock5, sector 0

Buffer I/O error on device mtdblock5, logical block 0

end_request: I/O error, dev mtdblock5, sector 0

Buffer I/O error on device mtdblock5, logical block 0

flash_to_file: read, size 0x9, n 0x9

read(): Input/output error

~ # ./mkfs.jffs2 -o /dev/mtdblock5 -n -b -e 0x4000

end_request: I/O error, dev mtdblock5, sector 0

mkfs.jffs2: write: Input/output error

 

boot log as follow:

 

 

U-Boot 1.3.0 (Jun  9 2015 - 16:10:09) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal Hard

CPU:   e300c3, MPC8313E, Rev: 21 at 333.333 MHz, CSB:  166 MHz

Board: Freescale MPC8313ERDB

I2C:   ready

DRAM:  128 MB

FLASH: 16 MB

cpu_init_r () finished

malloc_bin_reloc () finished

NAND:   in board_nand_init()

nand maf_id:ec, dev_id:75

mtd->name NAND 32MiB 3,3V 8-bit

nand_flash_ids[i].chipsize 32

in fcm_scan_bbt()

32 MiB

env_relocate () finished

getenv(ethaddr)

getenv_IPaddr

leave pci_init

in devices_init ()

devices_init () finished

jumptable_init () finished

In:    serial

Out:   serial

Err:   serial

Net:   TSEC0, TSEC1 [PRIME]

Hit any key to stop autoboot:  0

## Booting image at fe100000 ...

   Image Name:   Linux-2.6.23

   Created:      2015-06-20   6:13:11 UTC

   Image Type:   PowerPC Linux Kernel Image (gzip compressed)

   Data Size:    1534735 Bytes =  1.5 MB

   Load Address: 00000000

   Entry Point:  00000000

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

## Loading RAMDisk Image at fe400000 ...

   Image Name:   uboot ext2 ramdisk rootfs

   Created:      2015-06-08  12:18:26 UTC

   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)

   Data Size:    5877640 Bytes =  5.6 MB

   Load Address: 00000000

   Entry Point:  00000000

   Verifying Checksum ... OK

   Booting using the fdt at 0xfec00000

   Loading Ramdisk to 0795a000, end 07ef4f88 ... OK

   Loading Device Tree to 007fc000, end 007fefff ... OK

Using MPC8313 RDB machine description

Linux version 2.6.23  (gcc version 4.1.2) #425 Sat Jun 20 14:13:10 CST 2015

Found initrd at 0xc795a000:0xc7ef4f88

console [udbg0] enabled

setup_arch: bootmem

mpc8313_rdb_setup_arch()

arch: exit

Zone PFN ranges:

  DMA             0 ->    32768

  Normal      32768 ->    32768

Movable zone start PFN for each node

early_node_map[1] active PFN ranges

    0:        0 ->    32768

Built 1 zonelists in Zone order.  Total pages: 32512

Kernel command line:

IPIC (128 IRQ sources) at fdffc700

PID hash table entries: 512 (order: 9, 2048 bytes)

Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)

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

Memory: 120756k/131072k available (2812k kernel code, 10156k reserved, 340k data, 95k bss, 136k init)

Mount-cache hash table entries: 512

NET: Registered protocol family 16

Generic PHY: Registered new driver

SCSI subsystem initialized

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

NET: Registered protocol family 2

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

TCP established hash table entries: 4096 (order: 3, 32768 bytes)

TCP bind hash table entries: 4096 (order: 2, 16384 bytes)

TCP: Hash tables configured (established 4096 bind 4096)

TCP reno registered

checking if image is initramfs...it isn't (no cpio magic); looks like an initrd

Freeing initrd memory: 5739k freed

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

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler deadline registered

io scheduler cfq registered

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled

serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 18) is a 16550A

serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 19) is a 16550A

console handover: boot [udbg0] -> real [ttyS1]

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

loop: module loaded

fsl-gianfar fsl-gianfar.0: enabling Lossless Flow Control

eth0: Gianfar Ethernet Controller Version 1.3-skbr, 00:e0:0c:00:95:03

GFAR: SKB Handler initialized at CPU#0(max=32)

eth0: MTU = 1500 (frame size=1526, truesize=1800)

eth0: Running with NAPI enabled

eth0: 64/64 RX/TX BD ring size

Marvell 88E1101: Registered new driver

Marvell 88E1112: Registered new driver

Marvell 88E1111: Registered new driver

Marvell 88E1145: Registered new driver

Fixed MDIO Bus: probed

nor: Found 1 x16 devices at 0x0 in 16-bit bank

Amd/Fujitsu Extended Query Table at 0x0040

nor: CFI does not contain boot bank location. Assuming top.

number of CFI chips: 1

cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.

RedBoot partition parsing not available

physmap-flash nor: Using OF partition information

Creating 5 MTD partitions on "nor":

0x00000000-0x00100000 : "U-Boot"

add_mtd_partitions slave->offset:0

add_mtd_partitions master->size: 16777216

0x00100000-0x00400000 : "Kernel"

add_mtd_partitions slave->offset:1048576

add_mtd_partitions master->size: 16777216

0x00400000-0x00c00000 : "rootfs"

add_mtd_partitions slave->offset:4194304

add_mtd_partitions master->size: 16777216

0x00c00000-0x00c10000 : "DTB"

add_mtd_partitions slave->offset:12582912

add_mtd_partitions master->size: 16777216

0x00c10000-0x00d00000 : "config"

add_mtd_partitions slave->offset:12648448

add_mtd_partitions master->size: 16777216

mtd: partition "config" doesn't start on an erase block boundary -- force read-only

Freescale eLBC NAND Driver (C) 2006-2007 Freescale

nand_get_flash_type type->chipsize: 32

nand_get_flash_type chip->chipsize: 33554432

nand_get_flash_type mtd->erasesize:16384

nand_get_flash_type mtd->writesize:512

nand_get_flash_type mtd->oobsize:16

nand_get_flash_type busw: 0 chip->options:256

nand_get_flash_type chip->badblockpos:5

NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)

nand_scan_ident chip->numchips :1 chip->chipsize: 33554432

nand_scan_tail chip->ecc.steps:1

nand_scan_tail chip->ecc.size:512

nand_scan_tail mtd->writesize:512

nand_scan_bbt bd->options:16384

nand_memory_bbt bd->options:16384

create_bbt  Scanning device for bad blocks

create_bbt  bd->options 16384,chip 16384

fsl-elbc fsl-elbc.0: Using OF partition information

Creating 1 MTD partitions on "nand":

0x00000000-0x2000000 : "DATA-NAND"

add_mtd_partitions slave->offset:0

add_mtd_partitions master->size: 33554432

mpc83xx_spi.0: MPC83xx SPI Controller driver at 0xc9062000 (irq = 20)

usbmon: debugfs is not available

Initializing USB Mass Storage driver...

usbcore: registered new interface driver usb-storage

USB Mass Storage support registered.

i2c /dev entries driver

rtc-ds1307: probe of 0-0068 failed with error -5

mmc_spi spi28672.0: SD/MMC host mmc0, no DMA, no WP, no poweroff

TCP cubic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

RAMDISK: Compressed image found at block 0

VFS: Mounted root (ext2 filesystem) readonly.

Freeing unused kernel memory: 136k init

mmc0: error -22 whilst initialising SD card

Mounting filesystems

Running sysctl

Setting up networking on loopback device:

Setting up networking on eth0:

Adding static route for default gateway to 192.168.0.1:

Setting nameserver to 192.168.0.1 in /etc/resolv.conf:

Setting up networking on eth1:

SIOCSIFADDR: No such device

eth1: unknown interface: No such device

SIOCSIFNETMASK: No such device

Adding static route for default gateway to 192.168.0.1:

SIOCADDRT: No such device

Setting nameserver to 192.168.0.1 in /etc/resolv.conf:

Starting inetd:

        Welcome to Freescale Semiconductor Embedded Linux Environment

!!!!! WARNING !!!!!!!

The default password for the root account is: root

please change this password using the 'passwd' command

and then edit this message (/etc/issue) to remove this message

~ # ls

mkfs.jffs2  mtd_debug   openswan

~ # cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00100000 00020000 "U-Boot"

mtd1: 00300000 00020000 "Kernel"

mtd2: 00800000 00020000 "rootfs"

mtd3: 00010000 00020000 "DTB"

mtd4: 000f0000 00020000 "config"

mtd5: 02000000 00004000 "DATA-NAND"

~ # ./mkfs.jffs2 -o /dev/mtdblock5 -n -b -e 0x4000

end_request: I/O error, dev mtdblock5, sector 0

mkfs.jffs2: write: Input/output error

~ # ./mtd_debug read /dev/mtdblock5 0x00 0x09 aa

end_request: I/O error, dev mtdblock5, sector 0

Buffer I/O error on device mtdblock5, logical block 0

end_request: I/O error, dev mtdblock5, sector 0

Buffer I/O error on device mtdblock5, logical block 0

flash_to_file: read, size 0x9, n 0x9

read(): Input/output error

~ #

 

消息编辑者为:ye yue

Outcomes