s5pc100開發板Nand flash移植

來源:互聯網
上載者:User

標籤:

相關軟體:http://pan.baidu.com/s/16yo8Y

fsc100開發板

交叉編譯工具:arm-cortex_a8-linux-gnueabi-gcc

 

?   添加針對我們平台的Nand flash驅動

拷貝s3c_nand.c到drivers/mtd/nand下

拷貝regs-nand.h到arch/arm/mach-s5pc100/include/mach下

?   針對平台上的nand flash裝置,修改drivers/mtd/nand/nand_base.c第2812行

for  (i = 0; i < 5; i++)

  • 添加核心配置選項

修改drivers/mtd/nand/Kconfig,在if  mtd_nand下面添加如下內容:

 

config  MTD_NAND_S3C

        tristate "NAND Flash support for S3C SoC"

        depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX || ARCH_S5PC100) && 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

 

修改drivers/mtd/nand/Makefile添加如下內容:

obj-$(CONFIG_MTD_NAND_S3C)  +=  s3c_nand.o

 

  • 修改平台代碼

修改arch/arm/mach-s5pc100/mach-smdkc100.c添加如下內容:

 

  • 添加標頭檔

#if defined (CONFIG_MTD_NAND_S3C)

#include <linux/mtd/partitions.h>

#include <linux/mtd/mtd.h>

#include <plat/nand.h>

#endif

 

  • 添加平台裝置

#if defined(CONFIG_MTD_NAND_S3C)

/* Nand Flash Support */

static struct mtd_partition s5pc100_nand_part[] = {

        [0] = {

                .name        = "bootloader",

                .size        = SZ_1M,

                .offset        = 0,

        },

        [1] = {

                .name        = "kernel",

                .offset = MTDPART_OFS_APPEND,

                .size        = SZ_1M*3,

        },

        [2] = {

                .name        = "rootfs",

                .offset               = MTDPART_OFS_APPEND,

                .size        = SZ_4M,

        },

        [3] = {

                .name        = "usrfs",

                .offset        = MTDPART_OFS_APPEND,

                .size        = MTDPART_SIZ_FULL,

        },

};

 

struct s3c_nand_mtd_info s5pc100_nand_mtd_part_info = {

        .chip_nr = 1,

        .mtd_part_nr = ARRAY_SIZE(s5pc100_nand_part),

        .partition = s5pc100_nand_part,

};

 

static struct resource s5pc100_nand_resource[] = {

        [0] = {

                .start = 0xE7200000,

                .end   = 0xE7200000 + SZ_1M,

                .flags = IORESOURCE_MEM,

        }

};

 

struct platform_device s5pc100_device_nand = {

        .name                  = "s5pc100-nand",

        .id                  = -1,

        .num_resources          = ARRAY_SIZE(s5pc100_nand_resource),

        .resource          = s5pc100_nand_resource,

        .dev = {

                .platform_data = &s5pc100_nand_mtd_part_info,

        }

};

#endif

 

  • 添加平台裝置列表

在smdkc100_device[]結構體數組中添加如下內容:

#if defined(CONFIG_MTD_NAND_S3C)

        &s5pc100_device_nand,

#endif

 

  • 修改arch/arm/plat-samsung/include/plat/nand.h添加如下內容:

struct s3c_nand_mtd_info {

        uint chip_nr;

        uint mtd_part_nr;

        struct mtd_partition *partition;

};

 

  • 配置核心

$ make menuconfig

Device Drivers  --->

        <*> Memory Technology Device (MTD) support  --->

               [*]   MTD partitioning support

<*>   Caching block device access to MTD devices

               <*>   NAND Device Support  --->

                      <*>   NAND Flash support for S3C SoC

                      [*]     S3C NAND Hardware ECC

 

File Systems  --->

         Partition  Types  --->

                [*]    Advanced partition selection

                [*]    PC  BIOS  (MSDOS  partition  tables)  support

                [*]         BSD  disklabel  (FreeBSD  partition  tables)  support

 

  • 編譯核心並拷貝到tftpboot下

$ make  zImage

$ cp  arch/arm/boot/zImage  /tftpboot

 

  • 測試

啟動目標板,在目標板上完成如下操作:

# cat  /proc/mtd

dev:        size       erasesize     name

mtd0: 00100000 00020000  "bootloader"

mtd1: 00300000 00020000  "kernel"

mtd2: 00400000 00020000  "rootfs"

mtd3: 0f800000 00020000  "usrfs"

 

s5pc100開發板Nand flash移植

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.