/*
* we do sys-critical inits only at reboot,
* not when booting from
*/
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
bl cpu_init_crit
#endif
/* 从这个地方开始添加代码 */
/* Apollo +*/
/* Power Manage Check if this is a wake-up
from sleep */
ldr r1, =0x560000B4 /* GSTATUS2 */
ldr r0, [r1]
tst r0, #0x02
beq BringUpWinCE
WakeupStart:
ldr r1, =0x56000080 /* ; MISCCR's
Bit 17, 18, 19 -> 0 */
ldr r0, [r1] /*; I don't know why, Just fallow Sample Code. */
bic r0, r0, #(7 << 17) /*; SCLK0:0->SCLK, SCLK1:0->SCLK, SCKE:L->H */
str r0, [r1]
/* 1. Checksum Calculation saved Data */
ldr r5, =0x30028000 /* pointer to physical address of reserved Sleep mode
info data structure */
mov r3, r5 /* pointer for checksum
calculation*/
ldr r2, =0x0
ldr r0, =(25-1) /* get size of data
structure to do checksum on*/
again:
ldr r1, [r3], #4
/* pointer to SLEEPDATA*/
and r1, r1, #0x1
mov r1, r1, ROR #31
add r2, r2, r1
subs r0, r0, #1 /*; dec the
count*/
bne again /*; loop till done */
ldr r0,=0x560000B8 /* GSTATUS3 */
ldr r3, [r0] /* get
the Sleep data checksum from the Power Manager Scratch pad register*/
cmp r2, r3 /* compare to what we saved before going to sleep*/
bne BringUpWinCE /* bad news - do a cold boot*/
/* 2. MMU Enable */
ldr r10, [r5, #12] /*; load
the MMU domain access info*/
ldr r9, [r5, #8] /*; load
the MMU TTB info */
ldr r8, [r5, #4] /*; load
the MMU control info */
ldr r7, [r5, #0 ] /*; load
the LR address*/
nop
nop
nop
nop
nop
/* if software reset*/
mov r1, #0
teq r1, r7
bne wakeup
b BringUpWinCE
/*; wakeup routine*/
wakeup:
mcr p15, 0, r10, c3, c0, 0
/*; setup access to domain 0*/
mcr p15, 0, r9, c2, c0, 0
/*; PT address*/
mcr p15, 0, r0, c8, c7, 0
/*; flush I+D TLBs*/
mcr p15, 0, r8, c1, c0, 0
/*; restore MMU control*/
/*; 3. Jump to Kernel Image's
fw.s (Awake_address)*/
mov pc, r7 /*; jump to new VA (back up Power management stack)*/
nop
BringUpWinCE:
/* Apollo -*/
/*添加代码结束*/
/***************** CHECK_CODE_POSITION ******************************************/
adr r0, _start /* r0 <- current position of code */
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
beq stack_setup
/***************** CHECK_CODE_POSITION ******************************************/
|