【实验目的】
Nand flash 是嵌入式系统最常用的内部存储设备,通过移植Nand flash驱动,了解Linux内核Nand Flash的实现。
说明:在本系统移植课程实验中命令行提示符“$”表示是在主机上执行,“#”表示在目标板执行。
【实验环境】
● 主机:Ubuntu 10.10 (64bit);
● 目标机:FS_S5PC100平台;
● 交叉编译工具链:arm-eabi-4.4.0(Android4.0.4自带交叉工具链);
【实验步骤】
1. 添加驱动文件
添加针对我们平台的Nand flash驱动。
● 拷贝s3c_nand.c到drivers/mtd/nand下;
● 拷贝regs-nand.h到arch/arm/mach-s5pc100/include/mach下;
cp s3c_nand.c drivers/mtd/nand
cpregs-nand.h arch/arm/mach-s5pc100/include/mach
2. 修改文件
针对平台上的nand flash设备,修改drivers/mtd/nand/nand_base.c第2975行。
for (i = 0; i< 5; i++)
3. 配置文件修改
● 修改drivers/mtd/nand/Kconfig,在if mtd_nand(216行)下面添加如下内容:
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 |