首先下载nand flash驱动 s3c_nand.c ,此文件包含着nand flash驱动具体的实现,将其复制到drivers/mtd/nand下;
在s3c_nand.c中添加nand flash分区信息,分区内容可以自由设定。
#if defined(CONFIG_ARCH_S5PV210)
struct mtd_partition s3c_partition_info[] = {
{
.name= 'misc',
.offset= (768*SZ_1K), /* for bootloader */
.size= (256*SZ_1K),
.mask_flags= MTD_CAP_NANDFLASH,
},
{
.name= 'recovery',
.offset= MTDPART_OFS_APPEND,
.size= (5*SZ_1M),
},
{
.name= 'kernel',
.offset= MTDPART_OFS_APPEND,
.size= (5*SZ_1M),
},
{
.name= 'ramdisk',
.offset= MTDPART_OFS_APPEND,
.size= (3*SZ_1M),
},
{
.name= 'system',
.offset= MTDPART_OFS_APPEND,
.size= MTDPART_SIZ_FULL,
}
{
.name= 'system',
.offset= MTDPART_OFS_APPEND,
.size= (110*SZ_1M),
},
{
.name= 'cache',
.offset= MTDPART_OFS_APPEND,
.size= (80*SZ_1M),
},
{
.name= 'userdata',
.offset= MTDPART_OFS_APPEND,
.size= MTDPART_SIZ_FULL,
}
#endif
};
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,
};
结构体s3c_nand_mtd_info在源代码是没有的,所以要将其添加进去;
修改 arch/arm/plat-samsung/include/plat/nand.h 添加如下内容:
struct s3c_nand_mtd_info {
uint chip_nr;
uint mtd_part_nr;
struct matd_partition *partition;
};
为了能使s3c_nand.c正确编译,还要修改该目录下,也就是的drivers/mtd/nand的Makefile和Kconfig:
修改driver/mtd/nand/Kconfig添加如下内容:
config MTD_NAND_S3C
tristate 'NAND Flash support for S3C Soc'
depends on ARCH_S5PV210 && 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 www.2cto.com
Enable the use of the S3C's internal ECC generator when
using NAND. Early versons 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, the 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
在Mach-smdkv210.c (archarmmach-s5pv210) 中添加nand flash source,platform_device,需要头文件map.h map.h下载,下载将其放在(archarmmach-s5pv210includemach),在Mach-smdkv210.c中加入#include 添加nand flash source /* NAND Controller */ static struct resource s3c_nand_resource[] = { [0] = { .start= S5PV210_PA_NAND, .end= S5PV210_PA_NAND + S5PV210_SZ_NAND - 1, .flags= IORESOURCE_MEM, } }; struct platform_device s3c_device_nand = { .name= 's5pv210-nand', .id= -1, .num_resources= ARRAY_SIZE(s3c_nand_resource), .resource= s3c_nand_resource, }; 添加platform_device 找到static struct platform_device *smdkv210_devices[] __initdata 添加 #if defined(CONFIG_MTD_NAND_S3C) &s3c_device_nand, #endif 添加时钟信息 在Clock.c (archarmmach-s5pv210) 中找到static struct clk init_clocks_off[],添加 { 添加之后,nand flash驱动才能正确获取时钟。 以上操作完成后,开始配置内核 根目录下make menuconfig Device Drivers ---> <*> Memory Technology Device (MTD) support ---> <*> Caching block device access to MTD devices <*> NAND Device Support ---> <*> NAND Flash support for S3C SoCs [*] S3C NAND Hardware ECC 到了这里,开发板已经支持nand flash驱动。 接下来 配置后保存,make clean ,make zImage 将zImage下载进开发板。从串口信息可以看出nand flash驱动是否完成: S3C NAND Driver, (c) 2008 Samsung Electronics
.name = 'nand',
.id = -1,
.parent = &clk_hclk_psys.clk,
.enable = s5pv210_clk_ip1_ctrl,
.ctrlbit = ((1 << 28) | (1 << 24)),
},
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Creating 5 MTD partitions on 's5pv210-nand':
0x0000000c0000-0x000000100000 : 'misc'
0x000000100000-0x000000600000 : 'recovery'
0x000000600000-0x000000b00000 : 'kernel'
0x000000b00000-0x000000e00000 : 'ramdisk'
0x000000e00000-0x000010000000 : 'system'
上一篇:修改 Linux 内核 DM9000 支持 tiny210 开发板
下一篇:tiny210V2 Uboot kernel filesystem 烧写和启动
推荐阅读最新更新时间:2026-03-20 19:08
- ADR435B 5 Vout 超低噪声 XFET 电压基准的典型应用,具有灌电流和拉电流能力
- 使用 Analog Devices 的 ADP8140 的参考设计
- NCP699SN30T1G 150mA、3 路输出电压 CMOS 低 Iq LDO 的典型应用,在 TSOP-5 中启用
- ZTL431过压/欠压保护电路典型应用
- 使用 Microchip Technology 的 DVR2802B3 的参考设计
- 开源的浮游生物监测分析设备PlanktoScope
- STK503,旨在评估 AT90USB AVR MCU 的入门套件,通过 AVR Studio 支持 JTAGICE mkII 和 AVRISP mkII
- 使用 BittWare 的 XCVU190 的参考设计
- 远程声控参考设计
- NCP4354AADAPGEVB,用于 NCP4354、65W 适配器关闭模式控制器的评估板

嵌入式系统技术与设计
1.3寸 OLED液晶显示
现代雷达系统的信号设计
BFR340T






京公网安备 11010802033920号