闪存芯片驱动与MTD系统全解析
1. NOR芯片驱动
NOR闪存芯片在很多设备中广泛应用,部分NOR闪存芯片符合CFI(Common Flash Interface)规范。CFI规范旨在消除为不同厂商芯片开发单独驱动的需求,软件可查询符合CFI规范的闪存芯片,自动检测块大小、时序参数和通信命令集。实现CFI和JEDEC等规范的驱动被称为芯片驱动。
根据CFI规范,软件需向闪存内存的0x55位置写入0x98来发起查询。以下是MTD实现CFI查询的代码示例:
/* Snippet from cfi_probe_chip() (2.6.23.1 kernel) defined in
drivers/mtd/chips/cfi_probe.c, with comments added */
/* cfi is a pointer to struct cfi_private defined in
include/linux/mtd/cfi.h */
/* ... */
/* Ask the device to enter query mode by sending
0x98 to offset 0x55 */
cfi_send_gen_cmd(0x98, 0x55, base, map, cfi,
cfi->device_type, NULL);
/* If the device did not return the ASCII characters
'Q', 'R' and 'Y', the chip is not CFI-compliant */
if (!qry_pre
超级会员免费看
订阅专栏 解锁全文
88

被折叠的 条评论
为什么被折叠?



