Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Copyright (c) 2007 Simtec Electronics
0004  *  Ben Dooks <ben@simtec.co.uk>
0005  *
0006  * S3C2412 Power Manager low-level sleep support
0007  */
0008 
0009 #include <linux/linkage.h>
0010 #include <asm/assembler.h>
0011 #include "map.h"
0012 
0013 #include "regs-irq.h"
0014 
0015     .text
0016 
0017     .global s3c2412_sleep_enter
0018 
0019 s3c2412_sleep_enter:
0020     mov r0, #0          /* argument for coprocessors */
0021     ldr r1, =S3C2410_INTPND
0022     ldr r2, =S3C2410_SRCPND
0023     ldr r3, =S3C2410_EINTPEND
0024 
0025     teq r0, r0
0026     bl  s3c2412_sleep_enter1
0027     teq pc, r0
0028     bl  s3c2412_sleep_enter1
0029 
0030     .align  5
0031 
0032     /* this is called twice, first with the Z flag to ensure that the
0033      * instructions have been loaded into the cache, and the second
0034      * time to try and suspend the system.
0035     */
0036 s3c2412_sleep_enter1:
0037     mcr p15, 0, r0, c7, c10, 4
0038     mcrne   p15, 0, r0, c7, c0, 4
0039 
0040     /* if we return from here, it is because an interrupt was
0041      * active when we tried to shutdown. Try and ack the IRQ and
0042      * retry, as simply returning causes the system to lock.
0043     */
0044 
0045     ldrne   r9, [r1]
0046     strne   r9, [r1]
0047     ldrne   r9, [r2]
0048     strne   r9, [r2]
0049     ldrne   r9, [r3]
0050     strne   r9, [r3]
0051     bne s3c2412_sleep_enter1
0052 
0053     ret lr