GitHub:https://github.com/Kilento/4412NoOS
查看数据手册《SEC_Exynos4412_Users Manual_Ver.1.00.00》18.3 可知 LPDDR2 的初始化过程,DDR3 的初始化过程和它一致,我们可以使用以下的步骤来初始化我们设备上的 DRAM。
对应翻译如下:
DARM的初始化比较复杂,这段代码是DARM0的初始化,我是直接从官方的iTop-4412 uboot 源码当中抠出来的。有兴趣的同学可以自行分析下。
/*****************************************************************/
/*DREX0***********************************************************/
/*****************************************************************/
ldr r0, =APB_DMC_0_BASE
ldr r1, =0x0
str r1, [r0, #DMC_PHYCONTROL2]
ldr r1, =0x0
str r1, [r0, #0x24]
ldr r1, =0xE3855503
str r1, [r0, #DMC_PHYZQCONTROL]
ldr r1, =0x71101008
str r1, [r0, #DMC_PHYCONTROL0]
ldr r1, =0x7110100A
str r1, [r0, #DMC_PHYCONTROL0]
ldr r1, =0x20000086
str r1, [r0, #DMC_PHYCONTROL1]
ldr r1, =0x71101008
str r1, [r0, #DMC_PHYCONTROL0]
ldr r1, =0x2000008E
str r1, [r0, #DMC_PHYCONTROL1]
ldr r1, =0x20000086
str r1, [r0, #DMC_PHYCONTROL1]
ldr r1, =0x2000008E
str r1, [r0, #DMC_PHYCONTROL1]
ldr r1, =0x20000086
str r1, [r0, #DMC_PHYCONTROL1]
ldr r1, =0x0FFF30CA
str r1, [r0, #DMC_CONCONTROL]
ldr r1, =0x00302600
str r1, [r0, #DMC_MEMCONTROL]
#if 0
ldr r1, =0x40C01323
str r1, [r0, #DMC_MEMCONFIG0]
#else
/* 4Gb * 4 */
/*
ldr r1, =0x40801323
str r1, [r0, #DMC_MEMCONFIG0]
*/
/* 2Gb * 8 */
ldr r1, =0x40801333
str r1, [r0, #DMC_MEMCONFIG0]
#endif
ldr r1, =(0x80000000 | CONFIG_IV_SIZE)
str r1, [r0, #DMC_IVCONTROL]
ldr r1, =0x64000000
str r1, [r0, #DMC_PRECHCONFIG]
ldr r1, =0x9C4000FF
str r1, [r0, #DMC_PHYCONTROL0]
ldr r1, =0x000000BB
str r1, [r0, #DMC_TIMINGAREF] @TimingAref
#ifdef CONFIG_EVT0_RECOMMEND
ldr r1, =0x34A98691
#else
ldr r1, =0x34498691
#endif
ldr r1, =0x7846654F/*0x4046654F*/
str r1, [r0, #DMC_TIMINGROW] @TimingRow
ldr r1, =0x46400506
str r1, [r0, #DMC_TIMINGDATA] @TimingData
ldr r1, =0x52000A3C
str r1, [r0, #DMC_TIMINGPOWER] @TimingPower
/* minimum wait time is 100 nano seconds */
/* 0x64: wait 250 nano seconds at ARMCLK 1.5 Ghz */
mov r2, #0x64
bl dmc_delay
ldr r1, =0x07000000
str r1, [r0, #DMC_DIRECTCMD]
/* minimum wait time is 200 micro seconds */
/* 0x19000: wait 250 micro seconds at ARMCLK 1.5 Ghz */
mov r2, #0x19000
bl dmc_delay
ldr r1, =0x00020000
str r1, [r0, #DMC_DIRECTCMD]
/* minimum wait time is 20 micro seconds */
/* 0x2700: wait 25 micro seconds at ARMCLK 1.5 Ghz */
mov r2, #0x2700
bl dmc_delay
ldr r1, =0x00030000
str r1, [r0, #DMC_DIRECTCMD]
/* minimum wait time is 1 micro seconds */
/* 0x3f0: wait 2.5 micro seconds at ARMCLK 1.5 Ghz */
mov r2, #0x3f0
bl dmc_delay
ldr r1, =0x00010000
str r1, [r0, #DMC_DIRECTCMD]
ldr r1, =0x00000100
str r1, [r0, #DMC_DIRECTCMD]
mov r2, #0x3f0
bl dmc_delay
ldr r1, =0x00000420
str r1, [r0, #DMC_DIRECTCMD]
mov r2, #0x3f0
bl dmc_delay
ldr r1, =0x0A000000
str r1, [r0, #DMC_DIRECTCMD]
mov r2, #0x3f0
bl dmc_delay
2021年10月7日
Kilento