OneNAND

The OneNAND is a highly reliable embedded memory targeted for both consumer electronic, and next generation mobile phone market. With accumulated NAND flash technologies over the last decade, the company designs an ideal single memory chip based on NAND architecture integrating SRAM buffers and logic interface. The OneNAND takes both advantages from high-speed data read function of NOR flash and the advanced data storage function of NAND flash.

Application RequiresNAND OneNAND NOR
Fast Random Read o
Fast Sequential Read o o o
Fast Write/Program o o
Multi Block Erase o (Max 64 blocks) o
Erase Suspend/Resume o o
Copybacko (EDC) o (ECC)
Lock/Unlock/Lock-Tight o o
ECC External (Hardware/Software) Internal X
Scalablity o o

JFFS2 on OneNAND

It has the same behavior of bare NAND


JFFS2 specific information

JFFS2 Out of Band usage

JFFS2 uses the default autoplacement scheme. The only JFFS2 specific usage of the oob area is the storage of the cleanmarker

Nand chips with 1048 byte pagesize and 32 byte OOB size
Nand chips with 2048 byte pagesize and 64 byte OOB size

OffsetContentComment
0x02Clean marker byte 0This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x85. In the remaining pages this byte is reserved
0x03Clean marker byte 1This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x19. In the remaining pages this byte is reserved
0x04Clean marker byte 2This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x03. In the remaining pages this byte is reserved
0x0eClean marker byte 3This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x20. In the remaining pages this byte is reserved
0x0fClean marker byte 4This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x08. In the remaining pages this byte is reserved
0x12Clean marker byte 5This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x00. In the remaining pages this byte is reserved
0x13Clean marker byte 6This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x00. In the remaining pages this byte is reserved
0x14Clean marker byte 7This byte indicates that a block was erased under JFFS2 control. If the page was successfully erased this byte in the first page of a block is programmed to 0x00. In the remaining pages this byte is reserved

UBI on OneNAND

You can use the UBI on OneNAND

Here's full sequences of UBI on OneNAND.

onenand partitions

Muxed OneNAND 128MB 1.8V 16-bit (0x30)
Scanning device for bad blocks
Bad eraseblock 4 at 0x00080000
Bad eraseblock 32 at 0x00400000
Bad eraseblock 1008 at 0x07e00000
Creating 6 MTD partitions on "onenand":
0x00000000-0x00020000 : "X-Loader + U-Boot"
0x00020000-0x00040000 : "params"
0x00040000-0x00240000 : "kernel"
0x00240000-0x01240000 : "rootfs"
0x01240000-0x03240000 : "filesystem00"
0x03240000-0x08000000 : "filesystem01"

/ # /mtd-utils/eraseall /dev/mtd3
Erasing onenand_erase: attempt to erase a bad block at addr 0x00400000
Erasing 128 Kibyte @ 1c0000 -- 10 % complete.
MTD Erase failure: Input/output error
Erasing 128 Kibyte @ fe0000 -- 99 % complete.

There's one initial bad block, so we can't use this partition as block device such as cramfs

Load ubi module

/ # insmod /mtd-utils/ubi.ko mtd=3
Using /mtd-utils/ubi.ko
UBI: background thread "ubi_bgt0d" started, PID 192
UBI: empty MTD device detected
UBI: create volume table (copy #1)
UBI: create volume table (copy #2)
UBI: mean erase counter: 0
UBI: attached mtd3 to ubi0
UBI: MTD device name: "rootfs"
UBI: MTD device size: 16 MB
UBI: physical eraseblock size: 131072 bytes (128 KB)
UBI: logical eraseblock size: 126976 bytes
UBI: number of good PEBs: 127
UBI: number of bad PEBs: 1
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI: max. allowed volumes: 124
UBI: wear-levelling threshold: 4096
UBI: number of internal volumes: 2
UBI: number of user volumes: 0
UBI: available PEBs: 122
UBI: total number of reserved PEBs: 5
UBI: number of PEBs reserved for bad PEB handling: 1

Create ubi volume

/ # /mtd-utils/ubimkvol -s 10485760 -N rootfs-cramfs -d 0
/ # cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "X-Loader + U-Boot"
mtd1: 00020000 00020000 "params"
mtd2: 00200000 00020000 "kernel"
mtd3: 01000000 00020000 "rootfs"
mtd4: 02000000 00020000 "filesystem00"
mtd5: 04dc0000 00020000 "filesystem01"
mtd6: 00a0d000 0001f000 "rootfs-cramfs" <- ubi partition

ubi parition, mtd6 is created.

copy cramfs image to ubi partition

/ # cp cramfs.img /dev/mtdblock6

mount cramfs and test

/ # mount -t cramfs /dev/mtdblock6 /tmp
/ # cd /tmp
/tmp # ls
bin dev lib proc tmp var
cramfs etc mnt sbin usr
/tmp # mount
/dev/mtdblock6 on /tmp type cramfs (ro)

create jffs2 ubi partition

/ # /mtd-utils/ubimkvol -s 4194304 -N rootfs-jffs2 -d 0
/ # cat /proc/mtd
dev: size erasesize name
mtd0: 00020000 00020000 "X-Loader + U-Boot"
mtd1: 00020000 00020000 "params"
mtd2: 00200000 00020000 "kernel"
mtd3: 01000000 00020000 "rootfs"
mtd4: 02000000 00020000 "filesystem00"
mtd5: 04dc0000 00020000 "filesystem01"
mtd6: 00a0d000 0001f000 "rootfs-cramfs"
mtd7: 0041e000 0001f000 "rootfs-jffs2"

ubi partition, mtd7 is created.

mount jffs2 and test

/ # mount -t jffs2 /dev/mtdblock7 /mnt
JFFS2 write-buffering enabled buffer (2048) erasesize (126976)
/ # mount
/dev/mtdblock6 on /tmp type cramfs (ro)
/dev/mtdblock7 on /mnt type jffs2 (rw)

/ # cd /mnt
/mnt # cat /proc/filesystems > filesystem
/mnt # cat filesystem
the contents of filesystem...
/mnt # cd ..
/ # umount /mnt
/ # mount -t jffs2 /dev/mtdblock7 /mnt
JFFS2 write-buffering enabled buffer (2048) erasesize (126976)
/ # cd /mnt
/mnt # cat filesystem
the same contents of filesystem...


Yaffs2

The yaffs2 can run on OneNAND

If your yaffs2 doesn't work, please check this patch


FAQ

Please see the OneNAND section in MTD FAQ's


References:

Experimental patches

Cache Read support

Sync. Burst Block Read support

Open Source

Yaffs

Hardware

Samsung

Valid XHTML 1.0! Valid CSS!