2006-03-28 21:00:40 +01:00
/ *
* linux/ a r c h / a r m / m m / p r o c - x s c3 . S
*
* Original A u t h o r : M a t t h e w G i l b e r t
2006-12-19 21:48:15 +01:00
* Current M a i n t a i n e r : L e n n e r t B u y t e n h e k < b u y t e n h @wantstofly.org>
2006-03-28 21:00:40 +01:00
*
* Copyright 2 0 0 4 ( C ) I n t e l C o r p .
2007-02-05 00:55:27 +01:00
* Copyright 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 .
2006-03-28 21:00:40 +01:00
*
* 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 v e r s i o n 2 a s
* published b y 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 .
*
2007-02-05 00:55:27 +01:00
* MMU f u n c t i o n s f o r t h e I n t e l X S c a l e 3 C o r e ( X S C 3 ) . T h e X S C 3 c o r e i s
* an e x t e n s i o n t o I n t e l ' s o r i g i n a l X S c a l e c o r e t h a t a d d s t h e f o l l o w i n g
2006-03-28 21:00:40 +01:00
* features :
*
* - ARMv6 S u p e r s e c t i o n s
* - Low L o c a l i t y R e f e r e n c e p a g e s ( r e p l a c e s m i n i - c a c h e )
* - 3 6 - bit a d d r e s s i n g
* - L2 c a c h e
2007-02-05 00:55:27 +01:00
* - Cache c o h e r e n c y i f c h i p s e t s u p p o r t s i t
2006-03-28 21:00:40 +01:00
*
2007-02-05 00:55:27 +01:00
* Based o n o r i g i n a l X S c a l e c o d e b y N i c o l a s P i t r e .
2006-03-28 21:00:40 +01:00
* /
# 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 19:15:31 +01:00
# include < a s m / h w c a p . h >
2006-03-28 21:00:40 +01:00
# include < a s m / p g t a b l e . h >
2006-03-30 10:24:07 +01:00
# include < a s m / p g t a b l e - h w d e f . h >
2006-03-28 21:00:40 +01:00
# 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 f l u s h e d . I f t h e
* area i s l a r g e r t h a n t h i s , t h e n w e f l u s h t h e w h o l e c a c h e .
* /
# define M A X _ A R E A _ S I Z E 3 2 7 6 8
/ *
2007-02-05 00:55:27 +01:00
* The c a c h e l i n e s i z e o f t h e L 1 I , L 1 D a n d u n i f i e d L 2 c a c h e .
2006-03-28 21:00:40 +01:00
* /
# define C A C H E L I N E S I Z E 3 2
/ *
2007-02-05 00:55:27 +01:00
* The s i z e o f t h e L 1 D c a c h e .
2006-03-28 21:00:40 +01:00
* /
# define C A C H E S I Z E 3 2 7 6 8
/ *
2007-02-05 00:55:27 +01:00
* This m a c r o i s u s e d t o w a i t f o r a C P 1 5 w r i t e a n d i s n e e d e d w h e n w e
* have t o e n s u r e t h a t t h e l a s t o p e r a t i o n t o t h e c o p r o c e s s o r w a s
* completed b e f o r e c o n t i n u i n g w i t h o p e r a t i o n .
2006-03-28 21:00:40 +01:00
* /
.macro cpwait_ r e t , l r , r d
mrc p15 , 0 , \ r d , c2 , c0 , 0 @ arbitrary read of cp15
sub p c , \ l r , \ r d , L S R #32 @ wait for completion and
@ flush instruction pipeline
.endm
/ *
2007-02-05 00:55:27 +01:00
* This m a c r o c l e a n s a n d i n v a l i d a t e s t h e e n t i r e L 1 D c a c h e .
2006-03-28 21:00:40 +01:00
* /
.macro clean_d_cache rd, r s
mov \ r d , #0x1f00
orr \ r d , \ r d , #0x00e0
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , \ r d , c7 , c14 , 2 @ clean/invalidate L1 D line
2006-03-28 21:00:40 +01:00
adds \ r d , \ r d , #0x40000000
bcc 1 b
subs \ r d , \ r d , #0x20
bpl 1 b
.endm
.text
/ *
* cpu_ x s c3 _ p r o c _ i n i t ( )
*
* Nothing t o o e x c i t i n g a t t h e m o m e n t
* /
ENTRY( c p u _ x s c3 _ p r o c _ i n i t )
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/ *
* cpu_ x s c3 _ p r o c _ f i n ( )
* /
ENTRY( c p u _ x s c3 _ p r o c _ f i n )
mrc p15 , 0 , r0 , c1 , c0 , 0 @ ctrl register
bic r0 , r0 , #0x1800 @ ...IZ...........
bic r0 , r0 , #0x0006 @ .............CA.
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/ *
* cpu_ x s c3 _ 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
2011-11-15 13:25:04 +00:00
.pushsection .idmap .text , " ax"
2006-03-28 21:00:40 +01:00
ENTRY( c p u _ x s c3 _ r e s e t )
mov r1 , #P S R _ F _ B I T | P S R _ I _ B I T | S V C _ M O D E
msr c p s r _ c , r1 @ reset CPSR
mrc p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
bic r1 , r1 , #0x3900 @ ..VIZ..S........
2007-02-05 00:55:27 +01:00
bic r1 , r1 , #0x0086 @ ........B....CA.
2006-03-28 21:00:40 +01:00
mcr p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate L1 caches and BTB
2006-03-28 21:00:40 +01:00
bic r1 , r1 , #0x0001 @ ...............M
mcr p15 , 0 , r1 , c1 , c0 , 0 @ ctrl register
@ CAUTION: MMU turned off from this point. We count on the pipeline
@ already containing those two last instructions to survive.
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I and D TLBs
2014-06-30 16:29:12 +01:00
ret r0
2011-11-15 13:25:04 +00:00
ENDPROC( c p u _ x s c3 _ r e s e t )
.popsection
2006-03-28 21:00:40 +01:00
/ *
* cpu_ x s c3 _ d o _ i d l e ( )
*
* Cause t h e p r o c e s s o r t o i d l e
*
* For n o w w e d o n o t h i n g b u t g o t o i d l e m o d e f o r e v e r y c a s e
*
* XScale s u p p o r t s c l o c k s w i t c h i n g , b u t u s i n g i d l e m o d e s u p p o r t
* allows e x t e r n a l h a r d w a r e t o r e a c t t o s y s t e m s t a t e c h a n g e s .
* /
.align 5
ENTRY( c p u _ x s c3 _ d o _ i d l e )
mov r0 , #1
2007-02-05 00:55:27 +01:00
mcr p14 , 0 , r0 , c7 , c0 , 0 @ go to idle
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/* ================================= CACHE ================================ */
2010-10-28 11:27:40 +01: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( x s c3 _ 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
2014-06-30 16:29:12 +01:00
ret l r
2010-10-28 11:27:40 +01:00
ENDPROC( x s c3 _ f l u s h _ i c a c h e _ a l l )
2006-03-28 21:00:40 +01:00
/ *
* flush_ u s e r _ c a c h e _ a l l ( )
*
* Invalidate 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 a d d r e s s
* space.
* /
ENTRY( x s c3 _ 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( x s c3 _ 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
mov i p , #0
__flush_whole_cache :
clean_ d _ c a c h e r0 , r1
tst r2 , #V M _ E X E C
2007-02-05 00:55:27 +01:00
mcrne p15 , 0 , i p , c7 , c5 , 0 @ invalidate L1 I cache and BTB
mcrne p15 , 0 , i p , c7 , c10 , 4 @ data write barrier
mcrne p15 , 0 , i p , c7 , c5 , 4 @ prefetch flush
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/ *
* flush_ u s e r _ c a c h e _ r a n g e ( s t a r t , e n d , v m _ f l a g s )
*
* Invalidate 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 s p e c i f i e d
* address s p a c e .
*
* - start - s t a r t a d d r e s s ( m a y n o t b e a l i g n e d )
* - end - e n d a d d r e s s ( e x c l u s i v e , m a y n o t b e a l i g n e d )
* - vma - v m a _ a r e a _ s t r u c t d e s c r i b i n g a d d r e s s s p a c e
* /
.align 5
ENTRY( x s c3 _ f l u s h _ u s e r _ c a c h e _ r a n g e )
mov i p , #0
sub r3 , r1 , r0 @ calculate total size
cmp r3 , #M A X _ A R E A _ S I Z E
bhs _ _ f l u s h _ w h o l e _ c a c h e
1 : tst r2 , #V M _ E X E C
2007-02-05 00:55:27 +01:00
mcrne p15 , 0 , r0 , c7 , c5 , 1 @ invalidate L1 I line
mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean/invalidate L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
tst r2 , #V M _ E X E C
2007-02-05 00:55:27 +01:00
mcrne p15 , 0 , i p , c7 , c5 , 6 @ invalidate BTB
mcrne p15 , 0 , i p , c7 , c10 , 4 @ data write barrier
mcrne p15 , 0 , i p , c7 , c5 , 4 @ prefetch flush
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/ *
* coherent_ k e r n _ r a n g e ( s t a r t , e n d )
*
2007-02-05 00:55:27 +01:00
* 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
2006-03-28 21:00:40 +01:00
* region d e s c r i b e d b y s t a r t . 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
*
* Note : single I - c a c h e l i n e i n v a l i d a t i o n i s n ' t u s e d h e r e s i n c e
* it a l s o t r a s h e s t h e m i n i I - c a c h e u s e d b y J T A G d e b u g g e r s .
* /
ENTRY( x s c3 _ c o h e r e n t _ k e r n _ r a n g e )
/* FALLTHROUGH */
ENTRY( x s c3 _ 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 L I N E S I Z E - 1
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c7 , c5 , 0 @ invalidate L1 I cache and BTB
mcr p15 , 0 , r0 , c7 , c10 , 4 @ data write barrier
mcr p15 , 0 , r0 , c7 , c5 , 4 @ prefetch flush
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/ *
2009-11-26 12:56:21 +00: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 )
2006-03-28 21:00:40 +01: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
2007-02-05 00:55:27 +01:00
* the I c a c h e .
2006-03-28 21:00:40 +01:00
*
2009-11-26 12:56:21 +00: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
2006-03-28 21:00:40 +01:00
* /
2009-11-26 12:56:21 +00:00
ENTRY( x s c3 _ f l u s h _ k e r n _ d c a c h e _ a r e a )
add r1 , r0 , r1
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean/invalidate L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
mov r0 , #0
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c7 , c5 , 0 @ invalidate L1 I cache and BTB
mcr p15 , 0 , r0 , c7 , c10 , 4 @ data write barrier
mcr p15 , 0 , r0 , c7 , c5 , 4 @ prefetch flush
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01: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
* /
2009-11-26 16:24:19 +00:00
xsc3_dma_inv_range :
2006-03-28 21:00:40 +01:00
tst r0 , #C A C H E L I N E S I Z E - 1
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
2007-02-05 00:55:27 +01:00
mcrne p15 , 0 , r0 , c7 , c10 , 1 @ clean L1 D line
2006-03-28 21:00:40 +01:00
tst r1 , #C A C H E L I N E S I Z E - 1
2007-02-05 00:55:27 +01:00
mcrne p15 , 0 , r1 , c7 , c10 , 1 @ clean L1 D line
1 : mcr p15 , 0 , r0 , c7 , c6 , 1 @ invalidate L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ data write barrier
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01: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
* /
2009-11-26 16:24:19 +00:00
xsc3_dma_clean_range :
2006-03-28 21:00:40 +01:00
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ data write barrier
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01: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
* /
ENTRY( x s c3 _ d m a _ f l u s h _ r a n g e )
bic r0 , r0 , #C A C H E L I N E S I Z E - 1
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , r0 , c7 , c14 , 1 @ clean/invalidate L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
cmp r0 , r1
blo 1 b
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c7 , c10 , 4 @ data write barrier
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
2009-11-26 16:19:58 +00: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( x s c3 _ 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 x s c3 _ d m a _ c l e a n _ r a n g e
bcs x s c3 _ d m a _ i n v _ r a n g e
b x s c3 _ d m a _ f l u s h _ r a n g e
ENDPROC( x s c3 _ 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( x s c3 _ d m a _ u n m a p _ a r e a )
2014-06-30 16:29:12 +01:00
ret l r
2009-11-26 16:19:58 +00:00
ENDPROC( x s c3 _ d m a _ u n m a p _ a r e a )
2012-09-06 18:35:13 +05:30
.globl xsc3_flush_kern_cache_louis
.equ xsc3 _ f l u s h _ k e r n _ c a c h e _ l o u i s , x s c3 _ f l u s h _ k e r n _ c a c h e _ a l l
2011-06-23 17:26:38 +01:00
@ define struct cpu_cache_fns (see <asm/cacheflush.h> and proc-macros.S)
define_ c a c h e _ f u n c t i o n s x s c3
2006-03-28 21:00:40 +01:00
ENTRY( c p u _ x s c3 _ d c a c h e _ c l e a n _ a r e a )
2007-02-05 00:55:27 +01:00
1 : mcr p15 , 0 , r0 , c7 , c10 , 1 @ clean L1 D line
2006-03-28 21:00:40 +01:00
add r0 , r0 , #C A C H E L I N E S I Z E
subs r1 , r1 , #C A C H E L I N E S I Z E
bhi 1 b
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
/* =============================== PageTable ============================== */
/ *
* cpu_ x s c3 _ 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 _ x s c3 _ s w i t c h _ m m )
clean_ d _ c a c h e r1 , r2
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , i p , c7 , c5 , 0 @ invalidate L1 I cache and BTB
mcr p15 , 0 , i p , c7 , c10 , 4 @ data write barrier
mcr p15 , 0 , i p , c7 , c5 , 4 @ prefetch flush
2006-03-28 21:00:40 +01:00
orr r0 , r0 , #0x18 @ cache the page table in L2
mcr p15 , 0 , r0 , c2 , c0 , 0 @ load page table pointer
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I and D TLBs
2006-03-28 21:00:40 +01:00
cpwait_ r e t l r , i p
/ *
2006-12-13 14:34:43 +00:00
* cpu_ x s c3 _ s e t _ p t e _ e x t ( p t e p , p t e , e x t )
2006-03-28 21:00:40 +01:00
*
* Set a P T E a n d f l u s h i t o u t
* /
2008-09-06 20:47:54 +01:00
cpu_xsc3_mt_table :
.long 0x00 @ L_PTE_MT_UNCACHED
2008-09-07 12:36:46 +01:00
.long PTE_ E X T _ T E X ( 1 ) @ L_PTE_MT_BUFFERABLE
2008-10-24 10:21:45 -07:00
.long PTE_ E X T _ T E X ( 5 ) | P T E _ C A C H E A B L E @ L_PTE_MT_WRITETHROUGH
2008-09-07 12:36:46 +01:00
.long PTE_CACHEABLE | PTE_ B U F F E R A B L E @ L_PTE_MT_WRITEBACK
.long PTE_ E X T _ T E X ( 1 ) | P T E _ B U F F E R A B L E @ L_PTE_MT_DEV_SHARED
2008-09-06 21:07:45 +01:00
.long 0x00 @ unused
2008-09-06 20:47:54 +01:00
.long 0x00 @ L_PTE_MT_MINICACHE (not present)
.long PTE_ E X T _ T E X ( 5 ) | P T E _ C A C H E A B L E | P T E _ B U F F E R A B L E @ L_PTE_MT_WRITEALLOC (not present?)
2008-09-06 21:07:45 +01:00
.long 0x00 @ unused
2008-09-06 20:47:54 +01:00
.long PTE_ E X T _ T E X ( 1 ) @ L_PTE_MT_DEV_WC
.long 0x00 @ unused
2008-09-07 12:36:46 +01:00
.long PTE_CACHEABLE | PTE_ B U F F E R A B L E @ L_PTE_MT_DEV_CACHED
.long PTE_ E X T _ T E X ( 2 ) @ L_PTE_MT_DEV_NONSHARED
2008-09-07 12:42:51 +01:00
.long 0x00 @ unused
2008-09-06 20:47:54 +01:00
.long 0x00 @ unused
.long 0x00 @ unused
2006-03-28 21:00:40 +01:00
.align 5
2006-12-13 14:34:43 +00:00
ENTRY( c p u _ x s c3 _ s e t _ p t e _ e x t )
2008-09-06 17:19:08 +01:00
xscale_ s e t _ p t e _ e x t _ p r o l o g u e
2006-03-28 21:00:40 +01:00
2008-09-06 17:19:08 +01:00
tst r1 , #L _ P T E _ S H A R E D @ s h a r e d ?
2008-09-06 20:47:54 +01:00
and r1 , r1 , #L _ P T E _ M T _ M A S K
adr i p , c p u _ x s c3 _ m t _ t a b l e
ldr i p , [ i p , r1 ]
orrne r2 , r2 , #P T E _ E X T _ C O H E R E N T @ i n t e r l o c k : m a s k i n c o h e r e n t b i t
bic r2 , r2 , #0x0c @ clear old C,B bits
orr r2 , r2 , i p
2006-03-28 21:00:40 +01:00
2008-09-06 17:19:08 +01:00
xscale_ s e t _ p t e _ e x t _ e p i l o g u e
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
.ltorg
.align
2011-02-06 15:48:39 +00:00
.globl cpu_xsc3_suspend_size
2011-08-27 22:39:09 +01:00
.equ cpu_ x s c3 _ s u s p e n d _ s i z e , 4 * 6
2013-04-08 11:44:57 +01:00
# ifdef C O N F I G _ A R M _ C P U _ S U S P E N D
2011-02-06 15:48:39 +00:00
ENTRY( c p u _ x s c3 _ d o _ s u s p e n d )
2011-08-27 22:39:09 +01:00
stmfd s p ! , { r4 - r9 , l r }
2011-02-06 15:48:39 +00:00
mrc p14 , 0 , r4 , c6 , c0 , 0 @ clock configuration, for turbo mode
mrc p15 , 0 , r5 , c15 , c1 , 0 @ CP access reg
mrc p15 , 0 , r6 , c13 , c0 , 0 @ PID
mrc p15 , 0 , r7 , c3 , c0 , 0 @ domain ID
2011-08-27 22:39:09 +01:00
mrc p15 , 0 , r8 , c1 , c0 , 1 @ auxiliary control reg
mrc p15 , 0 , r9 , c1 , c0 , 0 @ control reg
2011-02-06 15:48:39 +00:00
bic r4 , r4 , #2 @ clear frequency change bit
2011-08-27 22:39:09 +01:00
stmia r0 , { r4 - r9 } @ store cp regs
ldmia s p ! , { r4 - r9 , p c }
2011-02-06 15:48:39 +00:00
ENDPROC( c p u _ x s c3 _ d o _ s u s p e n d )
ENTRY( c p u _ x s c3 _ d o _ r e s u m e )
2011-08-27 22:39:09 +01:00
ldmia r0 , { r4 - r9 } @ load cp regs
2011-02-06 15:48:39 +00:00
mov i p , #0
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate I & D caches, BTB
mcr p15 , 0 , i p , c7 , c10 , 4 @ drain write (&fill) buffer
mcr p15 , 0 , i p , c7 , c5 , 4 @ flush prefetch buffer
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I & D TLBs
mcr p14 , 0 , r4 , c6 , c0 , 0 @ clock configuration, turbo mode.
mcr p15 , 0 , r5 , c15 , c1 , 0 @ CP access reg
mcr p15 , 0 , r6 , c13 , c0 , 0 @ PID
mcr p15 , 0 , r7 , c3 , c0 , 0 @ domain ID
2011-08-27 22:39:09 +01:00
orr r1 , r1 , #0x18 @ cache the page table in L2
mcr p15 , 0 , r1 , c2 , c0 , 0 @ translation table base addr
mcr p15 , 0 , r8 , c1 , c0 , 1 @ auxiliary control reg
mov r0 , r9 @ control register
2011-02-06 15:48:39 +00:00
b c p u _ r e s u m e _ m m u
ENDPROC( c p u _ x s c3 _ d o _ r e s u m e )
# endif
2006-03-28 21:00:40 +01:00
.type _ _ xsc3 _ s e t u p , #f u n c t i o n
__xsc3_setup :
mov r0 , #P S R _ F _ B I T | P S R _ I _ B I T | S V C _ M O D E
msr c p s r _ c , r0
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , i p , c7 , c7 , 0 @ invalidate L1 caches and BTB
mcr p15 , 0 , i p , c7 , c10 , 4 @ data write barrier
mcr p15 , 0 , i p , c7 , c5 , 4 @ prefetch flush
mcr p15 , 0 , i p , c8 , c7 , 0 @ invalidate I and D TLBs
2006-03-28 21:00:40 +01:00
orr r4 , r4 , #0x18 @ cache the page table in L2
mcr p15 , 0 , r4 , c2 , c0 , 0 @ load page table pointer
2007-02-05 00:55:27 +01:00
2009-10-29 11:46:56 -07:00
mov r0 , #1 < < 6 @ cp6 access for early sched_clock
2007-02-05 00:55:27 +01:00
mcr p15 , 0 , r0 , c15 , c1 , 0 @ write CP access register
2006-03-28 21:00:40 +01:00
mrc p15 , 0 , r0 , c1 , c0 , 1 @ get auxiliary control reg
and r0 , r0 , #2 @ preserve bit P bit setting
orr r0 , r0 , #( 1 < < 1 0 ) @ enable L2 for LLR cache
mcr p15 , 0 , r0 , c1 , c0 , 1 @ set auxiliary control reg
2006-06-29 15:09:57 +01:00
adr r5 , x s c3 _ c r v a l
ldmia r5 , { r5 , r6 }
2009-12-30 10:02:57 -05:00
# ifdef C O N F I G _ C A C H E _ X S C 3 L 2
mrc p15 , 1 , r0 , c0 , c0 , 1 @ get L2 present information
ands r0 , r0 , #0xf8
orrne r6 , r6 , #( 1 < < 2 6 ) @ enable L2 if present
# endif
2006-03-28 21:00:40 +01:00
mrc p15 , 0 , r0 , c1 , c0 , 0 @ get control register
2007-02-05 00:55:27 +01:00
bic r0 , r0 , r5 @ ..V. ..R. .... ..A.
orr r0 , r0 , r6 @ ..VI Z..S .... .C.M (mmu)
@ ...I Z..S .... .... (uc)
2014-06-30 16:29:12 +01:00
ret l r
2006-03-28 21:00:40 +01:00
.size _ _ xsc3 _ s e t u p , . - _ _ x s c3 _ s e t u p
2006-06-29 15:09:57 +01:00
.type xsc3 _ c r v a l , #o b j e c t
xsc3_crval :
2007-02-05 00:55:27 +01:00
crval c l e a r =0x04002202 , m m u s e t =0x00003905 , u c s e t =0x00001900
2006-06-29 15:09:57 +01:00
2006-03-28 21:00:40 +01:00
_ _ INITDATA
2011-06-23 17:26:38 +01:00
@ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
define_ p r o c e s s o r _ f u n c t i o n s x s c3 , d a b o r t =v5t_early_abort , p a b o r t =legacy_pabort , s u s p e n d =1
2006-03-28 21:00:40 +01:00
.section " .rodata "
2011-06-23 17:26:38 +01:00
string c p u _ a r c h _ n a m e , " a r m v5 t e "
string c p u _ e l f _ n a m e , " v5 "
string c p u _ x s c3 _ n a m e , " X S c a l e - V 3 b a s e d p r o c e s s o r "
2006-03-28 21:00:40 +01:00
.align
2015-03-18 07:29:32 +01:00
.section " .proc .info .init " , # alloc
2006-03-28 21:00:40 +01:00
2011-06-23 17:26:38 +01:00
.macro xsc3_proc_info name : req, c p u _ v a l : r e q , c p u _ m a s k : r e q
.type _ _ \ name\ ( ) _ p r o c _ i n f o ,#o b j e c t
_ _ \ name\ ( ) _ p r o c _ i n f o :
.long \ cpu_ v a l
.long \ cpu_ m a s k
2006-06-29 18:24:21 +01:00
.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_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2007-02-05 00:55:27 +01:00
.long PMD_TYPE_SECT | \
2006-06-29 18:24:21 +01:00
PMD_ S E C T _ A P _ W R I T E | \
PMD_ S E C T _ A P _ R E A D
2015-03-18 07:29:32 +01:00
initfn _ _ x s c3 _ s e t u p , _ _ \ n a m e \ ( ) _ p r o c _ i n f o
2006-03-28 21:00:40 +01:00
.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_xsc3_name
.long xsc3_processor_functions
.long v4wbi_tlb_fns
.long xsc3_mc_user_fns
.long xsc3_cache_fns
2011-06-23 17:26:38 +01:00
.size _ _ \ name\ ( ) _ p r o c _ i n f o , . - _ _ \ n a m e \ ( ) _ p r o c _ i n f o
.endm
2008-11-29 21:42:39 +08:00
2011-06-23 17:26:38 +01:00
xsc3 _ p r o c _ i n f o x s c3 , 0 x69 0 5 6 0 0 0 , 0 x f f f f e 0 0 0
2008-11-29 21:42:39 +08:00
2011-06-23 17:26:38 +01:00
/* Note: PXA935 changed its implementor ID from Intel to Marvell */
xsc3 _ p r o c _ i n f o x s c3 _ p x a93 5 , 0 x56 0 5 6 0 0 0 , 0 x f f f f e 0 0 0