您的位置:首页 > 其它

s3c6410(arm11核)的nandflash移植

2013-03-12 19:05 302 查看
第一步,配置内核

<*>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,

};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: