2007-12-23 05:09:34 +03:00
/ * linux/ a r c h / a r m / m a c h - s3 c24 1 2 / s l e e p . S
*
* Copyright ( c ) 2 0 0 7 S i m t e c E l e c t r o n i c s
* Ben D o o k s < b e n @simtec.co.uk>
*
* S3 C 2 4 1 2 P o w e r M a n a g e r l o w - l e v e l s l e e p s u p p o r t
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y
* the F r e e S o f t w a r e F o u n d a t i o n ; either version 2 of the License, or
* ( at y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n , M A 0 2 1 1 1 - 1 3 0 7 U S A
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s s e m b l e r . h >
2008-08-05 19:14:15 +04:00
# include < m a c h / h a r d w a r e . h >
# include < m a c h / m a p . h >
2007-12-23 05:09:34 +03:00
2008-08-05 19:14:15 +04:00
# include < m a c h / r e g s - i r q . h >
2007-12-23 05:09:34 +03:00
.text
.global s3c2412_sleep_enter
s3c2412_sleep_enter :
mov r0 , #0 / * a r g u m e n t f o r c o p r o c e s s o r s * /
ldr r1 , =S3C2410_INTPND
ldr r2 , =S3C2410_SRCPND
ldr r3 , =S3C2410_EINTPEND
teq r0 , r0
bl s3 c24 1 2 _ s l e e p _ e n t e r1
teq p c , r0
bl s3 c24 1 2 _ s l e e p _ e n t e r1
.align 5
/ * this i s c a l l e d t w i c e , f i r s t w i t h t h e Z f l a g t o e n s u r e t h a t t h e
* instructions h a v e b e e n l o a d e d i n t o t h e c a c h e , a n d t h e s e c o n d
* time t o t r y a n d s u s p e n d t h e s y s t e m .
* /
s3c2412_sleep_enter1 :
mcr p15 , 0 , r0 , c7 , c10 , 4
mcrne p15 , 0 , r0 , c7 , c0 , 4
/ * if w e r e t u r n f r o m h e r e , i t i s b e c a u s e a n i n t e r r u p t w a s
* active w h e n w e t r i e d t o s h u t d o w n . T r y a n d a c k t h e I R Q a n d
* retry, a s s i m p l y r e t u r n i n g c a u s e s t h e s y s t e m t o l o c k .
* /
ldrne r9 , [ r1 ]
strne r9 , [ r1 ]
ldrne r9 , [ r2 ]
strne r9 , [ r2 ]
ldrne r9 , [ r3 ]
strne r9 , [ r3 ]
bne s3 c24 1 2 _ s l e e p _ e n t e r1
mov p c , r14