2009-10-29 10:52:15 +00:00
/ *
* KFR2 R 0 9 s d r a m s e l f / a u t o - r e f r e s h s e t u p c o d e
*
* Copyright ( C ) 2 0 0 9 M a g n u s D a m m
*
* This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l P u b l i c
* License. S e e t h e f i l e " C O P Y I N G " i n t h e m a i n d i r e c t o r y o f t h i s a r c h i v e
* for m o r e d e t a i l s .
* /
# include < l i n u x / s y s . h >
# include < l i n u x / e r r n o . h >
# include < l i n u x / l i n k a g e . h >
# include < a s m / a s m - o f f s e t s . h >
# include < a s m / s u s p e n d . h >
# include < a s m / r o m i m a g e - m a c r o s . h >
/ * code t o e n t e r a n d l e a v e s e l f - r e f r e s h . m u s t b e s e l f - c o n t a i n e d .
* this c o d e w i l l b e c o p i e d t o o n - c h i p m e m o r y a n d e x e c u t e d f r o m t h e r e .
* /
.balign 4
ENTRY( k f r2 r09 _ s d r a m _ e n t e r _ s t a r t )
/* DBSC: put memory in self-refresh mode */
ED 0 x F D 0 0 0 0 1 0 , 0 x00 0 0 0 0 0 0 / * D B E N * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 0 0 0 0 0 / * D B R F P D N 0 * /
ED 0 x F D 0 0 0 0 1 4 , 0 x00 0 0 0 0 0 2 / * D B C M D C N T ( P A L L ) * /
ED 0 x F D 0 0 0 0 1 4 , 0 x00 0 0 0 0 0 4 / * D B C M D C N T ( R E F ) * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 0 0 0 0 1 / * D B R F P D N 0 * /
rts
nop
ENTRY( k f r2 r09 _ s d r a m _ e n t e r _ e n d )
.balign 4
ENTRY( k f r2 r09 _ s d r a m _ l e a v e _ s t a r t )
/* DBSC: put memory in auto-refresh mode */
2009-10-30 04:24:48 +00:00
mov. l @(SH_SLEEP_MODE, r5), r0
tst #S U S P _ S H _ R S T A N D B Y , r 0
bf r e s u m e _ r s t a n d b y
2009-10-29 10:52:15 +00:00
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 0 0 0 0 0 / * D B R F P D N 0 * /
WAIT 1
ED 0 x F D 0 0 0 0 1 4 , 0 x00 0 0 0 0 0 2 / * D B C M D C N T ( P A L L ) * /
ED 0 x F D 0 0 0 0 1 4 , 0 x00 0 0 0 0 0 4 / * D B C M D C N T ( R E F ) * /
ED 0 x F D 0 0 0 0 1 0 , 0 x00 0 0 0 0 0 1 / * D B E N * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 1 0 0 0 0 / * D B R F P D N 0 * /
rts
nop
2009-10-30 04:24:48 +00:00
resume_rstandby :
/* DBSC: re-initialize and put in auto-refresh */
ED 0 x F D 0 0 0 1 0 8 , 0 x40 0 0 0 3 0 1 / * D B P D C N T 0 * /
ED 0 x F D 0 0 0 0 2 0 , 0 x01 1 B 0 0 0 2 / * D B C O N F * /
ED 0 x F D 0 0 0 0 3 0 , 0 x03 0 6 0 E 0 2 / * D B T R 0 * /
ED 0 x F D 0 0 0 0 3 4 , 0 x01 0 2 0 1 0 2 / * D B T R 1 * /
ED 0 x F D 0 0 0 0 3 8 , 0 x01 0 9 0 4 0 6 / * D B T R 2 * /
ED 0 x F D 0 0 0 0 0 8 , 0 x00 0 0 0 0 0 4 / * D B K I N D * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 0 0 0 0 1 / * D B R F P D N 0 * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 0 0 0 0 0 / * D B R F P D N 0 * /
ED 0 x F D 0 0 0 0 1 8 , 0 x00 0 0 0 0 0 1 / * D B C K E C N T * /
WAIT 1
ED 0 x F D 0 0 0 0 1 0 , 0 x00 0 0 0 0 0 1 / * D B E N * /
ED 0 x F D 0 0 0 0 4 4 , 0 x00 0 0 0 4 A F / * D B R F P D N 1 * /
ED 0 x F D 0 0 0 0 4 8 , 0 x20 C F 0 0 3 7 / * D B R F P D N 2 * /
ED 0 x F D 0 0 0 0 1 4 , 0 x00 0 0 0 0 0 4 / * D B C M D C N T ( R E F ) * /
ED 0 x F D 0 0 0 1 0 8 , 0 x40 0 0 0 3 0 0 / * D B P D C N T 0 * /
ED 0 x F D 0 0 0 0 4 0 , 0 x00 0 1 0 0 0 0 / * D B R F P D N 0 * /
rts
nop
2009-10-29 10:52:15 +00:00
ENTRY( k f r2 r09 _ s d r a m _ l e a v e _ e n d )