Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1034926
  • 博文数量: 297
  • 博客积分: 11721
  • 博客等级: 上将
  • 技术积分: 3431
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 10:21
文章分类

全部博文(297)

文章存档

2016年(9)

2011年(71)

2010年(137)

2009年(80)

分类: LINUX

2010-05-14 14:11:07

Mini2440移植nand驱动并更改分区信息

 

1.创建自己的mini2440驱动:

(1)

cp   arch/arm/plat-s3c24xx/common-smdk.c arch/arm/plat-s3c24xx/common-mini2440.c

cp   arch/arm/plat-s3c24xx/include/plat /common-smdk.h      arch/arm/plat-s3c24xx/include/plat       /common-mini2440.h

(2)

修改common-mini2440.c文件内容如下:

/* NAND parititon from 2.4.18-swl5 */

//替换 :%s/smdk/mini2440/g

//删除LED的无关代码

 

//common-mini2440.c

static struct mtd_partition mini2440_default_nand_part[] = {

        [0] = {

                .name   = "superviv",

                .size   = 0x00030000,

                .offset = 0,

        },

        [1] = {

                .name   = "kernel",

                .offset = 0x00050000,

                .size   = 0x00200000,

        },

        [2] = {

                .name   = "root",

                .offset = 0x00250000,

                .size   = 0x03dac000,

        }

};

 

static struct s3c2410_nand_set mini2440_nand_sets[] = {

        [0] = {

                .name           = "NAND",

                .nr_chips       = 1,

                .nr_partitions  = ARRAY_SIZE(mini2440_default_nand_part),

                .partitions     = mini2440_default_nand_part,

        },

};

 

/* choose a set of timings which should suit most 512Mbit

 * chips and beyond.

*/

 

static struct s3c2410_platform_nand mini2440_nand_info = {

        .tacls          = 20,

        .twrph0         = 60,

        .twrph1         = 20,

        .nr_sets        = ARRAY_SIZE(mini2440_nand_sets),

        .sets           = mini2440_nand_sets,

};

 

/* devices we initialise */

 

static struct platform_device __initdata *mini2440_devs[] = {

        &s3c_device_nand,

        &s3c_device_sdi,

        &s3c_device_usbgadget,

};

 

void __init mini2440_machine_init(void)

{

 

        s3c_device_nand.dev.platform_data = &mini2440_nand_info;

 

        platform_add_devices(mini2440_devs, ARRAY_SIZE(mini2440_devs));

 

        s3c_pm_init();

}

   

(3)修改mini2440.h内容如下:

 

/* linux/include/asm-arm/plat-s3c24xx/common-mini2440.h

 *

 * This program is free software; you can redistribute it and/or modify

 * it under the terms of the GNU General Public License version 2 as

 * published by the Free Software Foundation.

*/

 

extern void mini2440_machine_init(void);

 

 

 

 

 

4)修改 arch/arm/plat-s3cxx/Kconfig ,添加:

config MACH_MINI2440

        bool

        help

          Common machine code for MINI2440 and MINI2440

~      

 

5)修改arch/arm/plat-s3cxx/Makefile ,添加

obj-$(CONFIG_MACH_MINI2440)             += common-mini2440.o                         

阅读(410) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~