Sunday, August 4, 2013

X86 vs PowerPC MTD

On X86:
[    3.804476] physmap platform flash device: 04000000 at c0000000
[    3.807024] physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
[    3.807072] physmap-flash.0: CFI does not contain boot bank location. Assuming top.
[    3.807342] Using physmap partition information
[    3.807346] Creating 3 MTD partitions on "physmap-flash.0":
[    3.807358] mtd: Giving out device 0 to X Space
[    3.807621] mtd: Giving out device 1 to Y Space
[    3.807873] mtd: partition "Z Area" extends beyond the end of device "physmap-flash.0" -- size truncated to 0x2fe0000
[    3.807878] mtd: Giving out device 2 to Z Area
[   12.598251] MTDSB: lookup_bdev() returned 0
[   12.598262] MTDSB: New superblock for device 2 ("Z  Area")
[   14.001189] mtd: Giving out device 3 to nvram
[   14.001496] slram: Registered device nvram from 3211264KiB to 3213312KiB
[   20.868604] MTDSB: lookup_bdev() returned 0
[   20.868610] MTDSB: Device 2 ("Z Area") is already mounted

Commands to program things to flash/nvram using jffs2 fileystem.

bash-3.2# flashcp test.img /dev/mtd3
bash-3.2# flash_eraseall -j /dev/mtd3
Erasing 16 Kibyte @ 1fc000 -- 99 % complete. Cleanmarker written at 1fc000.
bash-3.2# mkdir /mnt/flash
bash-3.2# mount -t jffs2 /dev/mtdblock3 /mnt/flash
bash-3.2# ls -al test.img
-rw-rw-rw- 1 root root 262144 Jan  9 00:34 test.img
bash-3.2# cp test.img /mnt/flash/
bash-3.2# md5sum /mnt/flash/test.img
ec87a838931d4d5d2e94a04644788a55  /mnt/flash/test.img

bash-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 01000000 00020000 "X Space"
mtd1: 00020000 00020000 "Y Space"
mtd2: 02fe0000 00020000 "Z Area"
mtd3: 00200000 00004000 "nvram"



For Linux MTD subsystem, refer to:
http://www.linux-mtd.infradead.org/; So
  • MTD can be used for char device
  • MTD can be used for block device with FTL(Flash Translation Layer)
  • MTD devices are quite different from Block devices
  • MTD device can be used for JFFS2 and UBIFS

On PowerPC:

MPC834xflash device: 4000000 at fc000000 Partition number 7
MPC834xFlash Map Info: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
MPC834xFlash Map Info: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
Creating 7 MTD partitions on "MPC834xFlash Map Info":
0x00000000-0x00100000 : "HWRCW"
0x00100000-0x00700000 : "Config"
0x00700000-0x00b00000 : "Kernel1"
0x00b00000-0x02300000 : "AppPkg1"
0x02300000-0x02700000 : "Kernel2"
0x02700000-0x03f00000 : "AppPkg2"
0x03f00000-0x04000000 : "U-Boot"
MPC834xflash device initialized
MPC834xflash device: 2000000 at f8000000 Partition number 2
MPC834xLog Flash Map Info: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
MPC834xLog Flash Map Info: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
Creating 2 MTD partitions on "MPC834xLog Flash Map Info":
0x00000000-0x00400000 : "Lograw"
0x00400000-0x02000000 : "Log"
MPC834xflash device initialized



Flash devices are mapped into Linux kernel for MTD subsystem. Two Chips are configured. One is 64MB(4000000 ), the other is 32MB(2000000. The first is mapped to  fc000000, while the second is mapped to f8000000. The first has 7 partitions, while the 2nd has 2 partitions.

No comments:

Post a Comment