Address: http://blog.csdn.net/lightsoure/archive/2010/09/22/5900500.aspx
Environment: s5pc100 + Android (uboot 1.3.4)
DDR2 256 MB
Due to the low power consumption advantage of DDR2 compared with mobile DDR and the high power consumption requirement of the product itself, it is necessary to use dd2 instead of mobile DDR;
Uboot linked list u-boot.LDS from/board/Samsung/smdkc100
View plaincopy to clipboardprint?
- . Text:
- {
- CPU/s5pc1xx/start. O (. Text)
- CPU/s5pc1xx/s5pc100/cpu_init.o (. Text)
- Board/Samsung/smdkc100/lowlevel_init.o (. Text)
- CPU/s5pc1xx/onenand_cp.o (. Text)
- CPU/s5pc1xx/nand_cp.o (. Text)
- CPU/s5pc1xx/movi. O (. Text)
- * (. Text)
- }
The entire uboot workflow is clear. We need to modify the memory configuration;
From start. s
/*
* Go setup memory and board specific bits prior to relocation.
*/
LDR sp, = 0xd0036000/* end of SRAM dedicated to U-boot */
Sub sp, SP, #12/* Set stack */
MoV FP, #0
BL lowlevel_init/* Go setup PLL, MUX, memory */
And lowlevel_init. s
/* When we already run in Ram, we don't need to relocate U-boot.
* And actually, memory controller must be configured before u-boot
* Is running in Ram.
*/
LDR r0, = 0xff000fff
Bic R1, PC, R0/* R0 <-current base ADDR of code */
LDR R2, _ text_base/* R1 <-original base ADDR in Ram */
Bic R2, R2, R0/* R0 <-current base ADDR of code */
CMP R1, R2/* compare r0, R1 */
Beq 1f/* R0 = R1 then skip SDRAM init */
/* Init system clock */
BL system_clock_init
BL mem_ctrl_asm_init knows that the memory-related configuration is in cpu_init.s. Okay, no worries. Directly paste the Configuration:
Step 1:
View plaincopy to clipboardprint?
- /************ DLL initialization *************/
- // LDR R1, = 0x6a101000 @ phycontrol0 DLL parameter setting
- LDR R1, = 0x50101008 // added by S
- STR R1, [r0, # dmc_phycontrol0]
- // LDR R1, = 0x000000f4 // added by S
- LDR R1, = 0x000000f6 // added by s the last bit is 6 for ddr21
- STR R1, [r0, # dmc_phycontrol1]
- // LDR R1, = 0x00000000 @ phycontrol2 DLL parameter setting
- LDR R1, = 0x00000000 // added by S
- STR R1, [r0, # dmc_phycontrol2]
- // LDR R1, = 0x6a101002 @ DLL on
- LDR R1, = 0x5010100a // added by S
- STR R1, [r0, # dmc_phycontrol0]
- // LDR R1, = 0x6a101003 @ DLL start
- LDR R1, = 0x5010100b // added by S
- STR R1, [r0, # dmc_phycontrol0]
- LDR R2, = 0xe6000040 @ dmc_phystatus0
- Loop1:
- LDR R1, [R2] @ check DLL lock
- ANDS R1, R1, #4
- Beq loop1
- LDR R1, [R2]
- MoV R1, R1, LSR # (0x6)
- And R1, R1, # (0xff)
- MoV R1, R1, LSL # (0x18)
- LDR R2, = 0xe6000018 @ dmc_phycontrol0
- LDR R3, [R2]
- Bic R3, R3, # (0xff000000)
- ORR R1, R3, r2
- STR R1, [R2]
- // LDR R1, = 0x6a101003 @ force value locking
- LDR R1, = 0x5010100b // added by S
- STR R1, [r0, # dmc_phycontrol0]
- // LDR R1, = 0x6a101009 @ DLL off
- LDR R1, = 0x50101009 // added by S
- STR R1, [r0, # dmc_phycontrol0]
-
-
-
- # If 0
- LDR R1, = 0x6a101000 @ phycontrol0 DLL parameter setting
- STR R1, [r0, # dmc_phycontrol0]
- LDR R1, = 0x00008484 @ phycontrol1 DLL parameter setting
- STR R1, [r0, # dmc_phycontrol1]
- LDR R1, = 0x00000000 @ phycontrol2 DLL parameter setting
- STR R1, [r0, # dmc_phycontrol2]
-
- # Endif
- /************ DLL initialization-end *************/
In step 1, note that for DDR2, the last three digits after phycontrol1 are 0x110;
Step 2:
View plaincopy to clipboardprint?
- // LDR R1, = 0x0ff01010 @ auto refresh off
- LDR R1, = 0x0ff01010 // added S
- STR R1, [r0, # dmc_concontrol]
- // LDR R1, = 0x00102100.
- LDR R1, = 0x00212400 // added by S
- STR R1, [r0, # dmc_memcontrol]
- LDR R1, = 0x20f00313 // 1cs 256mb0
- STR R1, [r0, # dmc_memconfig0]
- LDR R1, = 0x40f00313 // added by S
- STR R1, [r0, # dmc_memconfig1]
- LDR R1, = 0x20000000
- STR R1, [r0, # dmc_prechconfig]
- LDR R1, = 0x00100004 @ pwrdnconfig
- STR R1, [r0, # dmc_pwrdnconfig
In step 2, it should be noted that for DDR2 and s5pc100, it should be noted that it is related to the actual memory circuit design. I am a 32-bit Parallel storage, so DDR2 corresponds to a CS of 256 MB, therefore, for dmc_memconfig0, chip_mask is F0. If f8. after uboot is used to boot the kernel, the memory configuration of the kernel will die;
There is also a part:
Whether the settings here can affect power consumption is still to be tested.
Step 3:
View plaincopy to clipboardprint?
- /*********** Timing optimization *************/
- /************ Ddr2_166mhz *************///
- // 7.8us * 166 MHz = 0x50e
- LDR R1, = 0x0000050e
- STR R1, [r0, # dmc_timingaref]
- LDR R1, = 0x16233288 // added bu s
- STR R1, [r0, # dmc_timingrow]
- LDR R1, = 0x23250304 @ timing data // added bu s
- STR R1, [r0, # dmc_timingdata]
- LDR R1, = 0x06c80232 @ timing power !!!!!!!!!!!!!!!
- STR R1, [r0, # dmc_timingpower]
This part should be set based on your memory timing, similar to other boot memory timing configurations.
Step 4:
View plaincopy to clipboardprint?
- /* Direct command for lpddr-* // added by S 2010.9.16
- /* Chip0 */
- LDR R1, = 0x07000000 @ chip0 deselect
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x01000000 @ chip0 pall
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00020000 @ chip0 emrs2
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00030000 @ chip0 emrs3
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00010400 @ emrs1 (mem dll on, dqs # disable)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00000552 @ chip0 Mrs (mem dll reset)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x01000000 @ chip0 chip0 pall
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x05000000 @ chip0 chip0 Refa
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x05000000 @ chip0 chip0 Refa
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00000452 @ chip0 Mrs (mem dll unreset), BL = 4, CL = 5
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00010780 @ chip0 emrs1 (OCD default)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00010400 @ chip0 emrs1 (OCD Exit)
- STR R1, [r0, # dmc_directcmd]
- /* Chip1 */
- LDR R1, = 0x07100000 @ directcmd chip1 deselect
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x01100000 @ directcmd chip1 pall
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00120000 @ directcmd chip1 emrs2
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00130000 @ directcmd chip1 emrs3
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00110440 @ directcmd chip1 emrs1 (mem dll on, dqs # disable)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00100552 @ directcmd chip1 Mrs (mem dll reset) Cl = 5, BL = 4
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x01100000 @ directcmd chip1 pall
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x05100000 @ directcmd chip1 Refa
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x05100000 @ directcmd chip1 Refa
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00100452 @ directcmd chip1 Mrs (mem dll unreset)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00110780 @ directcmd chip1 emrs1 (OCD default)
- STR R1, [r0, # dmc_directcmd]
- LDR R1, = 0x00110400 @ directcmd chip1 emrs1 (OCD Exit)
- STR R1, [r0, # dmc_directcmd]
- /*************************** End *********** ***********************
Now that two slice selections are used, configure the two slice selections.
Step 5: Start the DMC.
View plaincopy to clipboardprint?
- // [5. Start the DMC.] // added by S
- LDR R1, = 0x0ff020b0 // change s @ concontrol auto refresh on
- STR R1, [r0, # dmc_concontrol]
-
- # If 0
- LDR R1, = 0x001000ff @ pwrdnconfig
- STR R1, [r0, # dmc_pwrdnconfig]
- # Endif
- LDR R1, = 0x00212413 // change s @ memcontrol
- STR R1, [r0, # dmc_memcontrol]
- B exit_cpu_init
Start DMC
Here the process is basically over, because onenand is not used, so some do not need to pay attention to it temporarily
After testing, uboot can boot the entire kernel and file system normally.
However, I have a question:
I have eight banks, but it's okay if I select two chips. For now, changing it to 0x00 seems the same .. This is a bit dizzy ~
Leave some questions ~ Wait until you start chatting ~