Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Copyright (c) 2004 Simtec Electronics
0004  *  Ben Dooks <ben@simtec.co.uk>
0005  *
0006  * S3C2410 Power Manager (Suspend-To-RAM) support
0007  *
0008  * Based on PXA/SA1100 sleep code by:
0009  *  Nicolas Pitre, (c) 2002 Monta Vista Software Inc
0010  *  Cliff Brake, (c) 2001
0011  */
0012 
0013 #include <linux/linkage.h>
0014 #include <linux/serial_s3c.h>
0015 #include <asm/assembler.h>
0016 #include "map.h"
0017 
0018 #include "regs-gpio.h"
0019 #include "regs-clock.h"
0020 
0021 #include "regs-mem-s3c24xx.h"
0022 
0023     /* s3c2410_cpu_suspend
0024      *
0025      * put the cpu into sleep mode
0026     */
0027 
0028 ENTRY(s3c2410_cpu_suspend)
0029     @@ prepare cpu to sleep
0030 
0031     ldr r4, =S3C2410_REFRESH
0032     ldr r5, =S3C24XX_MISCCR
0033     ldr r6, =S3C2410_CLKCON
0034     ldr r7, [r4]        @ get REFRESH (and ensure in TLB)
0035     ldr r8, [r5]        @ get MISCCR (and ensure in TLB)
0036     ldr r9, [r6]        @ get CLKCON (and ensure in TLB)
0037 
0038     orr r7, r7, #S3C2410_REFRESH_SELF   @ SDRAM sleep command
0039     orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
0040     orr r9, r9, #S3C2410_CLKCON_POWER   @ power down command
0041 
0042     teq pc, #0          @ first as a trial-run to load cache
0043     bl  s3c2410_do_sleep
0044     teq r0, r0          @ now do it for real
0045     b   s3c2410_do_sleep    @
0046 
0047     @@ align next bit of code to cache line
0048     .align  5
0049 s3c2410_do_sleep:
0050     streq   r7, [r4]            @ SDRAM sleep command
0051     streq   r8, [r5]            @ SDRAM power-down config
0052     streq   r9, [r6]            @ CPU sleep
0053 1:  beq 1b
0054     ret lr