|
s3c2410 Nand flash 驱动问题
[复制链接]
在看2.4.18内核的关于三星的nand flash 驱动时遇到一个地方没有看明白,请指教
使用的nand flash 为 k9f1208
其中有个函数:作用是向flash发送一个地址
static void s3c2410_command (struct mtd_info *mtd, unsigned command, int column, int page_addr)
{
// register struct nand_chip *this = mtd->priv;
/* Begin command latch cycle */
/*
* Write out the command to the device.
*/
if (command == NAND_CMD_SEQIN) { // 写命令
int readcmd;
if (column >= mtd->oobblock) {
/* OOB area */
column -= mtd->oobblock;
readcmd = NAND_CMD_READOOB;
} else if (column < 256) {
/* First 256 bytes --> READ0 */
readcmd = NAND_CMD_READ0;
} else {
column -= 256;
readcmd = NAND_CMD_READ1;
}
NFCMD = (__u8)readcmd; // 这里为什么多了一次命令的写入呢 // this->write_byte(mtd, readcmd);
}
NFCMD = (__u8)command; // 按flash时序仅是这句及下面的就可以完成把写地址放到flash里的作用?????
/* Set ALE and clear CLE to start address cycle */
if (column != -1 || page_addr != -1) {
/* Serially input address */
if (column != -1)
NFADDR = (__u8)column;
if (page_addr != -1) {
NFADDR = (__u8)(page_addr & 0xff);
NFADDR = (__u8)((page_addr >> 8) & 0xff);
/* One more address cycle for higher density devices */
if (mtd->size & 0x0c000000)
NFADDR = (__u8)((page_addr >> 16) & 0x0f);
}
/* Latch in address */
}
|
|