2005-07-01 11:27:05 +01:00
/ *
* PXA2 7 x s t a n d b y m o d e
*
* Author : David B u r r a g e
*
* 2 0 0 5 ( c) M o n t a V i s t a S o f t w a r e , I n c . T h i s f i l e i s l i c e n s e d u n d e r
* the 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 . T h i s p r o g r a m
* is l i c e n s e d " a s i s " w i t h o u t a n y w a r r a n t y o f a n y k i n d , w h e t h e r e x p r e s s
* or i m p l i e d .
* /
# 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 < a s m / h a r d w a r e . h >
# include < a s m / a r c h / p x a - r e g s . h >
.text
2008-01-04 22:43:36 +00:00
# ifdef C O N F I G _ P X A 2 7 x
2005-07-01 11:27:05 +01:00
ENTRY( p x a _ c p u _ s t a n d b y )
ldr r0 , =PSSR
mov r1 , #( P S S R _ P H | P S S R _ S T S )
2005-10-28 16:25:01 +01:00
mov r2 , #P W R M O D E _ S T A N D B Y
2005-07-01 11:27:05 +01:00
mov r3 , #U N C A C H E D _ P H Y S _ 0 @ Read mem context in.
ldr i p , [ r3 ]
b 1 f
.align 5
1 : mcr p14 , 0 , r2 , c7 , c0 , 0 @ put the system into Standby
str r1 , [ r0 ] @ make sure PSSR_PH/STS are clear
mov p c , l r
2008-01-04 22:43:36 +00:00
# endif
2008-01-07 22:18:30 +00:00
# ifdef C O N F I G _ P X A 3 x x
# define M D C N F G 0 x00 0 0
# define M D C N F G _ D M C E N ( 1 < < 3 0 )
# define D D R _ H C A L 0 x00 6 0
# define D D R _ H C A L _ H C R N G 0 x1 f
# define D D R _ H C A L _ H C P R O G ( 1 < < 2 8 )
# define D D R _ H C A L _ H C E N ( 1 < < 3 1 )
# define D M C I E R 0 x00 7 0
# define D M C I E R _ E D L P ( 1 < < 2 9 )
# define D M C I S R 0 x00 7 8
# define R C O M P 0 x01 0 0
# define R C O M P _ S W E V A L ( 1 < < 3 1 )
ENTRY( p m _ e n t e r _ s t a n d b y _ s t a r t )
mov r1 , #0xf6000000 @ DMEMC_REG_BASE (MDCNFG)
add r1 , r1 , #0x00100000
/ *
* Preload t h e T L B e n t r y f o r a c c e s s i n g t h e d y n a m i c m e m o r y
* controller r e g i s t e r s . N o t e t h a t p a g e t a b l e l o o k u p s w i l l
* fail u n t i l t h e d y n a m i c m e m o r y c o n t r o l l e r h a s b e e n
* reinitialised - a n d t h a t i n c l u d e s M M U p a g e t a b l e w a l k s .
* This a l s o m e a n s t h a t o n l y t h e d y n a m i c m e m o r y c o n t r o l l e r
* can b e r e l i a b l y a c c e s s e d i n t h e c o d e f o l l o w i n g s t a n d b y .
* /
ldr r2 , [ r1 ] @ Dummy read MDCNFG
mcr p14 , 0 , r0 , c7 , c0 , 0
.rept 8
nop
.endr
ldr r0 , [ r1 , #D D R _ H C A L ] @ C l e a r ( a n d w a i t f o r ) H C E N
bic r0 , r0 , #D D R _ H C A L _ H C E N
str r0 , [ r1 , #D D R _ H C A L ]
1 : ldr r0 , [ r1 , #D D R _ H C A L ]
tst r0 , #D D R _ H C A L _ H C E N
bne 1 b
ldr r0 , [ r1 , #R C O M P ] @ I n i t i a t e R C O M P
orr r0 , r0 , #R C O M P _ S W E V A L
str r0 , [ r1 , #R C O M P ]
mov r0 , #~ 0 @ Clear interrupts
str r0 , [ r1 , #D M C I S R ]
ldr r0 , [ r1 , #D M C I E R ] @ s e t D M I E R [ E D L P ]
orr r0 , r0 , #D M C I E R _ E D L P
str r0 , [ r1 , #D M C I E R ]
ldr r0 , [ r1 , #D D R _ H C A L ] @ c l e a r H C R N G , s e t H C P R O G , H C E N
bic r0 , r0 , #D D R _ H C A L _ H C R N G
orr r0 , r0 , #D D R _ H C A L _ H C E N | D D R _ H C A L _ H C P R O G
str r0 , [ r1 , #D D R _ H C A L ]
1 : ldr r0 , [ r1 , #D M C I S R ]
tst r0 , #D M C I E R _ E D L P
beq 1 b
ldr r0 , [ r1 , #M D C N F G ] @ s e t M D C N F G [ D M C E N ]
orr r0 , r0 , #M D C N F G _ D M C E N
str r0 , [ r1 , #M D C N F G ]
1 : ldr r0 , [ r1 , #M D C N F G ]
tst r0 , #M D C N F G _ D M C E N
beq 1 b
ldr r0 , [ r1 , #D D R _ H C A L ] @ s e t D D R _ H C A L [ H C R N G ]
orr r0 , r0 , #2 @ HCRNG
str r0 , [ r1 , #D D R _ H C A L ]
ldr r0 , [ r1 , #D M C I E R ] @ C l e a r t h e i n t e r r u p t
bic r0 , r0 , #0x20000000
str r0 , [ r1 , #D M C I E R ]
mov p c , l r
ENTRY( p m _ e n t e r _ s t a n d b y _ e n d )
# endif