linux內(nèi)核對(duì)S3C2410睡眠模式的支持
七、實(shí)現(xiàn)方法
具體的實(shí)現(xiàn)原理可以通過閱讀上述相關(guān)文件獲取。下面如何實(shí)現(xiàn)系統(tǒng)的睡眠及喚醒
?。?)內(nèi)核修改過程
根據(jù)硬件的實(shí)際情況,設(shè)置睡眠喚醒中斷源。我的系統(tǒng)是讓中斷0-3作為喚醒源。所以讓內(nèi)核允許EINT0--3外部中斷將其喚醒。內(nèi)核版本是2.6.26.5。系統(tǒng)默認(rèn)容許EINT0..EINT15和IRQ_RTC作為中斷喚醒源。
s3c_irqwake_intmask和s3c_irqwake_eintmask是屏蔽碼。為了讓EINT0--3外部中斷可以作為喚醒源,
需要修改:
arch/arm/plat-s3c24xx/irq.c中
unsigned long s3c_irqwake_intmask = 0xffffffffL;
為:
unsigned long s3c_irqwake_intmask = 0xfffffff0L;
?。?)修改U-boot
系統(tǒng)睡眠在喚醒后會(huì)運(yùn)行復(fù)位程序,當(dāng)然就是U-boot了。為了讓喚醒后的系統(tǒng)能夠恢復(fù)正常工作狀態(tài),及進(jìn)入到睡眠前運(yùn)行的位置,需要修改U-boot
將下面的代碼加入到uboot的cpu/arm920t/start.s中,注意:要放在sdram初始化后,參考本文的第四標(biāo)題“S3C2410掉電模式喚醒過程”
/* Power Manage Check if this is a wake-up from sleep */
ldr r1, =0x560000B4
ldr r0, [r1]
tst r0, #0x02
beq notPowerOFF
/****led test****
ldr r0, =0x56000050
ldr r1,=0x55555555
str r1,[r0]
ldr r0, =0x56000054
ldr r1,=0x0
str r1,[r0]
*/
WakeupStart:
//Clear sleep reset bit
ldr r0, =0x560000B4
mov r1, #0x2
str r1, [r0]
ldr r0, =0x56000080 //Release the SDRAM signal protections
ldr r1, =0x00010330
str r1, [r0]
ldr r0, =0x48000024
ldr r1, [r0]
bic r1, r1, #0x400000
str r1, [r0]
mov r1, #0x1000
1: subs r1, r1, #1 // wait until the SelfRefresh is released.
bne 1b
/*
ldr r0, =0x56000050
ldr r1,=0x55555555
str r1,[r0]
ldr r0, =0x56000054
ldr r1,=0x5555
str r1,[r0]
*/
ldr r0, =0x560000B8 //read a return address go to s3c2410_cpu_resume
ldr r1, [r0]
mov pc, r1 //go to resume 恢復(fù)到睡眠前的位置
nop
nop
1: b 1b
notPowerOFF:
評(píng)論