Chinaunix
标题:
关于nand_get_flash_type函数
[打印本页]
作者:
要有上进心
时间:
2013-09-03 23:43
标题:
关于nand_get_flash_type函数
最近在为开发板编写nand驱动,因为nandflash比较新,nand_get_flash_type不能够很好的支持。主要是在读取 块大小 ecc大小 和 page size上不能够很好的支持。
if (!type->pagesize) {
int extid;
/* The 3rd id byte holds MLC / multichip data */
chip->cellinfo = chip->read_byte(mtd);
/* The 4th id byte is the important one */
extid = chip->read_byte(mtd);
/* Calc pagesize */
mtd->writesize = 1024 << (extid & 0x3);
extid >>= 2;
/* Calc oobsize */
mtd->oobsize = (8 << (extid & 0x01)) * (mtd->writesize >> 9);
extid >>= 2;
/* Calc blocksize. Blocksize is multiples of 64KiB */
mtd->erasesize = (64 * 1024) << (extid & 0x03);
extid >>= 2;
/* Get buswidth information */
busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;
} else {
/*
* Old devices have chip data hardcoded in the device id table
*/
mtd->erasesize = type->erasesize;
mtd->writesize = type->pagesize;
mtd->oobsize = mtd->writesize / 32;
busw = type->options & NAND_BUSWIDTH_16;
}
我觉得直接修改nand_base文件不是很好,但是如果自己在驱动里面添加识别函数,又会让驱动文件增加好多的代码,再说nand_get_flash_type这个函数是通过nand_scan_ident调用了。nand_scan_iden没什么问题。我需要调用nand_scan_ident但是不可避免的会调用nand_get_flash_type。我该怎么办?
作者:
EZWORD
时间:
2013-09-05 12:34
直接修改nand_base文件,没什么不好,反正自己做的产品,支持的FLASH就那么几款。
而且有些ECC算法就需要修改一下NAND_BASE文件。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2