blob: cc409fc88435f65b1cc3457855b986781676a144 [file] [log] [blame]
; initialize system
AREA.CLEAR
AREA
diag 16001
entry &ddrSpeed
local &ddrSpeed
SYStem.RESet
SYStem.CPU 88FR581V7
SYStem.MultiCore COREBASE 0xc2301000
SYStem.MultiCore MEMORYACCESSPORT 0
SYStem.MultiCore DEBUGACCESSPORT 1
system.mode attach
system.Up
; set system settings according LE MMU
d.s C15:1 %LONG 0x00052078
if ("&ddrSpeed"=="")
(
area.res
area.c select
area.s select
w.area select
screen.always
; user selects ddr speed
print ""
print ""
print "Please select DDR Option:"
print ""
print "1) Trainning sequence (Default)"
print "2) 667 Mhz (for DB-78460-BP only)"
print
enter &ddrSpeed
area.res
wclear
)
if &ddrSpeed==1
(
;Enable L2 Block => Set L2Exist
D.S SD:0xD0020200 %LE %LONG 0x01000102
; Configure L@ ways 0-3 to be SRAM
D.S SD:0xD000878C %LE %LONG 0x40000000
D.S SD:0xD000878C %LE %LONG 0x40010001
D.S SD:0xD000878C %LE %LONG 0x40020002
D.S SD:0xD000878C %LE %LONG 0x40030003
; Open the SRAM window 0 to the 512K SRAM
D.S SD:0xD0020240 %LE %LONG 0x40000701
print "Finished setting the L2 as SRAM"
; Close fastpath window
D.S SD:0xD0020184 %LE %LONG 0x0
; Set stack
REGISTER.SET R13 0x40040000
WAIT 100.ms
print "Init Done ;-)"
D.LOAD bin_hdr\bin_hdr.elf
go
wait !run()
D.S SD:0xD0001700 %LE %LONG 0x0 ; Disable DLB when running from LB
)
else if &ddrSpeed==2
(
; 667 MHZ DDR
print ""
print "Starting DRAM initialization for DB-78460-BP board:"
; dram init
d.s 0xD0001400 %LONG 0x7301D453 ; DDR SDRAM Configuration Register
d.s 0xD0001404 %LONG 0x3630B840 ; Dunit Control Low Register
d.s 0xD0001408 %LONG 0x5415a998 ; DDR SDRAM Timing (Low) Register
d.s 0xD000140C %LONG 0x36000C6A ; DDR SDRAM Timing (High) Register
d.s 0xD0001410 %LONG 0x04000000 ; DDR SDRAM Address Control Register
d.s 0xD0001414 %LONG 0x00000000 ; DDR SDRAM Open Pages Control Register
d.s 0xD0001418 %LONG 0x00000e00 ; DDR SDRAM Operation Register
d.s 0xD000141C %LONG 0x00000672 ; DDR SDRAM Mode Register
d.s 0xD0001420 %LONG 0x00000004 ; DDR SDRAM Extended Mode Register
d.s 0xD0001424 %LONG 0x0100D1FF ; Dunit Control High Register ( 2 :1 - bits 15:12 = 0xD )
d.s 0xD0001428 %LONG 0x000F8830 ; Dunit Control High Register
d.s 0xD000142C %LONG 0x214C2F38 ; Dunit Control High Register ( 2:1 - bit 29 = '1' )
d.s 0xD000147C %LONG 0x0000c871 ;
; 2:1
d.s 0xD00014a8 %LONG 0x00000101 ;
d.s 0xD0020220 %LONG 0x00000007 ;
d.s 0xD0001494 %LONG 0x00010000 ; DDR SDRAM ODT Control (Low) Register
d.s 0xD0001498 %LONG 0x00000000 ; DDR SDRAM ODT Control (High) Register
d.s 0xD000149C %LONG 0x00000001 ; DDR Dunit ODT Control Register
;d.s 0xD000149C %LONG 0x00000300 ; DDR Dunit ODT Control Register
; First work with Mbus DRAM window at DRAM Init - 256MB in default
d.s 0xD00200EC %LONG 0x00000000
d.s 0xD00200E8 %LONG 0x1FFF0E00
d.s 0xD0020184 %LONG 0x1FFFFFe1
; Those registers should not be connected in this device, so just to be sure we will Zero them
d.s 0xD0001504 %LONG 0x1FFFFFF1 ;
d.s 0xD000150C %LONG 0x00000000 ; CS[1]n Size Register
d.s 0xD0001514 %LONG 0x00000000 ; CS[2]n Size Register
d.s 0xD000151C %LONG 0x00000000 ; CS[3]n Size Register
d.s 0xD0001524 %LONG 0x0000C800 ; DDR I/O register
d.s 0xD0001538 %LONG 0x0000000b ; Read Data Sample Delays Register
d.s 0xD000153C %LONG 0x0000000d ; Read Data Ready Delay Register
;d.s 0xD0001538 %LONG 0x0000000c ; Read Data Sample Delays Register CL=10
;d.s 0xD000153C %LONG 0x0000000e ; Read Data Ready Delay Register CL=10
d.s 0xD00015D0 %LONG 0x00000a50 ; MR0
;d.s 0xD00015D0 %LONG 0x00000a60 ; MR0 CL=10
d.s 0xD00015D4 %LONG 0x00008044 ; MR1
d.s 0xD00015D8 %LONG 0x00010210 ; MR2
d.s 0xD00015DC %LONG 0x00018000 ; MR3
d.s 0xD00015E4 %LONG 0x00203c18; ZQC Configuration Register
;d.s 0xD00015EC %LONG 0xDE000025; DDR PHY
d.s 0xD00015EC %LONG 0xF800AA25;
print " [Done]"
LOCAL &status
LOCAL &bit
LOCAL &readlvl
&readlvl=1
if (&readlvl>0)
(
print "Starting Read Leveling:"
&status=0
&bit=31
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;read leveling values
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;PUP RdSampleDly (+CL) Phase RL ADLL value
;0 2 1 3
d.s 0xD00016A0 %LONG 0xC0020103
;d.s 0xD00016A0 %LONG 0xC0020108
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;1 2 0 18
d.s 0xD00016A0 %LONG 0xC0420012
;d.s 0xD00016A0 %LONG 0xC042001C
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;2 2 1 19
d.s 0xD00016A0 %LONG 0xC0820113
;d.s 0xD00016A0 %LONG 0xC082020b
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;3 2 0 18
d.s 0xD00016A0 %LONG 0xC0C20012
;d.s 0xD00016A0 %LONG 0xC0C2001C
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;4 2 1 0
d.s 0xD00016A0 %LONG 0xC1020100
;d.s 0xD00016A0 %LONG 0xC1020106
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;5 2 0 22
d.s 0xD00016A0 %LONG 0xC1420016
;d.s 0xD00016A0 %LONG 0xC142001E
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;6 2 1 9
d.s 0xD00016A0 %LONG 0xC1820109
;d.s 0xD00016A0 %LONG 0xC182010D
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;7 2 0 16
d.s 0xD00016A0 %LONG 0xC1C20010
;d.s 0xD00016A0 %LONG 0xC1C20018
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;8 2 0 28
d.s 0xD00016A0 %LONG 0xC2020112
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print " [Done]"
)
print "Starting Write Leveling:"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;write leveling values
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;PUP
;0
d.s 0xD00016A0 %LONG 0xC000b11F
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;1
d.s 0xD00016A0 %LONG 0xC040690D
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;2
d.s 0xD00016A0 %LONG 0xC0803600
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;3
d.s 0xD00016A0 %LONG 0xC0C0a81D
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;4
d.s 0xD00016A0 %LONG 0xC1009919
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;5
d.s 0xD00016A0 %LONG 0xC1407911
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;6
d.s 0xD00016A0 %LONG 0xC180ad1e
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;7
d.s 0xD00016A0 %LONG 0xC1C04d06
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;8
d.s 0xD00016A0 %LONG 0xC2008514
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; center DQS on read cycle
d.s 0xD00016A0 %LONG 0xC803000F
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
WHILE (&status>0)
(
&status=Data.Long(SD:0xD00016A0)
&status=&status&(1<<31)
)
print " [Done]"
d.s 0xD0001480 %LONG 0x00000001 ; DDR SDRAM Initialization Control Register
WAIT 2.s
print "Init Done ;-)"
)
; Set program counter at program start to be ready for start
; Register.Set pc 0xffff0000
; R.S PC 670000
enddo