s3c2410的nand flash的驅動分析

2021-04-19 09:08:23 字數 2833 閱讀 9749

以前都是把別人寫好的**直接拿過來用,而沒有去關心裡面到底怎麼實現的,昨晚對照著samsung 2410和k

9f1208的晶元資料把這些**讀了一遍,終於明白了對nand flash的操作一步步是怎麼實現的了。

以下的這些**可以在vivi或者kernel裡面找到

對乙個nand flash的操作,總體上可以分為這麼四步:

一、select the nand device

二、send command to nand device

三、operation

四、de-select the nand device

下面是以上四步的實現**:

一、select the nand device

#define nand_select()   this->hwcontrol(nand_ctl_setnce); /

nand_command(mtd, nand_cmd_reset, -1, -1); /

udelay (10);

hwcontrol(nand_ctl_setnce)的作用是設定2410的nand flash configuration (nfconf) register的nand flash memory chip enable位為0

,具體請參考

samsung 2410 datasheet。

nand flash memory chip enable   [11] nand flash memory nfce control

0 : nand flash nfce = l (active)

1 : nand flash nfce = h (inactive)

(after auto-boot, nfce will be inactive.)

nand_command(mtd, nand_cmd_reset, -1, -1)

;看字面意思都知道是reset nand device,具體實現請看下面。

二、send command to nand device

這步又主要有以下幾個過程

1、 begin command latch cycle

實現**:

this->hwcontrol(nand_ctl_setcle); // set command latch enable

this->hwcontrol(nand_ctl_dat_out); //

這個我還不清楚

2、 write out the command to the device

實現**:

this->write_cmd (command); // write the command to

nand flash command set (nfcmd) register

3、 set ale and clear cle to start address cycle

實現**:

this->hwcontrol(nand_ctl_clrcle); // clear the command latch enable

this->hwcontrol(nand_ctl_setale); // set the address latch enable

4、 serially input address

實現**:

this->write_addr (address); // write the address to

nand flash address set

(nfaddr) register

具體請參考所使用的nand flash datasheet以及nand flash的定址方式

實現**:

this->hwcontrol(nand_ctl_clrale); // clear the address latch enable

this->hwcontrol(nand_ctl_dat_in); // 這個我也不清楚

6、 pause for ?us

實現**:

udelay (?) //

延時,總得給nand flash一點反應時間三

// 時間視具體nand flash而定

三、operation

主要是往nand flash data (nfdata) register

裡面寫或者讀資料

例如:static u_char read_data(void)

四、de-select the nand device

實現**:

#define nand_deselect() this->hwcontrol(nand_ctl_clrnce);

跟select the nand device相反,把nand flash configuration (nfconf) register的nand flash memory chip enable

位置 1

至此,對samsung 2410平台上的nand flash乙個操作完成。

以上是偶的個人理解,有啥不正確的地方還請大家指出來,感謝。

下面是乙個我還沒搞明白的問題,希望看到的朋友能指點下:

這段**來自

mizi_linux/drivers/mtd/nand/**c_s

3c2410.c

static void **c_hwcontrol(int cmd)

}nand_ctl_setcle

、nand_ctl_clrcle、nand_ctl_setale以及後面幾個cmd,傳進去了啥活都不幹喃,這能達到set or clear的效果嗎?

S3C2410讀寫Nand Flash分析

2009 01 15 16 51 321人閱讀 收藏舉報 s3c2410讀寫nand flash分析 一 結構分析 s3c2410處理器整合了8位nandflash控制器。目前市場上常見的8位nandflash有三星公司的k9f1208 k9f1g08 k9f2g08等。k9f1208 k9f1g0...

S3C2410快速啟動的實現

嵌入式系統對功能 可靠性 成本 體積 功耗等均有嚴格要求,以arm體系結構為基礎的各種risc微處理器具有靈活的特性和強大的效能,在嵌入式系統中得到了廣泛的應用。s3c2410是三星公司基於arm920t設計的一款處理器,在開發基於s3c2410的系統的過程中,如何讓系統快速穩定地啟動是乙個重要問題...

S3C2410下DMA的使用

dma優點是其進行資料傳輸時不需要cpu的干涉,可以大大提高cpu的工作效率。dma大容量資料傳輸中非常重要,比如影象資料傳輸,sd卡資料傳輸,usb資料傳輸等等。s 3c2410有四個dma,每個dma支援工作方式基本相同,但支援的source dest可能略有不同。那麼怎麼使用dma呢,s3c2...