2012-04-16 08:57:38 +04:00
/ *
2011-03-10 07:33:59 +03:00
* Copyright ( c ) 2 0 1 1 S a m s u n g E l e c t r o n i c s C o . , L t d .
* http : / / www. s a m s u n g . c o m
*
2011-10-04 15:25:51 +04:00
* Common S 5 P S l e e p C o d e
* Based o n S 3 C 6 4 X X s l e e p c o d e b y :
* Ben D o o k s , ( c ) 2 0 0 8 S i m t e c E l e c t r o n i c s
2011-03-10 07:33:59 +03:00
*
* 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 >
2012-03-08 14:07:34 +04:00
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / h a r d w a r e / c a c h e - l 2 x0 . h >
2011-03-10 07:33:59 +03:00
2013-04-04 11:01:15 +04:00
# define C P U _ M A S K 0 x f f0 f f f f0
# define C P U _ C O R T E X _ A 9 0 x41 0 f c09 0
2012-03-08 14:07:34 +04:00
/ *
* The f o l l o w i n g c o d e i s l o c a t e d i n t o t h e . d a t a s e c t i o n . T h i s i s t o
* allow l 2 x0 _ r e g s _ p h y s t o b e a c c e s s e d w i t h a r e l a t i v e l o a d w h i l e w e
* can' t r e l y o n a n y M M U t r a n s l a t i o n . W e c o u l d h a v e p u t l 2 x0 _ r e g s _ p h y s
* in t h e . t e x t s e c t i o n a s w e l l , b u t s o m e s e t u p s m i g h t i n s i s t o n i t t o
* be t r u l y r e a d - o n l y . ( R e f e r e n c e f r o m : a r c h / a r m / k e r n e l / s l e e p . S )
* /
.data
.align
2011-03-10 07:33:59 +03:00
/ *
* sleep m a g i c , t o a l l o w t h e b o o t l o a d e r t o c h e c k f o r a n v a l i d
* image t o r e s u m e t o . M u s t b e t h e f i r s t w o r d b e f o r e t h e
* s3 c _ c p u _ r e s u m e e n t r y .
* /
.word 0x2bedf00d
/ *
* s3 c _ c p u _ r e s u m e
*
* resume c o d e e n t r y f o r b o o t l o a d e r t o c a l l
* /
ENTRY( s3 c _ c p u _ r e s u m e )
2012-03-08 14:07:34 +04:00
# ifdef C O N F I G _ C A C H E _ L 2 X 0
2013-04-04 11:01:15 +04:00
mrc p15 , 0 , r0 , c0 , c0 , 0
ldr r1 , =CPU_MASK
and r0 , r0 , r1
ldr r1 , =CPU_CORTEX_A9
cmp r0 , r1
bne r e s u m e _ l 2 o n
2012-03-08 14:07:34 +04:00
adr r0 , l 2 x0 _ r e g s _ p h y s
ldr r0 , [ r0 ]
ldr r1 , [ r0 , #L 2 X 0 _ R _ P H Y _ B A S E ]
ldr r2 , [ r1 , #L 2 X 0 _ C T R L ]
tst r2 , #0x1
bne r e s u m e _ l 2 o n
ldr r2 , [ r0 , #L 2 X 0 _ R _ A U X _ C T R L ]
str r2 , [ r1 , #L 2 X 0 _ A U X _ C T R L ]
ldr r2 , [ r0 , #L 2 X 0 _ R _ T A G _ L A T E N C Y ]
str r2 , [ r1 , #L 2 X 0 _ T A G _ L A T E N C Y _ C T R L ]
ldr r2 , [ r0 , #L 2 X 0 _ R _ D A T A _ L A T E N C Y ]
str r2 , [ r1 , #L 2 X 0 _ D A T A _ L A T E N C Y _ C T R L ]
ldr r2 , [ r0 , #L 2 X 0 _ R _ P R E F E T C H _ C T R L ]
str r2 , [ r1 , #L 2 X 0 _ P R E F E T C H _ C T R L ]
ldr r2 , [ r0 , #L 2 X 0 _ R _ P W R _ C T R L ]
str r2 , [ r1 , #L 2 X 0 _ P O W E R _ C T R L ]
mov r2 , #1
str r2 , [ r1 , #L 2 X 0 _ C T R L ]
resume_l2on :
# endif
2011-03-10 07:33:59 +03:00
b c p u _ r e s u m e
2012-03-08 14:07:34 +04:00
ENDPROC( s3 c _ c p u _ r e s u m e )
# ifdef C O N F I G _ C A C H E _ L 2 X 0
.globl l2x0_regs_phys
l2x0_regs_phys :
.long 0
# endif