Flash:两片SST39VF3201 ,一片挂CS0:地址0x80000000 一片挂CS1:地址0x81000000
使用jecdec探测
- static struct map_info lpc24xx_map[2] = {
- {
- .name = "LPC24XX",
- .bankwidth = 2,
- .size = 0x400000,
- .phys = 0x80000000,
- },{
- .name = "LPC24XX1",
- .bankwidth = 2,
- .size = 0x400000,
- .phys = 0x81000000,
- }
- };
- //mtd驱动
- int __init lpc24xx_mtd_init(void)
- {
- int i;
- char *part_type = NULL;
- for(i=0;i<2;i++){
- lpc24xx_map[i].virt = ioremap(flashphys[i], flashsize[i]);
- if (!lpc24xx_map[i].virt) {
- printk(KERN_ERR "LPC24XX-MTD: ioremap failed\n");
- return -EIO;
- }
- simple_map_init(&lpc24xx_map[i]);
- // Probe for flash bankwidth 4
- printk (KERN_INFO "LPC24XX-MTD probing 16bit FLASH: i= %d phys=%08x\n", i, lpc24xx_map[i].phys);
- mymtd[i] = do_map_probe("jedec_probe", &lpc24xx_map[i]);
- printk(KERN_INFO "Chow-> end of do map probe: jedec probe\n");
- /*
- if (!mymtd) {
- printk (KERN_INFO "LPC24XX-MTD probing 16bit FLASH\n");
- // Probe for bankwidth 2
- lpc24xx_map.bankwidth = 2;
- mymtd = do_map_probe("cfi_probe", &lpc24xx_map);
- }
- */
- if (mymtd[i]) {
- mymtd[i]->owner = THIS_MODULE;
- #ifdef CONFIG_MTD_PARTITIONS
- nr_mtd_parts[i] = parse_mtd_partitions(mymtd[i], probes, &mtd_parts[i], 0);
- if (nr_mtd_parts[i] > 0)
- part_type = "command line";
- #endif
- if (nr_mtd_parts[i] <= 0) {
- if(i) {
- // mtd_parts[i] = &lpc24xx_partitions1;
- mtd_parts[i] = lpc24xx_partitions1;
- // nr_mtd_parts = NUM_PARTITIONS;
- nr_mtd_parts[i] = num_partitions[i];
- part_type = "builtin";
- }else{
- mtd_parts[i] = lpc24xx_partitions;
- // nr_mtd_parts = NUM_PARTITIONS;
- nr_mtd_parts[i] = num_partitions[i];
- part_type = "builtin";
- }
- }
- }else{
- iounmap((void *)lpc24xx_map[i].virt);
- printk(KERN_INFO "Chow-> ENXIO\n");
- //return -ENXIO;
- }
- }
- for(i=0;i<2;i++){
- printk(KERN_INFO "Using %s partition table\n", part_type);
- add_mtd_partitions(mymtd[i], mtd_parts[i], nr_mtd_parts[i]);
- }
- // if(i) return 0;
- // else continue;
- return 0;
- }
在启动信息中看到,能探测到第一片(0x80000000)的ID,0x235b
Search for id:(bf 235b) interleave(1) type(2)
MTD jedec_match(): Check fit 0x00000000 + 0x00400000 = 0x00400000
MTD jedec_match(): check unlock addrs 0x5555 0x2aaa
MTD jedec_match(): check ID's disappear when not in ID mode
reset unlock called 5555 2aaa
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5619
MTD jedec_match(): return to ID mode
MTD jedec_probe_chip(): matched device 0xbf,0x235b unlock_addrs: 0x5555 0x2aaa
Found: SST 39VF3201
reset unlock called 5555 2aaa
LPC24XX1: Found 1 x16 devices at 0x0 in 16-bit bank
number of JEDEC chips: 1
但是探测第2片(0x81000000)的ID时,读出的ID其实是flash存储的内容:
LPC24XX-MTD probing 16bit FLASH: i= 0 phys=81000000
reset unlock called 555 2aa
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5656
Search for id:(1212 5656) interleave(1) type(2)
12是故意写入flash的内容,第2片flash的内容是123456789123456789.。。。
reset unlock called 555 aaa
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5656
Search for id:(1212 5656) interleave(1) type(2)
reset unlock called 5555 2aaa
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5656
Search for id:(1212 5656) interleave(1) type(2)
reset unlock called aaa 555
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5656
Search for id:(1212 5656) interleave(1) type(2)
chow->base =0x0 ofs=0x2
chow->mask =0xffff resul.x[0]=0x5656
Search for id:(1212 5656) interleave(1) type(2)
chow->base =0x0 ofs=0x2
为什么读取SST芯片ID变成了读取了flash的内容???