@ -27,15 +27,20 @@
* /
# include < c o n f i g . h >
# include < v e r s i o n . h >
# include < a s m / a r c h / h a r d w a r e . h >
# include < a s m / a r c h / a t 9 1 _ p m c . h >
# include < a s m / a r c h / a t 9 1 _ p i o . h >
# include < a s m / a r c h / a t 9 1 _ r s t c . h >
# include < a s m / a r c h / a t 9 1 _ w d t . h >
# include < a s m / a r c h / a t 9 1 s a m 9 _ m a t r i x . h >
# include < a s m / a r c h / a t 9 1 _ p i o . h >
# include < a s m / a r c h / a t 9 1 _ m a t r i x . h >
# include < a s m / a r c h / a t 9 1 s a m 9 _ s d r a m c . h >
# include < a s m / a r c h / a t 9 1 s a m 9 _ s m c . h >
# include < a s m / a r c h / a t 9 1 _ r s t c . h >
# ifdef C O N F I G _ A T 9 1 _ L E G A C Y
# include < a s m / a r c h / a t 9 1 s a m 9 _ m a t r i x . h >
# endif
# ifndef C O N F I G _ S Y S _ M A T R I X _ E B I C S A _ V A L
# define C O N F I G _ S Y S _ M A T R I X _ E B I C S A _ V A L C O N F I G _ S Y S _ M A T R I X _ E B I 0 C S A _ V A L
# endif
_TEXT_BASE :
.word TEXT_BASE
@ -75,7 +80,7 @@ POS1:
* - Check i f t h e P L L i s a l r e a d y i n i t i a l i z e d
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
ldr r1 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ P M C _ M C K R )
ldr r1 , = ( A T 9 1 _ A S M _ P M C _ M C K R )
ldr r0 , [ r1 ]
and r0 , r0 , #3
cmp r0 , #0
@ -85,18 +90,18 @@ POS1:
* - Enable t h e M a i n O s c i l l a t o r
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
ldr r1 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ C K G R _ M O R )
ldr r2 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ P M C _ S R )
ldr r1 , = ( A T 9 1 _ A S M _ P M C _ M O R )
ldr r2 , = ( A T 9 1 _ A S M _ P M C _ S R )
/* Main oscillator Enable register PMC_MOR: */
ldr r0 , =CONFIG_SYS_MOR_VAL
str r0 , [ r1 ]
/* Reading the PMC Status to detect when the Main Oscillator is enabled */
mov r4 , #A T 91 _ P M C _ M O S C S
mov r4 , #A T 91 _ P M C _ I X R _ M O S C S
MOSCS_Loop :
ldr r3 , [ r2 ]
and r3 , r4 , r3
cmp r3 , #A T 91 _ P M C _ M O S C S
cmp r3 , #A T 91 _ P M C _ I X R _ M O S C S
bne M O S C S _ L o o p
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -105,16 +110,16 @@ MOSCS_Loop:
* Setup P L L A
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
ldr r1 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ C K G R _ P L L A R )
ldr r1 , = ( A T 9 1 _ A S M _ P M C _ P L L A R )
ldr r0 , =CONFIG_SYS_PLLAR_VAL
str r0 , [ r1 ]
/* Reading the PMC Status register to detect when the PLLA is locked */
mov r4 , #A T 91 _ P M C _ L O C K A
mov r4 , #A T 91 _ P M C _ I X R _ L O C K A
MOSCS_Loop1 :
ldr r3 , [ r2 ]
and r3 , r4 , r3
cmp r3 , #A T 91 _ P M C _ L O C K A
cmp r3 , #A T 91 _ P M C _ I X R _ L O C K A
bne M O S C S _ L o o p1
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -123,38 +128,37 @@ MOSCS_Loop1:
* - Switch o n t h e M a i n O s c i l l a t o r
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
ldr r1 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ P M C _ M C K R )
ldr r1 , = ( A T 9 1 _ A S M _ P M C _ M C K R )
/* -Master Clock Controller register PMC_MCKR */
ldr r0 , =CONFIG_SYS_MCKR1_VAL
str r0 , [ r1 ]
/* Reading the PMC Status to detect when the Master clock is ready */
mov r4 , #A T 91 _ P M C _ M C K R D Y
mov r4 , #A T 91 _ P M C _ I X R _ M C K R D Y
MCKRDY_Loop :
ldr r3 , [ r2 ]
and r3 , r4 , r3
cmp r3 , #A T 91 _ P M C _ M C K R D Y
cmp r3 , #A T 91 _ P M C _ I X R _ M C K R D Y
bne M C K R D Y _ L o o p
ldr r0 , =CONFIG_SYS_MCKR2_VAL
str r0 , [ r1 ]
/* Reading the PMC Status to detect when the Master clock is ready */
mov r4 , #A T 91 _ P M C _ M C K R D Y
mov r4 , #A T 91 _ P M C _ I X R _ M C K R D Y
MCKRDY_Loop1 :
ldr r3 , [ r2 ]
and r3 , r4 , r3
cmp r3 , #A T 91 _ P M C _ M C K R D Y
cmp r3 , #A T 91 _ P M C _ I X R _ M C K R D Y
bne M C K R D Y _ L o o p1
PLL_setup_end :
/ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* - memory c o n t r o l c o n f i g u r a t i o n 2
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* /
ldr r0 , = ( A T 9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ T R )
ldr r0 , = ( A T 9 1 _ A S M _ S D R A M C _ T R )
ldr r1 , [ r0 ]
cmp r1 , #0
bne S D R A M _ s e t u p _ e n d
@ -166,7 +170,6 @@ PLL_setup_end:
sub r2 , r2 , r1
add r0 , r0 , r5
add r2 , r2 , r5
2 :
/* the address */
ldr r1 , [ r0 ] , #4
@ -183,60 +186,53 @@ SDRAM_setup_end:
.ltorg
SMRDATA :
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ W D T _ M R )
.word AT91_ASM_WDT_MR
.word CONFIG_SYS_WDTC_WDMR_VAL
/* configure PIOx as EBI0 D[16-31] */
# if d e f i n e d ( C O N F I G _ A T 9 1 S A M 9 2 6 3 )
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ P I O D + P I O _ P D R )
.word AT91_ASM_PIOD_PDR
.word CONFIG_SYS_PIOD_PDR_VAL1
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ P I O D + P I O _ P U D R )
.word AT91_ASM_PIOD_PUDR
.word CONFIG_SYS_PIOD_PPUDR_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ P I O D + P I O _ A S R )
.word AT91_ASM_PIOD_ASR
.word CONFIG_SYS_PIOD_PPUDR_VAL
# elif d e f i n e d ( C O N F I G _ A T 9 1 S A M 9 2 6 0 ) | | d e f i n e d ( C O N F I G _ A T 9 1 S A M 9 2 6 1 ) \
| | defined( C O N F I G _ A T 9 1 S A M 9 G 2 0 )
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ P I O C + P I O _ P D R )
.word AT91_ASM_PIOC_PDR
.word CONFIG_SYS_PIOC_PDR_VAL1
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ P I O C + P I O _ P U D R )
.word AT91_ASM_PIOC_PUDR
.word CONFIG_SYS_PIOC_PPUDR_VAL
# endif
# if d e f i n e d ( A T 9 1 _ M A T R I X _ E B I 0 C S A )
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ M A T R I X _ E B I 0 C S A )
.word CONFIG_SYS_MATRIX_EBI0CSA_VAL
# else / * A T 9 1 _ M A T R I X _ E B I C S A * /
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ M A T R I X _ E B I C S A )
.word AT91_ASM_MATRIX_CSA0
.word CONFIG_SYS_MATRIX_EBICSA_VAL
# endif
/* flash */
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S M C _ M O D E ( 0 ) )
.word AT91_ASM_SMC_MODE0
.word CONFIG_SYS_SMC0_MODE0_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S M C _ C Y C L E ( 0 ) )
.word AT91_ASM_SMC_CYCLE0
.word CONFIG_SYS_SMC0_CYCLE0_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S M C _ P U L S E ( 0 ) )
.word AT91_ASM_SMC_PULSE0
.word CONFIG_SYS_SMC0_PULSE0_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S M C _ S E T U P ( 0 ) )
.word AT91_ASM_SMC_SETUP0
.word CONFIG_SYS_SMC0_SETUP0_VAL
SMRDATA1 :
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M R )
.word AT91_ASM_SDRAMC_MR
.word CONFIG_SYS_SDRC_MR_VAL1
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ T R )
.word AT91_ASM_SDRAMC_TR
.word CONFIG_SYS_SDRC_TR_VAL1
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ C R )
.word AT91_ASM_SDRAMC_CR
.word CONFIG_SYS_SDRC_CR_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M D R )
.word AT91_ASM_SDRAMC_MDR
.word CONFIG_SYS_SDRC_MDR_VAL
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M R )
.word AT91_ASM_SDRAMC_MR
.word CONFIG_SYS_SDRC_MR_VAL2
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL1
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M R )
.word AT91_ASM_SDRAMC_MR
.word CONFIG_SYS_SDRC_MR_VAL3
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL2
@ -254,26 +250,25 @@ SMRDATA1:
.word CONFIG_SYS_SDRAM_VAL8
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL9
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M R )
.word AT91_ASM_SDRAMC_MR
.word CONFIG_SYS_SDRC_MR_VAL4
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL10
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ M R )
.word AT91_ASM_SDRAMC_MR
.word CONFIG_SYS_SDRC_MR_VAL5
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL11
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ S D R A M C _ T R )
.word AT91_ASM_SDRAMC_TR
.word CONFIG_SYS_SDRC_TR_VAL2
.word AT91_SDRAM_BASE
.word CONFIG_SYS_SDRAM_VAL12
/* User reset enable*/
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ R S T C _ M R )
.word AT91_ASM_RSTC_MR
.word CONFIG_SYS_RSTC_RMR_VAL
# ifdef C O N F I G _ S Y S _ M A T R I X _ M C F G _ R E M A P
/* MATRIX_MCFG - REMAP all masters */
.word ( AT9 1 _ B A S E _ S Y S + A T 9 1 _ M A T R I X _ M C F G 0 )
.word AT91_ASM_MATRIX_MCFG
.word 0x1FF
# endif
SMRDATA2 :
.word 0