2006-09-26 12:37:50 +04:00
/ *
* linux/ a r c h / a r m / m m / a r m 7 4 0 . S : u t i l i t y f u n c t i o n s f o r A R M 7 4 0
*
* Copyright ( C ) 2 0 0 4 - 2 0 0 6 H y o k S . C h o i ( h y o k . c h o i @samsung.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 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 .
*
* /
# 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 >
# include < a s m / a s m - o f f s e t s . h >
2008-09-07 22:15:31 +04:00
# include < a s m / h w c a p . h >
2006-09-26 12:37:50 +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 t r a c e . h >
2011-06-23 20:19:11 +04:00
# include " p r o c - m a c r o s . S "
2006-09-26 12:37:50 +04:00
.text
/ *
* cpu_ a r m 7 4 0 _ p r o c _ i n i t ( )
* cpu_ a r m 7 4 0 _ d o _ i d l e ( )
* cpu_ a r m 7 4 0 _ d c a c h e _ c l e a n _ a r e a ( )
* cpu_ a r m 7 4 0 _ s w i t c h _ m m ( )
*
* These a r e n o t r e q u i r e d .
* /
ENTRY( c p u _ a r m 7 4 0 _ p r o c _ i n i t )
ENTRY( c p u _ a r m 7 4 0 _ d o _ i d l e )
ENTRY( c p u _ a r m 7 4 0 _ d c a c h e _ c l e a n _ a r e a )
ENTRY( c p u _ a r m 7 4 0 _ s w i t c h _ m m )
2014-06-30 19:29:12 +04:00
ret l r
2006-09-26 12:37:50 +04:00
/ *
* cpu_ a r m 7 4 0 _ p r o c _ f i n ( )
* /
ENTRY( c p u _ a r m 7 4 0 _ p r o c _ f i n )
mrc p15 , 0 , r0 , c1 , c0 , 0
bic r0 , r0 , #0x3f000000 @ bank/f/lock/s
bic r0 , r0 , #0x0000000c @ w-buffer/cache
mcr p15 , 0 , r0 , c1 , c0 , 0 @ disable caches
2014-06-30 19:29:12 +04:00
ret l r
2006-09-26 12:37:50 +04:00
/ *
* cpu_ a r m 7 4 0 _ r e s e t ( l o c )
* Params : r0 = a d d r e s s t o j u m p t o
* Notes : T h i s s e t s u p e v e r y t h i n g f o r a r e s e t
* /
2011-11-15 17:25:04 +04:00
.pushsection .idmap .text , " ax"
2006-09-26 12:37:50 +04:00
ENTRY( c p u _ a r m 7 4 0 _ r e s e t )
mov i p , #0
mcr p15 , 0 , i p , c7 , c0 , 0 @ invalidate cache
mrc p15 , 0 , i p , c1 , c0 , 0 @ get ctrl register
bic i p , i p , #0x0000000c @ ............wc..
mcr p15 , 0 , i p , c1 , c0 , 0 @ ctrl register
2014-06-30 19:29:12 +04:00
ret r0
2011-11-15 17:25:04 +04:00
ENDPROC( c p u _ a r m 7 4 0 _ r e s e t )
.popsection
2006-09-26 12:37:50 +04:00
.type _ _ arm7 4 0 _ s e t u p , #f u n c t i o n
__arm740_setup :
mov r0 , #0
mcr p15 , 0 , r0 , c7 , c0 , 0 @ invalidate caches
mcr p15 , 0 , r0 , c6 , c3 @ disable area 3~7
mcr p15 , 0 , r0 , c6 , c4
mcr p15 , 0 , r0 , c6 , c5
mcr p15 , 0 , r0 , c6 , c6
mcr p15 , 0 , r0 , c6 , c7
mov r0 , #0x0000003F @ base = 0, size = 4GB
mcr p15 , 0 , r0 , c6 , c0 @ set area 0, default
ldr r0 , = ( C O N F I G _ D R A M _ B A S E & 0 x F F F F F 0 0 0 ) @ base[31:12] of RAM
2013-01-22 14:37:51 +04:00
ldr r3 , = ( C O N F I G _ D R A M _ S I Z E > > 1 2 ) @ size of RAM (must be >= 4KB)
mov r4 , #10 @ 11 is the minimum (4KB)
1 : add r4 , r4 , #1 @ area size *= 2
movs r3 , r3 , l s r #1
2006-09-26 12:37:50 +04:00
bne 1 b @ count not zero r-shift
2013-01-22 14:37:51 +04:00
orr r0 , r0 , r4 , l s l #1 @ the area register value
2006-09-26 12:37:50 +04:00
orr r0 , r0 , #1 @ set enable bit
mcr p15 , 0 , r0 , c6 , c1 @ set area 1, RAM
ldr r0 , = ( C O N F I G _ F L A S H _ M E M _ B A S E & 0 x F F F F F 0 0 0 ) @ base[31:12] of FLASH
2013-01-22 14:37:51 +04:00
ldr r3 , = ( C O N F I G _ F L A S H _ S I Z E > > 1 2 ) @ size of FLASH (must be >= 4KB)
cmp r3 , #0
moveq r0 , #0
beq 2 f
mov r4 , #10 @ 11 is the minimum (4KB)
1 : add r4 , r4 , #1 @ area size *= 2
movs r3 , r3 , l s r #1
2006-09-26 12:37:50 +04:00
bne 1 b @ count not zero r-shift
2013-01-22 14:37:51 +04:00
orr r0 , r0 , r4 , l s l #1 @ the area register value
2006-09-26 12:37:50 +04:00
orr r0 , r0 , #1 @ set enable bit
2013-01-22 14:37:51 +04:00
2 : mcr p15 , 0 , r0 , c6 , c2 @ set area 2, ROM/FLASH
2006-09-26 12:37:50 +04:00
mov r0 , #0x06
mcr p15 , 0 , r0 , c2 , c0 @ Region 1&2 cacheable
# ifdef C O N F I G _ C P U _ D C A C H E _ W R I T E T H R O U G H
mov r0 , #0x00 @ disable whole write buffer
# else
mov r0 , #0x02 @ Region 1 write bufferred
# endif
mcr p15 , 0 , r0 , c3 , c0
mov r0 , #0x10000
sub r0 , r0 , #1 @ r0 = 0xffff
mcr p15 , 0 , r0 , c5 , c0 @ all read/write access
mrc p15 , 0 , r0 , c1 , c0 @ get control register
bic r0 , r0 , #0x3F000000 @ set to standard caching mode
@ need some benchmark
orr r0 , r0 , #0x0000000d @ MPU/Cache/WB
2014-06-30 19:29:12 +04:00
ret l r
2006-09-26 12:37:50 +04:00
.size _ _ arm7 4 0 _ s e t u p , . - _ _ a r m 7 4 0 _ s e t u p
_ _ INITDATA
2011-06-23 20:19:11 +04: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 a r m 7 4 0 , d a b o r t =v4t_late_abort , p a b o r t =legacy_pabort , n o m m u =1
2006-09-26 12:37:50 +04:00
.section " .rodata "
2011-06-23 20:19:11 +04:00
string c p u _ a r c h _ n a m e , " a r m v4 "
string c p u _ e l f _ n a m e , " v4 "
string c p u _ a r m 7 4 0 _ n a m e , " A R M 7 4 0 T "
2006-09-26 12:37:50 +04:00
.align
2015-03-18 09:29:32 +03:00
.section " .proc .info .init " , # alloc
2006-09-26 12:37:50 +04:00
.type _ _ arm7 4 0 _ p r o c _ i n f o ,#o b j e c t
__arm740_proc_info :
.long 0x41807400
.long 0xfffffff0
.long 0
2013-01-22 14:37:51 +04:00
.long 0
2015-03-18 09:29:32 +03:00
initfn _ _ a r m 7 4 0 _ s e t u p , _ _ a r m 7 4 0 _ p r o c _ i n f o
2006-09-26 12:37:50 +04:00
.long cpu_arch_name
.long cpu_elf_name
2013-01-22 14:37:51 +04:00
.long HWCAP_SWP | HWCAP_ H A L F | H W C A P _ T H U M B | H W C A P _ 2 6 B I T
2006-09-26 12:37:50 +04:00
.long cpu_arm740_name
.long arm740_processor_functions
.long 0
.long 0
2013-01-15 16:07:40 +04:00
.long v4_cache_fns @ cache model
2006-09-26 12:37:50 +04:00
.size _ _ arm7 4 0 _ p r o c _ i n f o , . - _ _ a r m 7 4 0 _ p r o c _ i n f o