2018-05-04 21:05:35 +02:00
/ * SPDX- L i c e n s e - I d e n t i f i e r : G P L - 2 . 0
*
* Copyright ( c ) 2 0 1 8 C h e n - Y u T s a i
* Copyright ( c ) 2 0 1 8 B o o t l i n
*
* Chen- Y u T s a i < w e n s @csie.org>
* Mylè n e J o s s e r a n d < m y l e n e . j o s s e r a n d @bootlin.com>
*
* SMP s u p p o r t f o r s u n x i b a s e d s y s t e m s w i t h C o r t e x A 7 / A 1 5
*
* /
# 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 >
# include < a s m / c p u t y p e . h >
ENTRY( s u n x i _ m c _ s m p _ c l u s t e r _ c a c h e _ e n a b l e )
.arch armv7 - a
/ *
* Enable c l u s t e r - l e v e l c o h e r e n c y , i n p r e p a r a t i o n f o r t u r n i n g o n t h e M M U .
*
* Also e n a b l e r e g i o n a l c l o c k g a t i n g a n d L 2 d a t a l a t e n c y s e t t i n g s f o r
* Cortex- A 1 5 . T h e s e s e t t i n g s a r e f r o m t h e v e n d o r k e r n e l .
* /
mrc p15 , 0 , r1 , c0 , c0 , 0
movw r2 , #( A R M _ C P U _ P A R T _ M A S K & 0xffff )
movt r2 , #( A R M _ C P U _ P A R T _ M A S K > > 16 )
and r1 , r1 , r2
movw r2 , #( A R M _ C P U _ P A R T _ C O R T E X _ A 15 & 0 x f f f f )
movt r2 , #( A R M _ C P U _ P A R T _ C O R T E X _ A 15 > > 1 6 )
cmp r1 , r2
bne n o t _ a15
/* The following is Cortex-A15 specific */
/* ACTLR2: Enable CPU regional clock gates */
mrc p15 , 1 , r1 , c15 , c0 , 4
orr r1 , r1 , #( 0x1 < < 3 1 )
mcr p15 , 1 , r1 , c15 , c0 , 4
/* L2ACTLR */
mrc p15 , 1 , r1 , c15 , c0 , 0
/* Enable L2, GIC, and Timer regional clock gates */
orr r1 , r1 , #( 0x1 < < 2 6 )
/* Disable clean/evict from being pushed to external */
orr r1 , r1 , #( 0x1 < < 3 )
mcr p15 , 1 , r1 , c15 , c0 , 0
/* L2CTRL: L2 data RAM latency */
mrc p15 , 1 , r1 , c9 , c0 , 2
bic r1 , r1 , #( 0x7 < < 0 )
orr r1 , r1 , #( 0x3 < < 0 )
mcr p15 , 1 , r1 , c9 , c0 , 2
/* End of Cortex-A15 specific setup */
not_a15 :
/* Get value of sunxi_mc_smp_first_comer */
adr r1 , f i r s t
ldr r0 , [ r1 ]
ldr r0 , [ r1 , r0 ]
/* Skip cci_enable_port_for_self if not first comer */
cmp r0 , #0
bxeq l r
b c c i _ e n a b l e _ p o r t _ f o r _ s e l f
.align 2
first : .word s u n x i _ m c _ s m p _ f i r s t _ c o m e r - .
ENDPROC( s u n x i _ m c _ s m p _ c l u s t e r _ c a c h e _ e n a b l e )
ENTRY( s u n x i _ m c _ s m p _ s e c o n d a r y _ s t a r t u p )
bl s u n x i _ m c _ s m p _ c l u s t e r _ c a c h e _ e n a b l e
2018-05-04 21:05:40 +02:00
bl s e c u r e _ c n t v o f f _ i n i t
2018-05-04 21:05:35 +02:00
b s e c o n d a r y _ s t a r t u p
ENDPROC( s u n x i _ m c _ s m p _ s e c o n d a r y _ s t a r t u p )
ENTRY( s u n x i _ m c _ s m p _ r e s u m e )
bl s u n x i _ m c _ s m p _ c l u s t e r _ c a c h e _ e n a b l e
b c p u _ r e s u m e
ENDPROC( s u n x i _ m c _ s m p _ r e s u m e )