S5PV210有兩個獨立的DRAM控制器,分別是DMC0和DMC1,其中,DMC0最大支持512MByte,DMC1最大支持1GByte,而 DMC0和DMC1又同時支持兩個片選CS0和CS1。S5PV210的內存模塊相比2440和6410來講要更加復雜一些,要想正確的配置 S5PV210的內存,應該仔細閱讀芯片手冊相關部分,在配置參數時也應該適當的閱讀下內存芯片的手冊。 在技術手冊里,S5PV210給出了以下幾個解決方案: 關于地址映射方面: S5PV210的DMC跟6410和2440的DMC有個重要區別,S5PV210可以控制內存地址映射,DMC0的地址空間為 0x2000,0000~0x3fff,ffff,DMC1的地址空間為0x4000,0000~0x7fff,ffff,DMC可以通過配置寄存器來使 內存芯片映射到其內存段內的適當位置。這個配置在MEMCONFIG寄存器中。如果設置chip_base為0x20: (1)我們掛載的內存為128M,那么這個chip_mask應該設置為0xF8 (2)我們掛載256M內存時,chip_mask應該設置為0xF0 (3)我們掛載512M時,chip_mask應該設置為0xE0 (4)我們掛載1GB內存時,chip_mask就應該設置為0xC0。 以DMC0為例,當DMC0接收到來自AXI的0x2000,0000~0x3fff,ffff內的地址時,會作如下處理: (1)將AXI地址的高8位與chip_mask相與得到結果,記為X。 (2)將X分別與MEMCONFIG0和MEMCONFIG1的chip_base相比較,如果相等,則打開相應的片選。 假如掛載的內存為128M,且CS0和CS1上分別掛了一片,那么128M=128*1024*1024=0x8000000,則128M內存的偏 移范圍應該是0x0000,0000~0x07ff,ffff,高位剩余5位,那么,我們把MEMCONFIG0的chip_base設置為 0x20,chip_mask設置為0xF8,為了保持內存連續,則需要將MEMCONFIG1的chip_base設置為0x28,chip_mask 設置為0xF8,當AXI發來的地址為0x23xx,xxxx時,0x23&0xF8得到0x20,所以,會打開片選CS0,當AXI發來的地址 為0x28xx,xxxx時,0x28&0xF8得到0x28,所以,會打開片選CS1,依此類推。 特別的,當載在的內存芯片為8bank(8bank內存芯片一般為14/15行地址,10列地址,即容量一般為512M或者1G)時,由于CS1為 bank2引腳,為了保持CS0時鐘處于片選狀態,對于512M內存來講需要將chip_mask設置為0xE0,這是因為 512M=512*1024*1024=0x2000,0000,也就是說,512M內存的偏移應該為0x0000,0000~0x1fff,ffff, 所以高位剩余3位,即0xE0,當然了,如果內存為1G=1024*1024*1024=0x4000,0000,即偏移為 0x0000,0000~0x3fff,ffff,高位剩余2為,故設置chip_mask為0xC0。這樣,就會計算偏移這兩個值了。 另外在附上s5pv210(飛凌ok210開發板)的內存初始化順序,芯片手冊上給出了常用內存類型的初始化序列,一般如果使用DDR2的內存的話,可以按照如下順序進行初始化: Initialization sequence for DDR2 memory type: 1.To provide stable power for controller and memory device, the controller must assert and hold CKE to a logic low level. Then apply stable clock. Note: XDDR2SEL should be High level to hold CKE to low. 2.Set the PhyControl0.ctrl_start_point and PhyControl0.ctrl_inc bit-fields to correct value according to clock frequency. Set the PhyControl0.ctrl_dll_on bit-field to 1 to turn on the PHY DLL. 3.DQS Cleaning:Set the PhyControl1.ctrl_shiftc and PhyControl1.ctrl_offsetc bit-fields to correct value according to clock frequency and memory tAC parameters. 4. Set the PhyControl0.ctrl_start bit-field to 1. 5. Set the ConControl. At this moment, an auto refresh counter should be off. 6. Set the MemControl. At this moment, all power down modes should be off. 7. Set the MemConfig0 register. If there are two external memo ry chips, set the MemConfig1 register. 8. Set the PrechConfig and PwrdnConfig registers. 9. Set the TimingAref, TimingRow, TimingData and TimingPower registers according to memory AC parameters. 10. If QoS scheme is required, set the QosControl0~15 and QosConfig0~15 registers. 11. Wait for the PhyStatus0.ctrl_locked bit-fields to change to ‘1’. Check whether PHY DLL is locked. 12. PHY DLL compensates the changes of delay amount caused by Process, Voltage and Temperature (PVT) variation during memory operation. Therefore, PHY DLL should not be off for reliable operation. It can be off except runs at low frequency. If off mode is used, set the PhyControl0.ctrl_force bit-field to correct value according to the PhyStatus0.ctrl_lock_value[9:2] bit-field to fix delay amount. Clear the PhyControl0.ctrl_dll_on bit-field to turn off PHY DLL. 13. Confirm whether stable clock is issued minimum 200us after power on. 14. Issue a NOP command using the DirectCmd register to assert and to hold CKE to a logic high level. 15. Wait for minimum 400ns. 16. Issue a PALL command using the DirectCmd register. 17. Issue an EMRS2 command using the DirectCmd register to program the operating parameters. 18. Issue an EMRS3 command using the DirectCmd register to program the operating parameters. 19. Issue an EMRS command using the DirectCmd register to enable the memory DLLs. 20. Issue a MRS command using the DirectCmd register to reset the memory DLL. 21. Issue a PALL command using the DirectCmd register. 22. Issue two Auto Refresh commands using the DirectCmd register. 23. Issue a MRS command using the DirectCmd register to program the operating parameters without resetting the memory DLL. 24. Wait for minimum 200 clock cycles. 25. Issue an EMRS command using the DirectCmd register to program the operating parameters. If OCD calibration is not used, issue an EMRS command to set OCD Calibration Default. After that, issue an EMRS command to exit OCD Calibration Mode and to program the operating parameters. 26. If there are two external memory chips, perform steps 14~25 for chip1 memory device. 27. Set the ConControl to turn on an auto refresh counter. 28. If power down modes is required, set the MemControl registers.
|