?????? ???drivers/mtd/nand/Makefile????????????19?У???
????obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
????4. ?????????
???????arch/arm/mach-s5pc100/mach-smdkc100.c????????????
?????? ???????
1 #if defined (CONFIG_MTD_NAND_S3C)
2 #include <linux/mtd/partitions.h>
3 #include <linux/mtd/mtd.h>
4 #include <plat/nand.h>
5 #endif
?? ??????豸
01 #if defined(CONFIG_MTD_NAND_S3C)
02 /* Nand Flash Support */
03 static struct mtd_partition s5pc100_nand_part[] = {
04        [0] = {
05                .name = "bootloader"??
06                .size = SZ_1M??
07                .offset = 0??
08        }??
09        [1] = {
10                .name = "kernel"??
11                .offset = MTDPART_OFS_APPEND??
12                .size = SZ_1M*3??
13        }??
14        [2] = {
15                .name = "rootfs"??
16                .offset = MTDPART_OFS_APPEND??
17                .size = MTDPART_SIZ_FULL??
18        }??
19 };
20
21 struct s3c_nand_mtd_info s5pc100_nand_mtd_part_info = {
22        .chip_nr = 1??
23        .mtd_part_nr = ARRAY_SIZE(s5pc100_nand_part)??
24        .partition = s5pc100_nand_part??
25 };
26
27 static struct resource s5pc100_nand_resource[] = {
28        [0] = {
29                .start = 0xE7200000??
30                .end = 0xE7200000 + SZ_1M??
31                .flags = IORESOURCE_MEM??
32        }
33 };
34
35 struct platform_device s5pc100_device_nand = {
36        .name = "s5pc100-nand"??
37        .id = -1??
38        .num_resources = ARRAY_SIZE(s5pc100_nand_resource)??
39        .resource = s5pc100_nand_resource??
40        .dev = {
41                .platform_data = &s5pc100_nand_mtd_part_info??
42        }
43 };
44 #endif
?????? ??????豸?б?
??????smdkc100_device[]??????????????????????
????1 #if defined(CONFIG_MTD_NAND_S3C)
????2        &s5pc100_device_nand??
????3 #endif
????5. ??????????
???????arch/arm/plat-samsung/include/plat/nand.h????????????
1 #if defined(CONFIG_MTD_NAND_S3C)
2 struct s3c_nand_mtd_info {
3        uint chip_nr;
4        uint mtd_part_nr;
5        struct mtd_partition *partition;
6 };
7 #endif
????6. ???????
$ make menuconfig
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> Caching block device access to MTD devices
<*> NAND Device Support --->
<*> NAND Flash support for S3C SoC
[*] S3C NAND Hardware ECC
-*- Enable the block layer --->
Partition Types --->
[*] Advanced partition selection
[*] PC BIOS (MSDOS partition tables) support
[*] BSD disklabel (FreeBSD partition tables) support
????7. ???????
??????????????????tftpboot???
????$ make zImage
????$ cp arch/arm/boot/zImage /tftpboot
????8. ????
??????????壬??????????????2?????
????# cat /proc/mtd
?????????????????Nand Flash????????
????dev: size erasesize name
????mtd0: 00100000 00020000 "bootloader"
????mtd1: 00300000 00020000 "kernel"
????mtd2: 0fc00000 00020000 "rootfs"