@ -42,6 +42,27 @@
bcs 1 b
.endm
.macro SETUP_RAM cfg, c t l
/* B8xxxxxx - NAND, 8xxxxxxx - CSD0 RAM */
REG 0 x B 8 0 0 1 0 1 0 , 0 x00 0 0 0 0 0 4
ldr r3 , = \ c f g
ldr r2 , =WEIM_ESDCFG0
str r3 , [ r2 ]
REG 0 x B 8 0 0 1 0 0 0 , 0 x92 1 0 0 0 0 0
REG 0 x80 0 0 0 f00 , 0 x12 3 4 4 3 2 1
REG 0 x B 8 0 0 1 0 0 0 , 0 x a21 0 0 0 0 0
REG 0 x80 0 0 0 0 0 0 , 0 x12 3 4 4 3 2 1
REG 0 x80 0 0 0 0 0 0 , 0 x12 3 4 4 3 2 1
REG 0 x B 8 0 0 1 0 0 0 , 0 x b21 0 0 0 0 0
REG8 0 x80 0 0 0 0 3 3 , 0 x d a
REG8 0 x81 0 0 0 0 0 0 , 0 x f f
ldr r3 , = \ c t l
ldr r2 , =WEIM_ESDCTL0
str r3 , [ r2 ]
REG 0 x80 0 0 0 0 0 0 , 0 x D E A D B E E F
REG 0 x B 8 0 0 1 0 1 0 , 0 x00 0 0 0 0 0 c
.endm
/* RedBoot: To support 133MHz DDR */
.macro init_drive_strength
/ *
@ -130,43 +151,86 @@ lowlevel_init:
/* Default: 1, 4, 12, 1 */
REG C C M _ S P C T L , P L L _ P D ( 1 ) | P L L _ M F D ( 4 ) | P L L _ M F I ( 1 2 ) | P L L _ M F N ( 1 )
/* B8xxxxxx - NAND, 8xxxxxxx - CSD0 RAM */
REG 0 x B 8 0 0 1 0 1 0 , 0 x00 0 0 0 0 0 4
REG 0 x B 8 0 0 1 0 0 4 , ( ( 3 < < 2 1 ) | / * t X P * / \
( 0 < < 2 0 ) | /* tWTR */ \
( 2 < < 1 8 ) | /* tRP */ \
( 1 < < 1 6 ) | /* tMRD */ \
( 0 < < 1 5 ) | /* tWR */ \
( 5 < < 1 2 ) | /* tRAS */ \
( 1 < < 1 0 ) | /* tRRD */ \
( 3 < < 8 ) | /* tCAS */ \
( 2 < < 4 ) | /* tRCD */ \
( 7 < < 0 ) /* tRC */ )
REG 0 x B 8 0 0 1 0 0 0 , 0 x92 1 0 0 0 0 0
REG 0 x80 0 0 0 f00 , 0 x12 3 4 4 3 2 1
REG 0 x B 8 0 0 1 0 0 0 , 0 x a21 0 0 0 0 0
REG 0 x80 0 0 0 0 0 0 , 0 x12 3 4 4 3 2 1
REG 0 x80 0 0 0 0 0 0 , 0 x12 3 4 4 3 2 1
REG 0 x B 8 0 0 1 0 0 0 , 0 x b21 0 0 0 0 0
REG8 0 x80 0 0 0 0 3 3 , 0 x d a
REG8 0 x81 0 0 0 0 0 0 , 0 x f f
REG 0 x B 8 0 0 1 0 0 0 , ( ( 1 < < 3 1 ) | \
( 0 < < 2 8 ) | \
( 0 < < 2 7 ) | \
( 3 < < 2 4 ) | /* 14 rows */ \
( 2 < < 2 0 ) | /* 10 cols */ \
( 2 < < 1 6 ) | \
( 4 < < 1 3 ) | /* 3.91us (64ms/16384) */ \
( 0 < < 1 0 ) | \
( 0 < < 8 ) | \
( 1 < < 7 ) | \
( 0 < < 0 ) )
REG 0 x80 0 0 0 0 0 0 , 0 x D E A D B E E F
REG 0 x B 8 0 0 1 0 1 0 , 0 x00 0 0 0 0 0 c
check_ddr_module :
/* Set stackpointer in internal RAM to call get_ram_size */
ldr s p , = ( I R A M _ B A S E _ A D D R + I R A M _ S I Z E - 1 6 )
stmfd s p ! , { r0 - r11 , i p , l r }
mov i p , l r / * s a v e l i n k r e g a c r o s s c a l l * /
ldr r0 ,=0x08000000
SETUP_ R A M E S D C F G 0 _ 2 5 6 M B , E S D C T L 0 _ 2 5 6 M B
ldr r0 ,=0x80000000
ldr r1 ,=0x10000000
bl g e t _ r a m _ s i z e
ldr r1 ,=0x10000000
cmp r0 ,r1
beq r e s t o r e _ r e g s
SETUP_ R A M E S D C F G 0 _ 1 2 8 M B , E S D C T L 0 _ 1 2 8 M B
ldr r0 ,=0x80000000
ldr r1 ,=0x08000000
bl g e t _ r a m _ s i z e
ldr r1 ,=0x08000000
cmp r0 ,r1
beq r e s t o r e _ r e g s
restore_regs :
ldmfd s p ! , { r0 - r11 , i p , l r }
mov l r , i p / * r e s t o r e l i n k r e g * /
mov p c , l r
MPCTL_PARAM_399 :
.word ( ( ( 1 - 1 ) < < 2 6 ) + ( ( 5 2 - 1 ) < < 1 6 ) + ( 7 < < 1 0 ) + ( 3 5 < < 0 ) )
UPCTL_PARAM_240 :
.word ( ( ( 2 - 1 ) < < 2 6 ) + ( ( 1 3 - 1 ) < < 1 6 ) + ( 9 < < 1 0 ) + ( 3 < < 0 ) )
.equ ESDCFG0 _ 1 2 8 M B , \
( 0 < < 2 1 ) + /* tXP */ \
( 1 < < 2 0 ) + /* tWTR */ \
( 2 < < 1 8 ) + /* tRP */ \
( 1 < < 1 6 ) + /* tMRD */ \
( 0 < < 1 5 ) + /* tWR */ \
( 5 < < 1 2 ) + /* tRAS */ \
( 1 < < 1 0 ) + /* tRRD */ \
( 3 < < 8 ) + /* tCAS */ \
( 2 < < 4 ) + /* tRCD */ \
( 0 x0 F < < 0 ) / * t R C * /
.equ ESDCTL0 _ 1 2 8 M B , \
( 1 < < 3 1 ) + /* enable */ \
( 0 < < 2 8 ) + /* mode */ \
( 0 < < 2 7 ) + /* supervisor protect */ \
( 2 < < 2 4 ) + /* 13 rows */ \
( 2 < < 2 0 ) + /* 10 cols */ \
( 2 < < 1 6 ) + /* 32 bit */ \
( 3 < < 1 3 ) + /* 7.81us (64ms/8192) */ \
( 0 < < 1 0 ) + /* power down timer */ \
( 0 < < 8 ) + /* full page */ \
( 1 < < 7 ) + /* burst length */ \
( 0 < < 0 ) /* precharge timer */
.equ ESDCFG0 _ 2 5 6 M B , \
( 3 < < 2 1 ) + /* tXP */ \
( 0 < < 2 0 ) + /* tWTR */ \
( 2 < < 1 8 ) + /* tRP */ \
( 1 < < 1 6 ) + /* tMRD */ \
( 0 < < 1 5 ) + /* tWR */ \
( 5 < < 1 2 ) + /* tRAS */ \
( 1 < < 1 0 ) + /* tRRD */ \
( 3 < < 8 ) + /* tCAS */ \
( 2 < < 4 ) + /* tRCD */ \
( 7 < < 0 ) /* tRC */
.equ ESDCTL0 _ 2 5 6 M B , \
( 1 < < 3 1 ) + \
( 0 < < 2 8 ) + \
( 0 < < 2 7 ) + \
( 3 < < 2 4 ) + /* 14 rows */ \
( 2 < < 2 0 ) + /* 10 cols */ \
( 2 < < 1 6 ) + \
( 4 < < 1 3 ) + /* 3.91us (64ms/16384) */ \
( 0 < < 1 0 ) + \
( 0 < < 8 ) + \
( 1 < < 7 ) + \
( 0 < < 0 )