Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / S3C6410(arm11核)的nandflash移植

第一步,配置内核<*>Memory Technology Device (MTD) support --->
[*] MTD partitioning support
<*> NAND Device Support  --->
<*> NAND Flash support for Samsung S3C SoCs
<*> Support for generic platform NAND driver第二步:配置资源,添加以下代码(1)头文件
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/mtd/partitions.h>
#include <plat/nand.h>(2)配置信息
#define SZ_1K                         0x00000400
#define SZ_1M                         0x00100000
/* NAND flash controller */
#define S3C64XX_PA_NAND          (0x70200000)
#define S3C64XX_SZ_NAND         SZ_1M
 
struct mtd_partition s3c_partition_info[] ={
     {
                .name           = "Bootloader",
                .offset            = 0,
                .size        = (4 * 128 *SZ_1K),
                .mask_flags    = MTD_CAP_NANDFLASH,
     },
     {
                .name           = "Kernel",
                .offset            = (4 * 128 *SZ_1K),
                .size        = (5*SZ_1M) ,
                .mask_flags    = MTD_CAP_NANDFLASH,
        },
     {
                .name           = "File System",
                .offset            = MTDPART_OFS_APPEND,
                .size        = MTDPART_SIZ_FULL,
     }
 
};
 
static struct s3c2410_nand_sets3c6410_nand_sets[] = {
     [0]= {
              .name           = "nand",
              .nr_chips = 1,
              .nr_partitions  = ARRAY_SIZE(s3c_partition_info),
              .partitions     = s3c_partition_info,
     },
};
 
static struct s3c2410_platform_nands3c6410_nand_info = {
     .tacls              = 25,
     .twrph0          = 55,
     .twrph1          = 40,
     .nr_sets = ARRAY_SIZE(s3c6410_nand_sets),
     .sets        = s3c6410_nand_sets,
};(3)注册nandflah设备1.在static void __init smdk6410_machine_init(void)函数中添加以下代码
s3c_nand_set_platdata(&s3c6410_nand_info);2.添加平台设备static struct platform_device*anw6410_devices[] __initdata = {     &s3c_device_fb,     &anw6410_lcd_powerdev,     &anw6410_device_eth,     //新添加     &s3c_device_nand,};