注册 登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

蒙奇D小豌豆的博客

蒙奇D小豌豆的学习记录

 
 
 

日志

 
 

华恒HHs3c6410内核Nand flash移植  

2010-05-05 23:08:38|  分类: others |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 

(1)复制2.6.24下drivers\mtd\nand\s3c_nand.c到2.6.26里面

修改Kconfig

config MTD_NAND_S3C

tristate "NAND Flash support for S3C SoC"

depends on ARCH_S3C64XX && MTD_NAND

help

   This enables the NAND flash controller on the S3C.

   No board specfic support is done by this driver, each board

   must advertise a platform_device for the driver to attach.

config MTD_NAND_S3C_DEBUG

bool "S3C NAND driver debug"

depends on MTD_NAND_S3C

help

   Enable debugging of the S3C NAND driver

config MTD_NAND_S3C_HWECC

bool "S3C NAND Hardware ECC"

depends on MTD_NAND_S3C

help

   Enable the use of the S3C's internal ECC generator when

   using NAND. Early versions of the chip have had problems with

   incorrect ECC generation, and if using these, the default of

   software ECC is preferable.

   If you lay down a device with the hardware ECC, then you will

   currently not be able to switch to software, as there is no

   implementation for ECC method used by the S3C

修改makefile

obj-$(CONFIG_MTD_NAND_S3C)   += s3c_nand.o

(2)在/arch/arm/mach-s3c6410/mach-smdk6410.c添加设备以及分区信息

/*NAND  FLASH*/

 

#define  S3C6410_PA_NAND        (0x70200000)    /*physical  addr*/

#define  S3C6410_SZ_NAND        SZ_1M       /*size*/

struct mtd_partition s3c_partition_info[] = {

        {

                .name       = "Bootloader",

                .offset     = 0,

                .size       = (256*SZ_1K),

                .mask_flags = MTD_CAP_NANDFLASH,

        },

        {

                .name       = "Kernel",

                .offset     = (256*SZ_1K),    /* Block number is 0x10 */

                .size       = (15*SZ_1M) - (256*SZ_1K),

                .mask_flags = MTD_CAP_NANDFLASH,

        },

#if defined(CONFIG_SPLIT_ROOT_FILESYSTEM)

        {

                .name       = "Root - Cramfs",

                .offset     = (15*SZ_1M),    /* Block number is 0x80 */

                .size       = (48*SZ_1M),

        },

#endif

        {

                .name       = "File System",

                .offset     = MTDPART_OFS_APPEND,

                .size       = MTDPART_SIZ_FULL,

        }

}

struct s3c_nand_mtd_info s3c_nand_mtd_part_info = {

    .chip_nr = 1,

    .mtd_part_nr = ARRAY_SIZE(s3c_partition_info),

    .partition = s3c_partition_info,

};

struct s3c_nand_mtd_info * get_board_nand_mtd_info (void)

{

    return &s3c_nand_mtd_part_info;

}

static struct resource s3c_nand_resource[] = {

    [0] = {

    .start = S3C6410_PA_NAND,

    .end   = S3C6410_PA_NAND + S3C6410_SZ_NAND  - 1,

    .flags = IORESOURCE_MEM,

}

};

struct platform_device s3c_device_nand = {

.name        = "s3c-nand",

.id        = -1,

.num_resources    = ARRAY_SIZE(s3c_nand_resource),

.resource    = s3c_nand_resource,

.dev = {

.platform_data = &s3c_nand_mtd_part_info

}

};

添加设备

static struct platform_device *smdk6410_devices[] __initdata = {

&s3c_device_nand, //add by wx

}

(3)还需要加载yaffs文件系统

拷贝友善的送的2.6.29下的fs/yaffs目录 到我们的fs目录下

然后修改观察一下友善的送的2.6.29下的fs/Kconfig 和 fs/Makefile和我们的有什么不同

在我们的Kconfig中的 source “fs/jffs2/Kconfig” 上面加上 source “fs/yaffs/Kconfig”

在Makefile中的 obj-$(CONFIG_FAT_FS) += fat/ 上面加上 obj-$(CONFIG_YAFFS_FS) += yaffs/

然后在配置的 File systems->Miscellaneous filesystems 中选上 “YAFFS2file system support”  “Autoselect yaffs format”  “Cache short names in RAM”

打开配置进入Device Drivers

Memory Technology Device ......... 前面是个M~ 说明这个模块是动态加载的,而我们编译的zImage里面只有静态模块

将MTD选为静态加载,然后进入MTD配置中看看还有什么需要选的

NAND Device Support 这个也是动态,选为静态加载

进入NAND Device Support

<*>   NAND Flash support for S3C SoC

(5)编译后看到启动信息如下:

S3C NAND Driver, (c) 2007 Samsung Electronics

S3C NAND Driver is using hardware ECC.

NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)

Creating 3 MTD partitions on "NAND 1GiB 3,3V 8-bit":

0x00000000-0x00040000 : "Bootloader"

0x00040000-0x00f00000 : "Kernel"

0x00f00000-0x40000000 : "File System"

 

进入linux后

#

#mount -t yaffs /dev/mtdblock2 /mnt/nand

yaffs: dev is 32505858 name is "mtdblock2"

yaffs: passed flags ""

yaffs: Attempting MTD mount on 31.2, "mtdblock2"

yaffs: auto selecting yaffs2

yaffs: restored from checkpoint

#cd  /mnt/nand

#ls

Lost+found

在/mnt/nand下看到yaffs文件系统

  评论这张
 
阅读(934)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018