2010-12-01 07:45:00 +01:00
/ *
* The h e a d - f i l e f o r S H - M o b i l e A R M p l a t f o r m s
*
* Kuninori M o r i m o t o < k u n i n o r i . m o r i m o t o . g x @renesas.com>
* Simon H o r m a n < h o r m s @verge.net.au>
*
* 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 ; version 2 of the License.
*
* 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 1 F r a n k l i n 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
* /
# ifdef C O N F I G _ Z B O O T _ R O M
.section " .start " , " ax"
/* load board-specific initialization code */
# include < m a c h / z b o o t . h >
2011-04-26 06:29:53 +01:00
# if d e f i n e d ( C O N F I G _ Z B O O T _ R O M _ M M C I F ) | | d e f i n e d ( C O N F I G _ Z B O O T _ R O M _ S H _ M O B I L E _ S D H I )
/* Load image from MMC/SD */
adr s p , _ _ t m p _ s t a c k + 2 5 6
2011-01-11 04:01:08 +01:00
ldr r0 , _ _ i m a g e _ s t a r t
ldr r1 , _ _ i m a g e _ e n d
subs r1 , r1 , r0
ldr r0 , _ _ l o a d _ b a s e
2011-04-26 06:29:53 +01:00
bl m m c _ l o a d e r
2011-01-11 04:01:08 +01:00
/* Jump to loaded code */
ldr r0 , _ _ l o a d e d
ldr r1 , _ _ i m a g e _ s t a r t
sub r0 , r0 , r1
ldr r1 , _ _ l o a d _ b a s e
add p c , r0 , r1
__image_start :
.long _start
__image_end :
.long _got_end
__load_base :
2013-06-05 16:55:31 +09:00
.long MEMORY_START + 0 x0 2 0 0 0 0 0 0 @ Load at 32Mb into SDRAM
2011-01-11 04:01:08 +01:00
__loaded :
.long __continue
.align
__tmp_stack :
2011-04-26 06:29:53 +01:00
.space 256
2011-01-11 04:01:08 +01:00
__continue :
2011-04-26 06:29:53 +01:00
# endif / * C O N F I G _ Z B O O T _ R O M _ M M C | | C O N F I G _ Z B O O T _ R O M _ S H _ M O B I L E _ S D H I * /
2011-01-11 04:01:08 +01:00
2013-06-27 08:48:07 +09:00
adr r0 , d t b _ i n f o
ldmia r0 , { r1 , r3 , r4 , r5 , r7 }
sub r0 , r0 , r1 @ calculate the delta offset
add r5 , r5 , r0 @ _edata
ldr l r , [ r5 , #0 ] @ check if valid DTB is present
cmp l r , r3
bne 0 f
add r9 , r7 , #31 @ rounded up to a multiple
bic r9 , r9 , #31 @ ... of 32 bytes
add r6 , r9 , r5 @ copy from _edata
add r9 , r9 , r4 @ to MEMORY_START
1 : ldmdb r6 ! , { r0 - r3 , r10 - r12 , l r }
cmp r6 , r5
stmdb r9 ! , { r0 - r3 , r10 - r12 , l r }
bhi 1 b
/* Success: Zero board ID, pointer to start of memory for atag/dtb */
mov r7 , #0
mov r8 , r4
2010-12-01 07:45:00 +01:00
b 2 f
2013-06-27 08:48:07 +09:00
.align 2
dtb_info :
.word dtb_info
# ifndef _ _ A R M E B _ _
.word 0xedfe0dd0 @ sig is 0xd00dfeed big endian
# else
.word 0xd00dfeed
# endif
.word MEMORY_START
.word _edata
.word 0x4000 @ maximum DTB size
0 :
/* Failure: Zero board ID, NULL atag/dtb */
mov r7 , #0
mov r8 , #0 @ pass null pointer as atag
2010-12-01 07:45:00 +01:00
2 :
# endif / * C O N F I G _ Z B O O T _ R O M * /