2010-01-26 04:45:40 +03:00
/ * linux/ a r c h / a r m / p l a t - s3 c64 x x / s l e e p . S
2009-03-10 21:19:35 +03:00
*
* Copyright 2 0 0 8 O p e n m o k o , I n c .
* Copyright 2 0 0 8 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>
* http : / / armlinux. s i m t e c . c o . u k /
*
* S3 C 6 4 X X C P U s l e e p c o d e
*
* 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 v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
# 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 >
# include < m a c h / m a p . h >
# undef S 3 C 6 4 X X _ V A _ G P I O
# define S 3 C 6 4 X X _ V A _ G P I O ( 0 x0 )
2010-01-26 04:45:40 +03:00
# include < m a c h / r e g s - g p i o . h >
2009-03-10 21:19:35 +03:00
# define L L _ U A R T ( S 3 C _ P A _ U A R T + ( 0 x40 0 * C O N F I G _ S 3 C _ L O W L E V E L _ U A R T _ P O R T ) )
.text
/ * Sleep m a g i c , t h e w o r d b e f o r e t h e r e s u m e e n t r y p o i n t s o t h a t t h e
* bootloader c a n c h e c k f o r a r e s u m e a b l e i m a g e . * /
.word 0x2bedf00d
/ * s3 c _ c p u _ r e u s m e
*
* This i s t h e e n t r y p o i n t , s t o r e d b y w h a t e v e r m e t h o d t h e b o o t l o a d e r
* requires t o g e t t h e k e r n e l r u n n i g n a g a i n . T h i s c o d e e x p e c t s t o b e
* entered w i t h n o c a c h e s l i v e a n d t h e M M U d i s a b l e d . I t w i l l t h e n
* restore t h e M M U a n d o t h e r b a s i c C P r e g i s t e r s s a v e d a n d r e s t a r t
* the k e r n e l C c o d e t o f i n i s h t h e r e s u m e c o d e .
* /
ENTRY( s3 c _ c p u _ r e s u m e )
msr c p s r _ c , #P S R _ I _ B I T | P S R _ F _ B I T | S V C _ M O D E
ldr r2 , =LL_UART / * f o r d e b u g * /
# ifdef C O N F I G _ S 3 C _ P M _ D E B U G _ L E D _ S M D K
2011-05-06 04:37:17 +04:00
# define S 3 C 6 4 X X _ G P N C O N ( S 3 C 6 4 X X _ G P N _ B A S E + 0 x00 )
# define S 3 C 6 4 X X _ G P N D A T ( S 3 C 6 4 X X _ G P N _ B A S E + 0 x04 )
# define S 3 C 6 4 X X _ G P N _ C O N M A S K ( _ _ g p i o ) ( 0 x3 < < ( ( _ _ g p i o ) * 2 ) )
# define S 3 C 6 4 X X _ G P N _ O U T P U T ( _ _ g p i o ) ( 0 x1 < < ( ( _ _ g p i o ) * 2 ) )
2009-03-10 21:19:35 +03:00
/ * Initialise t h e G P I O s t a t e i f w e a r e d e b u g g i n g v i a t h e S M D K L E D s ,
* as t h e u b o o t v e r s i o n s u p p l i e d r e s e t s t h e s e t o i n p u t s d u r i n g t h e
* resume c h e c k s .
* /
ldr r3 , =S3C64XX_PA_GPIO
ldr r0 , [ r3 , #S 3 C 6 4 X X _ G P N C O N ]
bic r0 , r0 , #( S 3 C 6 4 X X _ G P N _ C O N M A S K ( 1 2 ) | S 3 C 6 4 X X _ G P N _ C O N M A S K ( 1 3 ) | \
S3 C 6 4 X X _ G P N _ C O N M A S K ( 1 4 ) | S 3 C 6 4 X X _ G P N _ C O N M A S K ( 1 5 ) )
orr r0 , r0 , #( S 3 C 6 4 X X _ G P N _ O U T P U T ( 1 2 ) | S 3 C 6 4 X X _ G P N _ O U T P U T ( 1 3 ) | \
S3 C 6 4 X X _ G P N _ O U T P U T ( 1 4 ) | S 3 C 6 4 X X _ G P N _ O U T P U T ( 1 5 ) )
str r0 , [ r3 , #S 3 C 6 4 X X _ G P N C O N ]
ldr r0 , [ r3 , #S 3 C 6 4 X X _ G P N D A T ]
bic r0 , r0 , #0xf < < 1 2 @ GPN12..15
orr r0 , r0 , #1 < < 1 5 @ GPN15
str r0 , [ r3 , #S 3 C 6 4 X X _ G P N D A T ]
# endif
2011-02-06 20:39:31 +03:00
b c p u _ r e s u m e