2005-07-01 14:27:05 +04: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 >
2008-08-05 19:14:15 +04:00
# include < m a c h / h a r d w a r e . h >
2005-07-01 14:27:05 +04:00
2008-08-05 19:14:15 +04:00
# include < m a c h / p x a2 x x - r e g s . h >
2005-07-01 14:27:05 +04:00
.text
2008-01-05 01:43:36 +03:00
# ifdef C O N F I G _ P X A 2 7 x
2005-07-01 14:27:05 +04: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 19:25:01 +04:00
mov r2 , #P W R M O D E _ S T A N D B Y
2005-07-01 14:27:05 +04: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-05 01:43:36 +03:00
# endif
2008-01-08 01:18:30 +03:00
# ifdef C O N F I G _ P X A 3 x x
2008-05-18 17:57:59 +04:00
# define P X A 3 _ M D C N F G 0 x00 0 0
# define P X A 3 _ M D C N F G _ D M C E N ( 1 < < 3 0 )
# define P X A 3 _ D D R _ H C A L 0 x00 6 0
# define P X A 3 _ D D R _ H C A L _ H C R N G 0 x1 f
# define P X A 3 _ D D R _ H C A L _ H C P R O G ( 1 < < 2 8 )
# define P X A 3 _ D D R _ H C A L _ H C E N ( 1 < < 3 1 )
# define P X A 3 _ D M C I E R 0 x00 7 0
# define P X A 3 _ D M C I E R _ E D L P ( 1 < < 2 9 )
# define P X A 3 _ D M C I S R 0 x00 7 8
# define P X A 3 _ R C O M P 0 x01 0 0
# define P X A 3 _ R C O M P _ S W E V A L ( 1 < < 3 1 )
2008-01-08 01:18:30 +03:00
ENTRY( p m _ e n t e r _ s t a n d b y _ s t a r t )
2008-05-18 17:57:59 +04:00
mov r1 , #0xf6000000 @ DMEMC_REG_BASE (PXA3_MDCNFG)
2008-01-08 01:18:30 +03:00
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 .
* /
2008-05-18 17:57:59 +04:00
ldr r2 , [ r1 ] @ Dummy read PXA3_MDCNFG
2008-01-08 01:18:30 +03:00
mcr p14 , 0 , r0 , c7 , c0 , 0
.rept 8
nop
.endr
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ D D R _ H C A L ] @ Clear (and wait for) HCEN
bic r0 , r0 , #P X A 3 _ D D R _ H C A L _ H C E N
str r0 , [ r1 , #P X A 3 _ D D R _ H C A L ]
1 : ldr r0 , [ r1 , #P X A 3 _ D D R _ H C A L ]
tst r0 , #P X A 3 _ D D R _ H C A L _ H C E N
2008-01-08 01:18:30 +03:00
bne 1 b
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ R C O M P ] @ Initiate RCOMP
orr r0 , r0 , #P X A 3 _ R C O M P _ S W E V A L
str r0 , [ r1 , #P X A 3 _ R C O M P ]
2008-01-08 01:18:30 +03:00
2008-05-18 17:57:59 +04:00
mov r0 , #~ 0 @ Clear interrupts
str r0 , [ r1 , #P X A 3 _ D M C I S R ]
2008-01-08 01:18:30 +03:00
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ D M C I E R ] @ set DMIER[EDLP]
orr r0 , r0 , #P X A 3 _ D M C I E R _ E D L P
str r0 , [ r1 , #P X A 3 _ D M C I E R ]
2008-01-08 01:18:30 +03:00
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ D D R _ H C A L ] @ clear HCRNG, set HCPROG, HCEN
bic r0 , r0 , #P X A 3 _ D D R _ H C A L _ H C R N G
orr r0 , r0 , #P X A 3 _ D D R _ H C A L _ H C E N | P X A 3 _ D D R _ H C A L _ H C P R O G
str r0 , [ r1 , #P X A 3 _ D D R _ H C A L ]
2008-01-08 01:18:30 +03:00
2008-05-18 17:57:59 +04:00
1 : ldr r0 , [ r1 , #P X A 3 _ D M C I S R ]
tst r0 , #P X A 3 _ D M C I E R _ E D L P
2008-01-08 01:18:30 +03:00
beq 1 b
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ M D C N F G ] @ set PXA3_MDCNFG[DMCEN]
orr r0 , r0 , #P X A 3 _ M D C N F G _ D M C E N
str r0 , [ r1 , #P X A 3 _ M D C N F G ]
1 : ldr r0 , [ r1 , #P X A 3 _ M D C N F G ]
tst r0 , #P X A 3 _ M D C N F G _ D M C E N
2008-01-08 01:18:30 +03:00
beq 1 b
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ D D R _ H C A L ] @ set PXA3_DDR_HCAL[HCRNG]
2008-01-08 01:18:30 +03:00
orr r0 , r0 , #2 @ HCRNG
2008-05-18 17:57:59 +04:00
str r0 , [ r1 , #P X A 3 _ D D R _ H C A L ]
2008-01-08 01:18:30 +03:00
2008-05-18 17:57:59 +04:00
ldr r0 , [ r1 , #P X A 3 _ D M C I E R ] @ Clear the interrupt
2008-01-08 01:18:30 +03:00
bic r0 , r0 , #0x20000000
2008-05-18 17:57:59 +04:00
str r0 , [ r1 , #P X A 3 _ D M C I E R ]
2008-01-08 01:18:30 +03:00
mov p c , l r
ENTRY( p m _ e n t e r _ s t a n d b y _ e n d )
# endif