2007-10-23 23:14:41 +04:00
/ *
* linux/ a r c h / a r m / m m / p r o c - f e r o c e o n . S : M M U f u n c t i o n s f o r F e r o c e o n
*
* Heavily b a s e d o n p r o c - a r m 9 2 6 . S
* Maintainer : Assaf H o f f m a n < h o f f m a n @marvell.com>
*
* 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, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e , S u i t e 3 3 0 , B o s t o n , M A 0 2 1 1 1 - 1 3 0 7 U S A
* /
# include < l i n u x / l i n k a g e . h >
# include < l i n u x / i n i t . h >
# include < a s m / a s s e m b l e r . h >
2008-09-07 22:15:31 +04:00
# include < a s m / h w c a p . h >
2007-10-23 23:14:41 +04:00
# include < a s m / p g t a b l e - h w d e f . h >
# include < a s m / p g t a b l e . h >
# include < a s m / p a g e . h >
# include < a s m / p t r a c e . h >
# include " p r o c - m a c r o s . S "
/ *
* This i s t h e m a x i m u m s i z e o f a n a r e a w h i c h w i l l b e i n v a l i d a t e d
* using t h e s i n g l e i n v a l i d a t e e n t r y i n s t r u c t i o n s . A n y t h i n g l a r g e r
* than t h i s , a n d w e g o f o r t h e w h o l e c a c h e .
*
* This v a l u e s h o u l d b e c h o s e n s u c h t h a t w e c h o o s e t h e c h e a p e s t
* alternative.
* /
# define C A C H E _ D L I M I T 1 6 3 8 4
/ *
* the c a c h e l i n e s i z e o f t h e I a n d D c a c h e
* /
# define C A C H E _ D L I N E S I Z E 3 2
2008-04-24 04:04:54 +04:00
.bss
.align 3
__cache_params_loc :
.space 8
2007-10-23 23:14:41 +04:00
.text
2008-04-24 04:04:54 +04:00
__cache_params :
.word __cache_params_loc
2007-10-23 23:14:41 +04:00
/ *
* cpu_ f e r o c e o n _ p r o c _ i n i t ( )
* /
ENTRY( c p u _ f e r o c e o n _ p r o c _ i n i t )
2008-04-24 04:04:54 +04:00
mrc p15 , 0 , r0 , c0 , c0 , 1 @ read cache type register
ldr r1 , _ _ c a c h e _ p a r a m s
mov r2 , #( 16 < < 5 )
tst r0 , #( 1 < < 1 6 ) @ get way
mov r0 , r0 , l s r #18 @ get cache size order
movne r3 , #( ( 4 - 1 ) < < 3 0 ) @ 4-way
and r0 , r0 , #0xf
moveq r3 , #0 @ 1-way
mov r2 , r2 , l s l r0 @ actual cache size
movne r2 , r2 , l s r #2 @ turned into # of sets
sub r2 , r2 , #( 1 < < 5 )
stmia r1 , { r2 , r3 }
2007-10-23 23:14:41 +04:00
mov p c , l r
/ *
* cpu_ f e r o c e o n _ p r o c _ f i n ( )
* /
ENTRY( c p u _ f e r o c e o n _ p r o c _ f i n )
2008-09-23 16:28:10 +04:00
# if d e f i n e d ( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 ) & & \
! defined( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 _ W R I T E T H R O U G H )
2008-06-23 00:45:04 +04:00
mov r0 , #0
mcr p15 , 1 , r0 , c15 , c9 , 0 @ clean L2
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
# endif
2007-10-23 23:14:41 +04:00
mrc p15 , 0 , r0 , c1 , c0 , 0 @ ctrl register
bic r0 , r0 , #0x1000 @ ...i............
bic r0 , r0 , #0x000e @ ............wca.
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
2010-07-26 15:22:12 +04:00
mov p c , l r
2007-10-23 23:14:41 +04:00
/ *
* cpu_ f e r o c e o n _ r e s e t ( l o c )
*
* Perform a s o f t r e s e t o f t h e s y s t e m . P u t t h e C P U i n t o t h e
* same s t a t e a s i t w o u l d b e i f i t h a d b e e n r e s e t , a n d b r a n c h
* to w h a t w o u l d b e t h e r e s e t v e c t o r .
*
* loc : location t o j u m p t o f o r s o f t r e s e t
* /
.align 5
ENTRY( c p u _ f e r o c e o n _ r e s e t )
mov i p , #0
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate I,D caches
mcr p15 , 0 , i p , c7 , c10 , 4 @ drain WB
# ifdef C O N F I G _ M M U
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I & D TLBs
# endif
mrc p15 , 0 , i p , c1 , c0 , 0 @ ctrl register
bic i p , i p , #0x000f @ ............wcam
bic i p , i p , #0x1100 @ ...i...s........
mcr p15 , 0 , i p , c1 , c0 , 0 @ ctrl register
mov p c , r0
/ *
* cpu_ f e r o c e o n _ d o _ i d l e ( )
*
* Called w i t h I R Q s d i s a b l e d
* /
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( c p u _ f e r o c e o n _ d o _ i d l e )
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c10 , 4 @ Drain write buffer
mcr p15 , 0 , r0 , c7 , c0 , 4 @ Wait for interrupt
mov p c , l r
2010-10-28 14:27:40 +04:00
/ *
* flush_ i c a c h e _ a l l ( )
*
* Unconditionally c l e a n a n d i n v a l i d a t e t h e e n t i r e i c a c h e .
* /
ENTRY( f e r o c e o n _ f l u s h _ i c a c h e _ a l l )
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c5 , 0 @ invalidate I cache
mov p c , l r
ENDPROC( f e r o c e o n _ f l u s h _ i c a c h e _ a l l )
2007-10-23 23:14:41 +04:00
/ *
* flush_ u s e r _ c a c h e _ a l l ( )
*
* Clean a n d i n v a l i d a t e a l l c a c h e e n t r i e s i n a p a r t i c u l a r
* address s p a c e .
* /
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( f e r o c e o n _ f l u s h _ u s e r _ c a c h e _ a l l )
/* FALLTHROUGH */
/ *
* flush_ k e r n _ c a c h e _ a l l ( )
*
* Clean a n d i n v a l i d a t e t h e e n t i r e c a c h e .
* /
ENTRY( f e r o c e o n _ f l u s h _ k e r n _ c a c h e _ a l l )
mov r2 , #V M _ E X E C
2008-04-24 04:04:54 +04:00
2007-10-23 23:14:41 +04:00
__flush_whole_cache :
2008-04-24 04:04:54 +04:00
ldr r1 , _ _ c a c h e _ p a r a m s
ldmia r1 , { r1 , r3 }
1 : orr i p , r1 , r3
2 : mcr p15 , 0 , i p , c7 , c14 , 2 @ clean + invalidate D set/way
subs i p , i p , #( 1 < < 3 0 ) @ next way
bcs 2 b
subs r1 , r1 , #( 1 < < 5 ) @ next set
bcs 1 b
2007-10-23 23:14:41 +04:00
tst r2 , #V M _ E X E C
2008-04-24 04:04:54 +04:00
mov i p , #0
2007-10-23 23:14:41 +04:00
mcrne p15 , 0 , i p , c7 , c5 , 0 @ invalidate I cache
mcrne p15 , 0 , i p , c7 , c10 , 4 @ drain WB
mov p c , l r
/ *
* flush_ u s e r _ c a c h e _ r a n g e ( s t a r t , e n d , f l a g s )
*
* Clean a n d i n v a l i d a t e a r a n g e o f c a c h e e n t r i e s i n t h e
* specified a d d r e s s r a n g e .
*
* - start - s t a r t a d d r e s s ( i n c l u s i v e )
* - end - e n d a d d r e s s ( e x c l u s i v e )
* - flags - v m _ f l a g s d e s c r i b i n g a d d r e s s s p a c e
* /
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( f e r o c e o n _ f l u s h _ u s e r _ c a c h e _ r a n g e )
sub r3 , r1 , r0 @ calculate total size
cmp r3 , #C A C H E _ D L I M I T
bgt _ _ f l u s h _ w h o l e _ c a c h e
1 : tst r2 , #V M _ E X E C
mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean and invalidate D entry
mcrne p15 , 0 , r0 , c7 , c5 , 1 @ invalidate I entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean and invalidate D entry
mcrne p15 , 0 , r0 , c7 , c5 , 1 @ invalidate I entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
tst r2 , #V M _ E X E C
2008-04-24 04:04:54 +04:00
mov i p , #0
2007-10-23 23:14:41 +04:00
mcrne p15 , 0 , i p , c7 , c10 , 4 @ drain WB
mov p c , l r
/ *
* coherent_ k e r n _ r a n g e ( s t a r t , e n d )
*
* Ensure c o h e r e n c y b e t w e e n t h e I c a c h e a n d t h e D c a c h e i n t h e
* region d e s c r i b e d b y s t a r t , e n d . I f y o u h a v e n o n - s n o o p i n g
* Harvard c a c h e s , y o u n e e d t o i m p l e m e n t t h i s f u n c t i o n .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( f e r o c e o n _ c o h e r e n t _ k e r n _ r a n g e )
/* FALLTHROUGH */
/ *
* coherent_ u s e r _ r a n g e ( s t a r t , e n d )
*
* Ensure c o h e r e n c y b e t w e e n t h e I c a c h e a n d t h e D c a c h e i n t h e
* region d e s c r i b e d b y s t a r t , e n d . I f y o u h a v e n o n - s n o o p i n g
* Harvard c a c h e s , y o u n e e d t o i m p l e m e n t t h i s f u n c t i o n .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
ENTRY( f e r o c e o n _ c o h e r e n t _ u s e r _ r a n g e )
bic r0 , r0 , #C A C H E _ D L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
mcr p15 , 0 , r0 , c7 , c5 , 1 @ invalidate I entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
/ *
2009-11-26 15:56:21 +03:00
* flush_ k e r n _ d c a c h e _ a r e a ( v o i d * a d d r , s i z e _ t s i z e )
2007-10-23 23:14:41 +04:00
*
* Ensure n o D c a c h e a l i a s i n g o c c u r s , e i t h e r w i t h i t s e l f o r
* the I c a c h e
*
2009-11-26 15:56:21 +03:00
* - addr - k e r n e l a d d r e s s
* - size - r e g i o n s i z e
2007-10-23 23:14:41 +04:00
* /
2008-04-25 21:56:32 +04:00
.align 5
2009-11-26 15:56:21 +03:00
ENTRY( f e r o c e o n _ f l u s h _ k e r n _ d c a c h e _ a r e a )
add r1 , r0 , r1
2007-10-23 23:14:41 +04:00
1 : mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean+invalidate D entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c5 , 0 @ invalidate I cache
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2008-06-03 12:24:40 +04:00
.align 5
2009-11-26 15:56:21 +03:00
ENTRY( f e r o c e o n _ r a n g e _ f l u s h _ k e r n _ d c a c h e _ a r e a )
2008-06-03 12:24:40 +04:00
mrs r2 , c p s r
add r1 , r0 , #P A G E _ S Z - C A C H E _ D L I N E S I Z E @ t o p a d d r i s i n c l u s i v e
orr r3 , r2 , #P S R _ I _ B I T
msr c p s r _ c , r3 @ disable interrupts
mcr p15 , 5 , r0 , c15 , c15 , 0 @ D clean/inv range start
mcr p15 , 5 , r1 , c15 , c15 , 1 @ D clean/inv range top
msr c p s r _ c , r2 @ restore interrupts
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c5 , 0 @ invalidate I cache
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2007-10-23 23:14:41 +04:00
/ *
* dma_ i n v _ r a n g e ( s t a r t , e n d )
*
* Invalidate ( d i s c a r d ) t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
* May n o t w r i t e b a c k a n y e n t r i e s . I f ' s t a r t ' o r ' e n d '
* are n o t c a c h e l i n e a l i g n e d , t h o s e l i n e s m u s t b e w r i t t e n
* back.
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
*
* ( same a s v4 w b )
* /
2008-04-25 21:56:32 +04:00
.align 5
2009-11-26 19:24:19 +03:00
feroceon_dma_inv_range :
2007-10-23 23:14:41 +04:00
tst r0 , #C A C H E _ D L I N E S I Z E - 1
2008-06-03 12:24:40 +04:00
bic r0 , r0 , #C A C H E _ D L I N E S I Z E - 1
2007-10-23 23:14:41 +04:00
mcrne p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
tst r1 , #C A C H E _ D L I N E S I Z E - 1
mcrne p15 , 0 , r1 , c7 , c10 , 1 @ clean D entry
1 : mcr p15 , 0 , r0 , c7 , c6 , 1 @ invalidate D entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2008-06-03 12:24:40 +04:00
.align 5
2009-11-26 19:24:19 +03:00
feroceon_range_dma_inv_range :
2008-06-03 12:24:40 +04:00
mrs r2 , c p s r
tst r0 , #C A C H E _ D L I N E S I Z E - 1
mcrne p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
tst r1 , #C A C H E _ D L I N E S I Z E - 1
mcrne p15 , 0 , r1 , c7 , c10 , 1 @ clean D entry
cmp r1 , r0
subne r1 , r1 , #1 @ top address is inclusive
orr r3 , r2 , #P S R _ I _ B I T
msr c p s r _ c , r3 @ disable interrupts
mcr p15 , 5 , r0 , c15 , c14 , 0 @ D inv range start
mcr p15 , 5 , r1 , c15 , c14 , 1 @ D inv range top
msr c p s r _ c , r2 @ restore interrupts
mov p c , l r
2007-10-23 23:14:41 +04:00
/ *
* dma_ c l e a n _ r a n g e ( s t a r t , e n d )
*
* Clean t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
*
* ( same a s v4 w b )
* /
2008-04-25 21:56:32 +04:00
.align 5
2009-11-26 19:24:19 +03:00
feroceon_dma_clean_range :
2007-10-23 23:14:41 +04:00
bic r0 , r0 , #C A C H E _ D L I N E S I Z E - 1
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2008-06-03 12:24:40 +04:00
.align 5
2009-11-26 19:24:19 +03:00
feroceon_range_dma_clean_range :
2008-06-03 12:24:40 +04:00
mrs r2 , c p s r
cmp r1 , r0
subne r1 , r1 , #1 @ top address is inclusive
orr r3 , r2 , #P S R _ I _ B I T
msr c p s r _ c , r3 @ disable interrupts
mcr p15 , 5 , r0 , c15 , c13 , 0 @ D clean range start
mcr p15 , 5 , r1 , c15 , c13 , 1 @ D clean range top
msr c p s r _ c , r2 @ restore interrupts
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2007-10-23 23:14:41 +04:00
/ *
* dma_ f l u s h _ r a n g e ( s t a r t , e n d )
*
* Clean a n d i n v a l i d a t e t h e s p e c i f i e d v i r t u a l a d d r e s s r a n g e .
*
* - start - v i r t u a l s t a r t a d d r e s s
* - end - v i r t u a l e n d a d d r e s s
* /
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( f e r o c e o n _ d m a _ f l u s h _ r a n g e )
bic r0 , r0 , #C A C H E _ D L I N E S I Z E - 1
2008-04-25 21:56:32 +04:00
1 : mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean+invalidate D entry
2007-10-23 23:14:41 +04:00
add r0 , r0 , #C A C H E _ D L I N E S I Z E
cmp r0 , r1
blo 1 b
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2008-06-03 12:24:40 +04:00
.align 5
ENTRY( f e r o c e o n _ r a n g e _ d m a _ f l u s h _ r a n g e )
mrs r2 , c p s r
cmp r1 , r0
subne r1 , r1 , #1 @ top address is inclusive
orr r3 , r2 , #P S R _ I _ B I T
msr c p s r _ c , r3 @ disable interrupts
mcr p15 , 5 , r0 , c15 , c15 , 0 @ D clean/inv range start
mcr p15 , 5 , r1 , c15 , c15 , 1 @ D clean/inv range top
msr c p s r _ c , r2 @ restore interrupts
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
2009-11-26 19:19:58 +03:00
/ *
* dma_ m a p _ a r e a ( s t a r t , s i z e , d i r )
* - start - k e r n e l v i r t u a l s t a r t a d d r e s s
* - size - s i z e o f r e g i o n
* - dir - D M A d i r e c t i o n
* /
ENTRY( f e r o c e o n _ d m a _ m a p _ a r e a )
add r1 , r1 , r0
cmp r2 , #D M A _ T O _ D E V I C E
beq f e r o c e o n _ d m a _ c l e a n _ r a n g e
bcs f e r o c e o n _ d m a _ i n v _ r a n g e
b f e r o c e o n _ d m a _ f l u s h _ r a n g e
ENDPROC( f e r o c e o n _ d m a _ m a p _ a r e a )
/ *
* dma_ m a p _ a r e a ( s t a r t , s i z e , d i r )
* - start - k e r n e l v i r t u a l s t a r t a d d r e s s
* - size - s i z e o f r e g i o n
* - dir - D M A d i r e c t i o n
* /
ENTRY( f e r o c e o n _ r a n g e _ d m a _ m a p _ a r e a )
add r1 , r1 , r0
cmp r2 , #D M A _ T O _ D E V I C E
beq f e r o c e o n _ r a n g e _ d m a _ c l e a n _ r a n g e
bcs f e r o c e o n _ r a n g e _ d m a _ i n v _ r a n g e
b f e r o c e o n _ r a n g e _ d m a _ f l u s h _ r a n g e
ENDPROC( f e r o c e o n _ r a n g e _ d m a _ m a p _ a r e a )
/ *
* dma_ u n m a p _ a r e a ( s t a r t , s i z e , d i r )
* - start - k e r n e l v i r t u a l s t a r t a d d r e s s
* - size - s i z e o f r e g i o n
* - dir - D M A d i r e c t i o n
* /
ENTRY( f e r o c e o n _ d m a _ u n m a p _ a r e a )
mov p c , l r
ENDPROC( f e r o c e o n _ d m a _ u n m a p _ a r e a )
2007-10-23 23:14:41 +04:00
ENTRY( f e r o c e o n _ c a c h e _ f n s )
2010-10-28 14:27:40 +04:00
.long feroceon_flush_icache_all
2007-10-23 23:14:41 +04:00
.long feroceon_flush_kern_cache_all
.long feroceon_flush_user_cache_all
.long feroceon_flush_user_cache_range
.long feroceon_coherent_kern_range
.long feroceon_coherent_user_range
2009-11-26 15:56:21 +03:00
.long feroceon_flush_kern_dcache_area
2009-11-26 19:19:58 +03:00
.long feroceon_dma_map_area
.long feroceon_dma_unmap_area
2007-10-23 23:14:41 +04:00
.long feroceon_dma_flush_range
2008-06-03 12:24:40 +04:00
ENTRY( f e r o c e o n _ r a n g e _ c a c h e _ f n s )
2010-10-28 14:27:40 +04:00
.long feroceon_flush_icache_all
2008-06-03 12:24:40 +04:00
.long feroceon_flush_kern_cache_all
.long feroceon_flush_user_cache_all
.long feroceon_flush_user_cache_range
.long feroceon_coherent_kern_range
.long feroceon_coherent_user_range
2009-11-26 15:56:21 +03:00
.long feroceon_range_flush_kern_dcache_area
2009-11-26 19:19:58 +03:00
.long feroceon_range_dma_map_area
.long feroceon_dma_unmap_area
2008-06-03 12:24:40 +04:00
.long feroceon_range_dma_flush_range
2008-04-25 21:56:32 +04:00
.align 5
2007-10-23 23:14:41 +04:00
ENTRY( c p u _ f e r o c e o n _ d c a c h e _ c l e a n _ a r e a )
2008-09-23 16:28:10 +04:00
# if d e f i n e d ( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 ) & & \
! defined( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 _ W R I T E T H R O U G H )
2008-06-23 00:45:04 +04:00
mov r2 , r0
mov r3 , r1
# endif
2007-10-23 23:14:41 +04:00
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
add r0 , r0 , #C A C H E _ D L I N E S I Z E
subs r1 , r1 , #C A C H E _ D L I N E S I Z E
bhi 1 b
2008-09-23 16:28:10 +04:00
# if d e f i n e d ( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 ) & & \
! defined( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 _ W R I T E T H R O U G H )
2008-06-23 00:45:04 +04:00
1 : mcr p15 , 1 , r2 , c15 , c9 , 1 @ clean L2 entry
add r2 , r2 , #C A C H E _ D L I N E S I Z E
subs r3 , r3 , #C A C H E _ D L I N E S I Z E
bhi 1 b
# endif
2007-10-23 23:14:41 +04:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
mov p c , l r
/* =============================== PageTable ============================== */
/ *
* cpu_ f e r o c e o n _ s w i t c h _ m m ( p g d )
*
* Set t h e t r a n s l a t i o n b a s e p o i n t e r t o b e a s d e s c r i b e d b y p g d .
*
* pgd : new p a g e t a b l e s
* /
.align 5
ENTRY( c p u _ f e r o c e o n _ s w i t c h _ m m )
# ifdef C O N F I G _ M M U
2008-04-24 04:04:54 +04:00
/ *
* Note : we w i s h t o c a l l _ _ f l u s h _ w h o l e _ c a c h e b u t w e n e e d t o p r e s e r v e
* lr t o d o s o . T h e o n l y w a y w i t h o u t t o u c h i n g m a i n m e m o r y i s t o
* use r2 w h i c h i s n o r m a l l y u s e d t o t e s t t h e V M _ E X E C f l a g , a n d
* compensate l o c a l l y f o r t h e s k i p p e d o p s i f i t i s n o t s e t .
* /
mov r2 , l r @ abuse r2 to preserve lr
bl _ _ f l u s h _ w h o l e _ c a c h e
@ if r2 contains the VM_EXEC bit then the next 2 ops are done already
tst r2 , #V M _ E X E C
mcreq p15 , 0 , i p , c7 , c5 , 0 @ invalidate I cache
mcreq p15 , 0 , i p , c7 , c10 , 4 @ drain WB
2007-10-23 23:14:41 +04:00
mcr p15 , 0 , r0 , c2 , c0 , 0 @ load page table pointer
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I & D TLBs
2008-04-24 04:04:54 +04:00
mov p c , r2
# else
2007-10-23 23:14:41 +04:00
mov p c , l r
2008-04-24 04:04:54 +04:00
# endif
2007-10-23 23:14:41 +04:00
/ *
* cpu_ f e r o c e o n _ s e t _ p t e _ e x t ( p t e p , p t e , e x t )
*
* Set a P T E a n d f l u s h i t o u t
* /
.align 5
ENTRY( c p u _ f e r o c e o n _ s e t _ p t e _ e x t )
# ifdef C O N F I G _ M M U
2008-09-06 20:19:08 +04:00
armv3 _ s e t _ p t e _ e x t w c _ d i s a b l e =0
2007-10-23 23:14:41 +04:00
mov r0 , r0
mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean D entry
2008-09-23 16:28:10 +04:00
# if d e f i n e d ( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 ) & & \
! defined( C O N F I G _ C A C H E _ F E R O C E O N _ L 2 _ W R I T E T H R O U G H )
2008-06-23 00:45:04 +04:00
mcr p15 , 1 , r0 , c15 , c9 , 1 @ clean L2 entry
# endif
2007-10-23 23:14:41 +04:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain WB
# endif
mov p c , l r
2010-10-01 18:37:05 +04:00
_ _ CPUINIT
2007-10-23 23:14:41 +04:00
.type _ _ feroceon_ s e t u p , #f u n c t i o n
__feroceon_setup :
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c7 @ invalidate I,D caches on v4
mcr p15 , 0 , r0 , c7 , c10 , 4 @ drain write buffer on v4
# ifdef C O N F I G _ M M U
mcr p15 , 0 , r0 , c8 , c7 @ invalidate I,D TLBs on v4
# endif
adr r5 , f e r o c e o n _ c r v a l
ldmia r5 , { r5 , r6 }
mrc p15 , 0 , r0 , c1 , c0 @ get control register v4
bic r0 , r0 , r5
orr r0 , r0 , r6
mov p c , l r
.size _ _ feroceon_ s e t u p , . - _ _ f e r o c e o n _ s e t u p
/ *
2008-07-02 21:06:32 +04:00
* B
* R P
* .RVI UFRS BLDP W C A M
* .011 .001 . .11 0101
2007-10-23 23:14:41 +04:00
*
* /
.type feroceon_ c r v a l , #o b j e c t
feroceon_crval :
2008-07-02 21:06:32 +04:00
crval c l e a r =0x0000773f , m m u s e t =0x00003135 , u c s e t =0x00001134
2007-10-23 23:14:41 +04:00
_ _ INITDATA
/ *
* Purpose : F u n c t i o n p o i n t e r s u s e d t o a c c e s s a b o v e f u n c t i o n s - a l l c a l l s
* come t h r o u g h t h e s e
* /
.type feroceon_ p r o c e s s o r _ f u n c t i o n s , #o b j e c t
feroceon_processor_functions :
.word v5t_early_abort
2009-09-25 16:39:47 +04:00
.word legacy_pabort
2007-10-23 23:14:41 +04:00
.word cpu_feroceon_proc_init
.word cpu_feroceon_proc_fin
.word cpu_feroceon_reset
.word cpu_feroceon_do_idle
.word cpu_feroceon_dcache_clean_area
.word cpu_feroceon_switch_mm
.word cpu_feroceon_set_pte_ext
.size feroceon_ p r o c e s s o r _ f u n c t i o n s , . - f e r o c e o n _ p r o c e s s o r _ f u n c t i o n s
.section " .rodata "
.type cpu_ a r c h _ n a m e , #o b j e c t
cpu_arch_name :
.asciz " armv5 t e "
.size cpu_ a r c h _ n a m e , . - c p u _ a r c h _ n a m e
.type cpu_ e l f _ n a m e , #o b j e c t
cpu_elf_name :
.asciz " v5 "
.size cpu_ e l f _ n a m e , . - c p u _ e l f _ n a m e
.type cpu_ f e r o c e o n _ n a m e , #o b j e c t
cpu_feroceon_name :
.asciz " Feroceon"
.size cpu_ f e r o c e o n _ n a m e , . - c p u _ f e r o c e o n _ n a m e
2008-04-12 01:08:26 +04:00
.type cpu_ 8 8 f r53 1 _ n a m e , #o b j e c t
cpu_88fr531_name :
.asciz " Feroceon 8 8 F R 5 3 1 - v d "
.size cpu_ 8 8 f r53 1 _ n a m e , . - c p u _ 8 8 f r53 1 _ n a m e
2008-06-23 00:45:08 +04:00
.type cpu_ 8 8 f r57 1 _ n a m e , #o b j e c t
cpu_88fr571_name :
.asciz " Feroceon 8 8 F R 5 7 1 - v d "
.size cpu_ 8 8 f r57 1 _ n a m e , . - c p u _ 8 8 f r57 1 _ n a m e
2008-06-23 00:45:05 +04:00
.type cpu_ 8 8 f r13 1 _ n a m e , #o b j e c t
cpu_88fr131_name :
.asciz " Feroceon 8 8 F R 1 3 1 "
.size cpu_ 8 8 f r13 1 _ n a m e , . - c p u _ 8 8 f r13 1 _ n a m e
2007-10-23 23:14:41 +04:00
.align
.section " .proc .info .init " , # alloc, #e x e c i n s t r
2007-11-06 11:35:40 +03:00
# ifdef C O N F I G _ C P U _ F E R O C E O N _ O L D _ I D
.type _ _ feroceon_ o l d _ i d _ p r o c _ i n f o ,#o b j e c t
__feroceon_old_id_proc_info :
2008-06-23 00:45:00 +04:00
.long 0x41009260
.long 0xff00fff0
2008-05-10 18:30:01 +04:00
.long PMD_TYPE_SECT | \
2007-11-06 11:35:40 +03:00
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2008-05-10 18:30:01 +04:00
.long PMD_TYPE_SECT | \
2007-11-06 11:35:40 +03:00
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ f e r o c e o n _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_feroceon_name
.long feroceon_processor_functions
.long v4wbi_tlb_fns
2008-04-24 09:31:45 +04:00
.long feroceon_user_fns
2007-11-06 11:35:40 +03:00
.long feroceon_cache_fns
.size _ _ feroceon_ o l d _ i d _ p r o c _ i n f o , . - _ _ f e r o c e o n _ o l d _ i d _ p r o c _ i n f o
# endif
2008-04-12 01:08:26 +04:00
.type _ _ 8 8 fr5 3 1 _ p r o c _ i n f o ,#o b j e c t
__88fr531_proc_info :
2007-10-23 23:14:41 +04:00
.long 0x56055310
.long 0xfffffff0
2008-05-10 18:30:01 +04:00
.long PMD_TYPE_SECT | \
2007-10-23 23:14:41 +04:00
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2008-05-10 18:30:01 +04:00
.long PMD_TYPE_SECT | \
2007-10-23 23:14:41 +04:00
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ f e r o c e o n _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
2008-04-12 01:08:26 +04:00
.long cpu_88fr531_name
2007-10-23 23:14:41 +04:00
.long feroceon_processor_functions
.long v4wbi_tlb_fns
2008-04-24 09:31:45 +04:00
.long feroceon_user_fns
2007-10-23 23:14:41 +04:00
.long feroceon_cache_fns
2008-04-12 01:08:26 +04:00
.size _ _ 8 8 fr5 3 1 _ p r o c _ i n f o , . - _ _ 8 8 f r53 1 _ p r o c _ i n f o
2008-06-23 00:45:05 +04:00
2008-06-23 00:45:08 +04:00
.type _ _ 8 8 fr5 7 1 _ p r o c _ i n f o ,#o b j e c t
__88fr571_proc_info :
.long 0x56155710
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ f e r o c e o n _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_88fr571_name
.long feroceon_processor_functions
.long v4wbi_tlb_fns
.long feroceon_user_fns
.long feroceon_range_cache_fns
.size _ _ 8 8 fr5 7 1 _ p r o c _ i n f o , . - _ _ 8 8 f r57 1 _ p r o c _ i n f o
2008-06-23 00:45:05 +04:00
.type _ _ 8 8 fr1 3 1 _ p r o c _ i n f o ,#o b j e c t
__88fr131_proc_info :
.long 0x56251310
.long 0xfffffff0
.long PMD_TYPE_SECT | \
PMD_ S E C T _ B U F F E R A B L E | \
PMD_ S E C T _ C A C H E A B L E | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
.long PMD_TYPE_SECT | \
PMD_ B I T 4 | \
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
b _ _ f e r o c e o n _ s e t u p
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_ S W P | H W C A P _ H A L F | H W C A P _ T H U M B | H W C A P _ F A S T _ M U L T | H W C A P _ E D S P
.long cpu_88fr131_name
.long feroceon_processor_functions
.long v4wbi_tlb_fns
.long feroceon_user_fns
.long feroceon_range_cache_fns
.size _ _ 8 8 fr1 3 1 _ p r o c _ i n f o , . - _ _ 8 8 f r13 1 _ p r o c _ i n f o