This patch adds NAND driver to recent git. Tested on DM6446 DVEVM.

It is mainly based on Sander Huijsen <[EMAIL PROTECTED]> work [1]. Many thanks!

To use/test it, you have to configure DVEVM:

- jumper J4 set to NAND
- S3-1 and S3-2 set to OFF (NAND boot)
- S3-3 set to OFF (8-bit CS2 bus width)

Note that on DVEVM you have only access to NAND if jumper J4 is set to NAND. Cause of CS2 switching then you have no access to e.g. bootloader (uboot) in NOR any more. This implies that you have a bootloader in NAND, e.g. by using tools [2]. Or you compile driver as module, boot from NOR and then switch J4 loading nand driver as module. Thanks to Kevin for this trick!

Then configure your kernel with

CONFIG_MTD=y
CONFIG_MTD_PARTITIONS=y

CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y

CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_VERIFY_WRITE=y
CONFIG_MTD_NAND_IDS=y
CONFIG_MTD_NAND_DAVINCI=y

and for filesystem e.g.:

CONFIG_JFFS2_FS=y
CONFIG_JFFS2_FS_DEBUG=0
CONFIG_JFFS2_FS_WRITEBUFFER=y
CONFIG_JFFS2_ZLIB=y
CONFIG_JFFS2_RTIME=y

Booting this kernel you will get something like:

...
DaVinci NAND Controller rev. 2.1
Warning: MUX config for NAND: Set PINMUX0 reg to 0x8001cc1f, was 0x80030c1f, should be done by bootloader. Warning: NAND config: Set A1CR reg to 0x0432018c, was 0x0432229c, should be done by bootloader. NAND device: Manufacturer ID: 0xec, Chip ID: 0x36 (Samsung NAND 64MiB 1,8V 8-bit)
Bad block scan: 0 out of 4096 blocks are bad.
Creating 1 MTD partitions on "NAND 64MiB 1,8V 8-bit":
0x00500000-0x04000000 : "User Space"
...

Once logged in, do something like

...
# ll /dev/mtd0
crw-rw-rw-    1 root     root      90,   0 Jul 25  2002 /dev/mtd0
# ll /dev/mtdblock0
brw-rw-rw-    1 root     disk      31,   0 Jul 25  2002 /dev/mtdblock0
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 03b00000 00004000 "User Space"
# flash_eraseall -j /dev/mtd0
Erasing 16 Kibyte @ 3afc000 -- 30 % complete. Cleanmarker written at 3afc000.
# mount -t jffs2 /dev/mtdblock0 /mnt/nand
# ll /mnt/nand/
drwxr-xr-x    3 root     root            0 Jan  1  1970 .
drwxr-xr-x    5 root     root         1024 Jan  1 12:04 ..
# echo "Hello NAND" > /mnt/nand/test
# ll /mnt/nand/
drwxr-xr-x    3 root     root            0 Jan  1 12:05 .
drwxr-xr-x    5 root     root         1024 Jan  1 12:04 ..
-rw-r--r--    1 root     root           11 Jan  1 12:05 test
# cat /mnt/nand/test
Hello NAND
# reboot

...

# mount -t jffs2 /dev/mtdblock0 /mnt/nand
# ll /mnt/nand/
drwxr-xr-x    3 root     root            0 Jan  1  1970 .
drwxr-xr-x    5 root     root         1024 Jan  1 12:00 ..
-rw-r--r--    1 root     root           11 Jan  1 12:05 test
# cat /mnt/nand/test
Hello NAND

This patch series v2 replaces older patch [3].

Best regards

Dirk

[1]
http://linux.omap.com/pipermail/davinci-linux-open-source/2007-December/004788.html

[2] http://wiki.davincidsp.com/index.php?title=RBL_UBL_and_host_program

[3] http://linux.omap.com/pipermail/davinci-linux-open-source/2008-January/004859.html

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to