Linux2.6.34.2在TQ6410上的移植详解(3)

说明:分析Linux内核中的nand flash驱动drivers/mtd/nand/s3c2410.c文件中的相应函数,
其中的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.csmdk6410_machine_init(void)函数中增加s3c_nand_set_platdata(&s3c_platform);

配置内核,支持NandFlash

Device Drivers --->

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

[*] MTD partitioning support

<*> NAND Device Support --->

<*> NAND Flash support for S3C/S3C SoC

再次编译烧写,可以看到以下打印信息NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)Scanning device for bad blocksBad eraseblock 517 at 0x0000040a0000Bad eraseblock 1383 at 0x00000ace0000Bad eraseblock 1737 at 0x00000d920000Bad eraseblock 1897 at 0x00000ed20000Bad eraseblock 1968 at 0x00000f600000Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":0x000000000000-0x000000040000 : "u-boot"0x000000200000-0x000000500000 : "Kernel"0x000000500000-0x000010000000 : "Yaffs2"mice: PS/2 mouse device common for all micei2c /dev entries driversdhci: Secure Digital Host Controller Interface driversdhci: Copyright(c) Pierre Ossmans3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133000000 Hz)s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000 Hz)s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (24000000 Hz)mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using PIOTCP cubic registeredVFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)Please append a correct "root=" boot option; here are the available partitions:1f00             256 mtdblock0 (driver?)1f01            3072 mtdblock1 (driver?)1f02          257024 mtdblock2 (driver?)Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)Backtrace: [<c0025c34>] (dump_backtrace+0x0/0x10c) from [<c023caf4>] (dump_stack+0x18/0x1c) r7:c0318350 r6:00008000 r5:c0339cb0 r4:c7c27f40[<c023cadc>] (dump_stack+0x0/0x1c) from [<c023cb44>] (panic+0x4c/0xd0)[<c023caf8>] (panic+0x0/0xd0) from [<c0008fc0>] (mount_block_root+0x178/0x234) r3:00000000 r2:c7c3af2c r1:c7c27f40 r0:c02d5a38[<c0008e48>] (mount_block_root+0x0/0x234) from [<c000912c>] (mount_root+0xb0/0xf4)[<c000907c>] (mount_root+0x0/0xf4) from [<c0009278>] (prepare_namespace+0x108/0x1c8) r7:c001e378 r6:c0339600 r5:c001e378 r4:c001e388[<c0009170>] (prepare_namespace+0x0/0x1c8) from [<c00084ec>] (kernel_init+0x118/0x160) r7:00000000 r6:c001d8b8 r5:c001db68 r4:c001db68[<c00083d4>] (kernel_init+0x0/0x160) from [<c0041c44>] (do_exit+0x0/0x640) r7:00000000 r6:00000000 r5:00000000 r4:00000000以上红色部分是由于kernel还未支持yaffs文件系统才会有的错误。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpyzp.html