TE2410移植linux-2.6.14及调试过程总结(1)
returndriver_register(&s3c2410_nand_driver);
}
static struct device_drivers3c2410_nand_driver= {
.name= "s3c2410-nand",
.bus= &platform_bus_type,
.probe=s3c2410_nand_probe,
.remove= s3c2410_nand_remove,
};
static ints3c2410_nand_probe(struct device *dev)
{
returns3c24xx_nand_probe(dev, 0);
}
static ints3c24xx_nand_probe(struct device *dev, int is_s3c2440)
{
struct platform_device *pdev = to_platform_device(dev);
struct s3c2410_platform_nand *plat = to_nand_plat(dev);
struct s3c2410_nand_info *info;
struct s3c2410_nand_mtd *nmtd;
struct s3c2410_nand_set *sets;
struct resource *res;
. . .
for (setno = 0; setno < nr_sets; setno++, nmtd++) {
pr_debug("initialising set %d (%p, info %p)\n",
setno, nmtd, info);
s3c2410_nand_init_chip(info, nmtd, sets);
nmtd->scan_res =nand_scan(&nmtd->mtd,
(sets) ? sets->nr_chips : 1);
if (nmtd->scan_res == 0) {
s3c2410_nand_add_partition(info, nmtd, sets);
}
if (sets != NULL)
sets++;
}
. . .
}
经过串口打印出nmtd->scan_res的值为1,根据
if (nmtd->scan_res == 0) {
s3c2410_nand_add_partition(info, nmtd, sets);
}
来判断,应该返回0.
进入nand_scan
int nand_scan (struct mtd_info *mtd, int maxchips)
{
int i, nand_maf_id, nand_dev_id, busw, maf_id;
struct nand_chip *this = mtd->priv;
. . .
/* Select the device */
this->select_chip(mtd, 0);
/* Send the command for reading device ID */
this->cmdfunc (mtd, NAND_CMD_READID, 0x00, -1);
/* Read manufacturer and device IDs */
nand_maf_id= this->read_byte(mtd);
nand_dev_id= this->read_byte(mtd);
. . .
/* Print and store flash device information */
for (i = 0; nand_flash_ids[i].name != NULL; i++) {
if (nand_dev_id != nand_flash_ids[i].id)
continue;
if (!mtd->name) mtd->name = nand_flash_ids[i].name;
this->chipsize = nand_flash_ids[i].chipsize < 20;
. . .
/* Try to identify manufacturer */
for (maf_id = 0; nand_manuf_ids[maf_id].id != 0x0; maf_id++) {
if (nand_manuf_ids[maf_id].id == nand_maf_id)
break;
}
. . .
printk (KERN_INFO "NAND device: Manufacturer ID:"
" 0x%02x, Chip ID: 0x%02x (%s %s)\n", nand_maf_id, nand_dev_id,
nand_manuf_ids[maf_id].name , nand_flash_ids[i].name);
break;
}
if (!nand_flash_ids[i].name) {
printk (KERN_WARNING "No NAND device found!!!\n");
this->select_chip(mtd, -1);
return 1;
}
. . .
}
根据上面的代码可以看出没有在nand_flash_ids数组中找到nand_dev_id匹配值,记得在u-boot中也有nand_probe函数检测NAND Flash,打印出2个ID值如下
NAND:Flash chip found:Manufacturer ID:0xEC, Chip ID:0x76
Linux中nand_flash_ids和nand_manuf_ids数组内容如下:
/*
*Chip ID list*
*Name. ID co
*/
struct nand_flash_dev nand_flash_ids[] = {
{"NAND 1MiB 5V 8-bit",0x6e, 256, 1, 0x1000, 0},
{"NAND 2MiB 5V 8-bit",0x64, 256, 2, 0x1000, 0},
{"NAND 4MiB 5V 8-bit",0x6b, 512, 4, 0x2000, 0},
{"NAND 1MiB 3,3V 8-bit",0xe8, 256, 1, 0x1000, 0},
{"NAND 1MiB 3,3V 8-bit",0xec, 256, 1, 0x1000, 0},
{"NAND 2MiB 3,3V 8-bit",0xea, 256, 2, 0x1000, 0},
{"NAND 4MiB 3,3V 8-bit",0xd5, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit",0xe3, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit",0xe5, 512, 4, 0x2000, 0},
. . .
{"NAND 64MiB 3,3V 8-bit",0x76, 512, 64, 0x4000, 0},
. . .
{NULL,}
};
/*
*Manufacturer ID list
*/
struct nand_manufacturers nand_manuf_ids[] = {
{NAND_MFR_TOSHIBA, "Toshiba"},
{NAND_MFR_SAMSUNG, "Samsung"},
{NAND_MFR_FUJITSU, "Fujitsu"},
{NAND_MFR_NATIONAL, "National"},
{NAND_MFR_RENESAS, "Renesas"},
{NAND_MFR_STMICRO, "ST Micro"},
{NAND_MFR_HYNIX, "Hynix"},
{0x0, "Unknown"}
};
/*
* NAND Flash Manufacturer ID Codes
*/
#define NAND_MFR_TOSHIBA0x98
#defineNAND_MFR_SAMSUNG0xec
#define NAND_MFR_FUJITSU0x04
#define NAND_MFR_NATIONAL0x8f
#define NAND_MFR_RENESAS0x07
#define NAND_MFR_STMICRO0x20
#define NAND_MFR_HYNIX0xad
这样就说明nand_scan中读取NAND Flash的id值是错误的,不是0xec和0x76,从串口
TE2410移植linux-2 6 14调试过 相关文章:
- TE2410移植linux-2.6.14及调试过程总结(2)(11-10)
- 达芬奇数字媒体片上系统的架构和Linux启动过程(06-02)
- 基于TMS320DM642的农药喷洒系统(04-22)
- 用DSP56F805 PWM模块输出高频正弦波(05-25)
- 一种基于DSP平台的快速H.264编码算法的设计(05-19)
- 基于DSP的信号采集处理系统(07-21)