2007-07-12 22:41:45 +08:00
/ *
* File : arch/ b l a c k f i n / m a c h - b f54 8 / h e a d . S
* Based o n : a r c h / b l a c k f i n / m a c h - b f53 7 / h e a d . S
* Author : Jeff D i o n n e < j e f f @uclinux.org> COPYRIGHT 1998 D. Jeff Dionne
*
* Created : 1 9 9 8
* Description : Startup c o d e f o r B l a c k f i n B F 5 4 8
*
* Modified :
* Copyright 2 0 0 4 - 2 0 0 7 A n a l o g D e v i c e s I n c .
*
* Bugs : Enter b u g s a t h t t p : / / b l a c k f i n . u c l i n u x . o r g /
*
* 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, see the file COPYING, or write
* to 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 , I n c . ,
* 5 1 Franklin S t , F i f t h F l o o r , B o s t o n , M A 0 2 1 1 0 - 1 3 0 1 U S A
* /
# include < l i n u x / l i n k a g e . h >
2008-02-29 12:02:10 +08:00
# include < l i n u x / i n i t . h >
2007-07-12 22:41:45 +08:00
# include < a s m / b l a c k f i n . h >
2008-07-14 16:51:57 +08:00
# ifdef C O N F I G _ B F I N _ K E R N E L _ C L O C K
2008-08-27 10:51:02 +08:00
# include < a s m / c l o c k s . h >
# include < m a c h / m e m _ i n i t . h >
2007-07-12 22:41:45 +08:00
# endif
.section .l1 .text
2008-07-14 16:51:57 +08:00
# ifdef C O N F I G _ B F I N _ K E R N E L _ C L O C K
2007-07-12 22:41:45 +08:00
ENTRY( _ s t a r t _ d m a _ c o d e )
/* Enable PHY CLK buffer output */
p0 . h = h i ( V R _ C T L ) ;
p0 . l = l o ( V R _ C T L ) ;
r0 . l = w [ p0 ] ;
bitset( r0 , 1 4 ) ;
w[ p0 ] = r0 . l ;
ssync;
2007-12-23 23:02:13 +08:00
p0 . h = h i ( S I C _ I W R 0 ) ;
p0 . l = l o ( S I C _ I W R 0 ) ;
2007-07-12 22:41:45 +08:00
r0 . l = 0 x1 ;
r0 . h = 0 x0 ;
[ p0 ] = r0 ;
SSYNC;
/ *
* Set P L L _ C T L
* - [ 14 : 0 9 ] = MSEL[ 5 : 0 ] : C L K I N / V C O m u l t i p l i c a t i o n f a c t o r s
* - [ 8 ] = BYPASS : B Y P A S S t h e P L L , r u n C L K I N i n t o C C L K / S C L K
* - [ 7 ] = output d e l a y ( a d d 2 0 0 p s o f d e l a y t o m e m s i g n a l s )
* - [ 6 ] = input d e l a y ( a d d 2 0 0 p s o f i n p u t d e l a y t o m e m s i g n a l s )
* - [ 5 ] = PDWN : 1 =All C l o c k s o f f
* - [ 3 ] = STOPCK : 1 =Core C l o c k o f f
* - [ 1 ] = PLL_ O F F : 1 =Disable P o w e r t o P L L
* - [ 0 ] = DF : 1 =Pass C L K I N / 2 t o P L L / 0 =Pass C L K I N t o P L L
* all o t h e r b i t s s e t t o z e r o
* /
p0 . h = h i ( P L L _ L O C K C N T ) ;
p0 . l = l o ( P L L _ L O C K C N T ) ;
r0 = 0 x30 0 ( Z ) ;
w[ p0 ] = r0 . l ;
ssync;
2008-01-27 16:32:31 +08:00
# if d e f i n e d ( C O N F I G _ B F 5 4 x )
P2 . H = h i ( E B I U _ R S T C T L ) ;
P2 . L = l o ( E B I U _ R S T C T L ) ;
R0 = [ P 2 ] ;
BITSET ( R 0 , 3 ) ;
# else
2007-07-12 22:41:45 +08:00
P2 . H = h i ( E B I U _ S D G C T L ) ;
P2 . L = l o ( E B I U _ S D G C T L ) ;
R0 = [ P 2 ] ;
BITSET ( R 0 , 2 4 ) ;
2008-01-27 16:32:31 +08:00
# endif
2007-07-12 22:41:45 +08:00
[ P2 ] = R 0 ;
SSYNC;
2008-01-27 16:32:31 +08:00
# if d e f i n e d ( C O N F I G _ B F 5 4 x )
.LSRR_MODE :
R0 = [ P 2 ] ;
CC = B I T T S T ( R 0 , 4 ) ;
if ! C C J U M P . L S R R _ M O D E ;
# endif
2007-07-12 22:41:45 +08:00
r0 = C O N F I G _ V C O _ M U L T & 6 3 ; /* Load the VCO multiplier */
r0 = r0 < < 9 ; /* Shift it over, */
r1 = C L K I N _ H A L F ; /* Do we need to divide CLKIN by 2?*/
r0 = r1 | r0 ;
r1 = P L L _ B Y P A S S ; /* Bypass the PLL? */
r1 = r1 < < 8 ; /* Shift it over */
r0 = r1 | r0 ; /* add them all together */
p0 . h = h i ( P L L _ C T L ) ;
p0 . l = l o ( P L L _ C T L ) ; /* Load the address */
cli r2 ; /* Disable interrupts */
ssync;
w[ p0 ] = r0 . l ; /* Set the value */
idle; /* Wait for the PLL to stablize */
sti r2 ; /* Enable interrupts */
.Lcheck_again :
p0 . h = h i ( P L L _ S T A T ) ;
p0 . l = l o ( P L L _ S T A T ) ;
R0 = W [ P 0 ] ( Z ) ;
CC = B I T T S T ( R 0 ,5 ) ;
if ! C C j u m p . L c h e c k _ a g a i n ;
/* Configure SCLK & CCLK Dividers */
r0 = ( C O N F I G _ C C L K _ A C T _ D I V | C O N F I G _ S C L K _ D I V ) ;
p0 . h = h i ( P L L _ D I V ) ;
p0 . l = l o ( P L L _ D I V ) ;
w[ p0 ] = r0 . l ;
ssync;
2008-01-27 16:32:31 +08:00
# if d e f i n e d ( C O N F I G _ B F 5 4 x )
P2 . H = h i ( E B I U _ R S T C T L ) ;
P2 . L = l o ( E B I U _ R S T C T L ) ;
R0 = [ P 2 ] ;
CC = B I T T S T ( R 0 , 0 ) ;
if C C j u m p . L s k i p d d r r s t ;
BITSET ( R 0 , 0 ) ;
.Lskipddrrst :
BITCLR ( R 0 , 3 ) ;
[ P2 ] = R 0 ;
SSYNC;
p0 . l = l o ( E B I U _ D D R C T L 0 ) ;
p0 . h = h i ( E B I U _ D D R C T L 0 ) ;
r0 . l = l o ( m e m _ D D R C T L 0 ) ;
r0 . h = h i ( m e m _ D D R C T L 0 ) ;
[ p0 ] = r0 ;
ssync;
p0 . l = l o ( E B I U _ D D R C T L 1 ) ;
p0 . h = h i ( E B I U _ D D R C T L 1 ) ;
r0 . l = l o ( m e m _ D D R C T L 1 ) ;
r0 . h = h i ( m e m _ D D R C T L 1 ) ;
[ p0 ] = r0 ;
ssync;
p0 . l = l o ( E B I U _ D D R C T L 2 ) ;
p0 . h = h i ( E B I U _ D D R C T L 2 ) ;
r0 . l = l o ( m e m _ D D R C T L 2 ) ;
r0 . h = h i ( m e m _ D D R C T L 2 ) ;
[ p0 ] = r0 ;
ssync;
# else
2007-07-12 22:41:45 +08:00
p0 . l = l o ( E B I U _ S D R R C ) ;
p0 . h = h i ( E B I U _ S D R R C ) ;
r0 = m e m _ S D R R C ;
w[ p0 ] = r0 . l ;
ssync;
2007-07-25 10:11:42 +08:00
p0 . l = L O ( E B I U _ S D B C T L ) ;
p0 . h = H I ( E B I U _ S D B C T L ) ; /* SDRAM Memory Bank Control Register */
2007-07-12 22:41:45 +08:00
r0 = m e m _ S D B C T L ;
w[ p0 ] = r0 . l ;
ssync;
P2 . H = h i ( E B I U _ S D G C T L ) ;
P2 . L = l o ( E B I U _ S D G C T L ) ;
R0 = [ P 2 ] ;
BITCLR ( R 0 , 2 4 ) ;
p0 . h = h i ( E B I U _ S D S T A T ) ;
p0 . l = l o ( E B I U _ S D S T A T ) ;
r2 . l = w [ p0 ] ;
cc = b i t t s t ( r2 ,3 ) ;
if ! c c j u m p . L s k i p ;
NOP;
BITSET ( R 0 , 2 3 ) ;
.Lskip :
[ P2 ] = R 0 ;
SSYNC;
R0 . L = l o ( m e m _ S D G C T L ) ;
R0 . H = h i ( m e m _ S D G C T L ) ;
R1 = [ p2 ] ;
R1 = R 1 | R 0 ;
[ P2 ] = R 1 ;
SSYNC;
2008-01-27 16:32:31 +08:00
# endif
2007-07-12 22:41:45 +08:00
RTS;
2008-02-29 12:02:10 +08:00
ENDPROC( _ s t a r t _ d m a _ c o d e )
2007-07-12 22:41:45 +08:00
# endif / * C O N F I G _ B F I N _ K E R N E L _ C L O C K * /