说明:分析Linux内核中的nand flash驱动drivers/mtd/nand/s3c2410.c文件中的相应函数, 配置内核,支持NandFlash Device Drivers ---> <*> Memory Technology Device (MTD) support ---> [*] MTD partitioning support <*> NAND Device Support ---> <*> NAND Flash support for S3C/S3C SoC
其中的static int s3c2410_nand_setrate(struct s3c2410_nand_info *info)函数发现:
struct s3c2410_platform_nand *plat = info->platform;
int tacls_max = (info->cpu_type == TYPE_S3C2412) ? 8 : 4;
…………
info->clk_rate = clkrate;
clkrate /= 1000; /* turn clock into kHz for ease of use */
if (plat != NULL) {
tacls = s3c_nand_calc_rate(plat->tacls, clkrate, tacls_max);
twrph0 = s3c_nand_calc_rate(plat->twrph0, clkrate, 8);
twrph1 = s3c_nand_calc_rate(plat->twrph1, clkrate, 8);
} else {
/* default timings */
tacls = tacls_max;
twrph0 = 8;
twrph1 = 8;
}
if (tacls < 0 || twrph0 < 0 || twrph1 < 0) {
dev_err(info->device, "cannot get suitable timings\n");
return -EINVAL;
}
dev_info(info->device, "Tacls=%d, %dns Twrph0=%d %dns, Twrph1=%d %dns\n",
tacls, to_ns(tacls, clkrate), twrph0, to_ns(twrph0, clkrate), twrph1, to_ns(twrph1, clkrate));
由以上内容可以看出,如果内核并没有使用我们的s3c_platform结构体中的配置,就会采用
} else {
/* default timings */
tacls = tacls_max;
twrph0 = 8;
twrph1 = 8;
}
中的配置信息。这点和我们改的内核输出s3c24xx-nand s3c2440-nand: Tacls=4, 39ns Twrph0=8 79ns, Twrph1=8 79ns完全符合。
因此可以判断我们需要在mach-mini2440.c的smdk6410_machine_init(void)函数中增加s3c_nand_set_platdata(&s3c_platform);
Linux2.6.34.2在TQ6410上的移植详解(3)
内容版权声明:除非注明,否则皆为本站原创文章。