;//DATA LINES PIN 0..31
LDR R0,=0x000000F3
LDR R1,=0x4008609C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860A0
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860A4
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860A8
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860AC
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860B0
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860B4
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x400860B8
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086290
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086294
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086298
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x4008629C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086280
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086284
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086288
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x4008628C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086688
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x4008668C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086690
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086694
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086698
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x4008669C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866A0
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866A4
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086714
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086718
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008671C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086720
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086724
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086728
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008672C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086730
STR R0,[R1,#0X00]
;//ADRESS LINS PIN 0..23
LDR R0,=0x000000F3
LDR R1,=0x40086124
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086128
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008612C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086130
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086134
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086080
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086084
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086088
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086120
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008611C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086118
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086108
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086104
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086100
STR R0,[R1,#0X00]
LDR R0,=0x000000F1
LDR R1,=0x40086320
STR R0,[R1,#0X00]
LDR R0,=0x000000F1
LDR R1,=0x4008631C
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866C0
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866BC
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086700
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086704
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086708
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008670C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086710
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086510
;//EMC CONTROL SIGNAL PIN
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086090
STR R0,[R1,#0X00]
LDR R0,=0x000000F1
LDR R1,=0x40086318
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866B4
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x400866A8
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086324
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086098
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086310
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086314
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008632C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086330
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086328
STR R0,[R1,#0X00]
LDR R0,=0x000000F2
LDR R1,=0x40086680
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086734
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x4008608C
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086090
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086094
STR R0,[R1,#0X00]
LDR R0,=0x000000F3
LDR R1,=0x40086098
STR R0,[R1,#0X00]
;//CLK SIGNAL PIN
LDR R0,=0x000000F0
LDR R1,=0x40086C00
STR R0,[R1,#0X00]
LDR R0,=0x000000F0
LDR R1,=0x40086C04
STR R0,[R1,#0X00]
LDR R0,=0x000000F0
LDR R1,=0x40086C08
STR R0,[R1,#0X00]
LDR R0,=0x000000F0
LDR R1,=0x40086C0C
STR R0,[R1,#0X00]
;//PIN SET UP END
B CLOCKCONFIGSTART
LTORG
CLOCKCONFIGSTART
;//CLOCK SET UP
;//OSC Enable
LDR R0,=0X01000800
LDR R1,=0x4005006C
STR R0,[R1,#0X00]
LDR R0,=0x40050018
LDR R1,[R0,#0X00]
LDR R2,=0XFFFFFFFC
AND R1,R2
LDR R0,=0x40050018
STR R1,[R0,#0X00]
;//DELAY 200US
LDR R0,=0x00000001
DELAY200USSTART
LDR R1,=0X00000001
ADD R0,R1
CMP R0,#0X2000
BEQ DELAY200USEND
B DELAY200USSTART
DELAY200USEND
;//Set PLL 102MHz
LDR R0,=0X00000001
LDR R1,=0x40050044
STR R0,[R1,#0X00]
LDR R0,=0X06100800
LDR R1,=0x40050044
STR R0,[R1,#0X00]
;//wait PLL lock
PLLLOCK102MSTART
LDR R0,=0x40050040
LDR R1,[R0,#0X00]
LDR R2,=0X00000001
AND R1,R2
CMP R1,#0X01
BEQ PLLLOCK102MEND
B PLLLOCK102MSTART
PLLLOCK102MEND
;DELAY
LDR R0,=0x00000001
DELAY10USSTART
LDR R1,=0X00000001
ADD R0,R1
CMP R0,#0x00000400
BEQ DELAY10USEND
B DELAY10USSTART
DELAY10USEND
;//CGU_BASE_M4_CLK = PLL1
LDR R0,=0x09000800
LDR R1,=0x4005006C
STR R0,[R1,#0X00]
;DELAY
LDR R0,=0x00000001
DELAY50USSTART
LDR R1,=0X00000001
ADD R0,R1
CMP R0,#0x00000800
BEQ DELAY50USEND
B DELAY50USSTART
DELAY50USEND
;//IMPROVE PLL UP TO 204MHZ
LDR R0,=0x40050044
LDR R1,[R0,#0X00]
LDR R2,=0X000000C0
ORR R1,R2
STR R1,[R0,#0X00]
;//CLK_M4_EMCDIV DIV=2
LDR R0,=0x40051478
LDR R1,[R0,#0X00]
LDR R2,=0X00000026
ORR R1,R2
LDR R0,=0x40051478
STR R1,[R0,#0X00]
;//CREG6 EMC_CLK_DIV = 2
LDR R0,=0x4004312C
LDR R1,[R0,#0X00]
LDR R2,=0X00010000
ORR R1,R2
LDR R0,=0x4004312C
STR R1,[R0,#0X00]
;//CCU1_CLK_M4_EMCDIV_STAT
CLKEMCSTART
LDR R0,=0x4005147C
LDR R1,[R0,#0X00]
LDR R2,=0X00000001
AND R1,R2
CMP R1,#0X01
BEQ CLKEMCEND
B CLKEMCSTART
CLKEMCEND
;//CLK_M4_EMC_CFG Enable
LDR R0,=0x40051430
LDR R1,[R0,#0X00]
LDR R2,=0X00000001
ORR R1,R2
LDR R0,=0x40051430
STR R1,[R0,#0X00]
;//CCU1_CLK_M4_EMC_STAT
CLKM4START
LDR R0,=0x40051434
LDR R1,[R0,#0X00]
LDR R2,=0X00000001
AND R1,R2
CMP R1,#0X01
BEQ CLKM4END
B CLKM4START
CLKM4END
;//CLOCK SET UP END
;//EMC REGISTER SET UP
;// Configure EMC delays
LDR R0,=0x00006666
LDR R1,=0x40086D00
STR R0,[R1,#0X00]
;// Initialize EMC
;//DYNAMIC FOR SDRAM
LDR R0,=0x00000001; // CONTROL=1 = Enable EMC
LDR R1,=0x40005000
STR R0,[R1,#0X00]
LDR R0,=0x00000000; // CONFIG=0
LDR R1,=0x40005008
STR R0,[R1,#0X00]
LDR R0,=0x00001480; // DYNAMICCONFIG0
LDR R1,=0x40005100
STR R0,[R1,#0X00]
LDR R0,=0x00001280; // DYNAMICCONFIG2
LDR R1,=0x40005140
STR R0,[R1,#0X00]
LDR R0,=0x00000303; // DYNAMICRASCAS0
LDR R1,=0x40005104
STR R0,[R1,#0X00]
LDR R0,=0x00000303; // DYNAMICRASCAS2
LDR R1,=0x40005144
STR R0,[R1,#0X00]
LDR R0,=0x00000001; // DYNAMICREADCONFIG
LDR R1,=0x40005028
STR R0,[R1,#0X00]
LDR R0,=0x00000001; // DYNAMICRP
LDR R1,=0x40005030
STR R0,[R1,#0X00]
LDR R0,=0x00000003; // DYNAMICRAS
LDR R1,=0x40005034
STR R0,[R1,#0X00]
LDR R0,=0x00000005; // DYNAMICREX
LDR R1,=0x40005038
STR R0,[R1,#0X00]
LDR R0,=0x00000000; // DYNAMICAPR
LDR R1,=0x4000503C
STR R0,[R1,#0X00]
LDR R0,=0x00000004; // DYNAMICDAL
LDR R1,=0x40005040
STR R0,[R1,#0X00]
LDR R0,=0x00000001; // DYNAMICWR
LDR R1,=0x40005044
STR R0,[R1,#0X00]
LDR R0,=0x00000005; // DYNAMICRC
LDR R1,=0x40005048
STR R0,[R1,#0X00]
LDR R0,=0x00000005; // DYNAMICRFC
LDR R1,=0x4000504C
STR R0,[R1,#0X00]
LDR R0,=0x00000005; // DYNAMICXSR
LDR R1,=0x40005050
STR R0,[R1,#0X00]
LDR R0,=0x00000001; // DYNAMICRRD
LDR R1,=0x40005054
STR R0,[R1,#0X00]
LDR R0,=0x00000001; // DYNAMICMRD
LDR R1,=0x40005058
STR R0,[R1,#0X00]
LDR R0,=0x00000183; // DYNAMICCONTROL - NOP
LDR R1,=0x40005020
STR R0,[R1,#0X00]
LDR R0,=0x00000103; // DYNAMICCONTROL - PRECHARGE_ALL
LDR R1,=0x40005020
STR R0,[R1,#0X00]
LDR R0,=0x00000002; // DYNAMICREFRESH = 2
LDR R1,=0x40005024
STR R0,[R1,#0X00]
LDR R0,=0x00000032; // DYNAMICREFRESH = 50
LDR R1,=0x40005024
STR R0,[R1,#0X00]
LDR R0,=0x00000083; // DYNAMICCONTROL - MODE
LDR R1,=0x40005020
STR R0,[R1,#0X00]
LDR R0,=0x2800CC00; // Write 16-bit SDRAM Mode register burst 8
LDR R1,[R0,#0X00]
LDR R0,=0x00000000; // DYNAMICCONTROL = 0
LDR R1,=0x40005020
STR R0,[R1,#0X00]
LDR R0,=0x00081480; // DYNAMICCONFIG0
LDR R1,=0x40005100
STR R0,[R1,#0X00]
LDR R0,=0x00081480; // DYNAMICCONFIG0
LDR R1,=0x40005120
STR R0,[R1,#0X00]
LDR R0,=0x00081480; // DYNAMICCONFIG2
LDR R1,=0x40005140
STR R0,[R1,#0X00]
LDR R0,=0x00081480; // DYNAMICCONFIG2
LDR R1,=0x40005160
STR R0,[R1,#0X00]
;STRTIC FOR EPLD
LDR R0,=0x00000082; // STATICCONFIG0
LDR R1,=0x40005200
STR R0,[R1,#0X00]
LDR R0,=0x0000000F; //STATICWAITWEN0
LDR R1,=0x40005204
STR R0,[R1,#0X00]
LDR R0,=0x0000000F; // STATICWAITOEN0
LDR R1,=0x40005208
STR R0,[R1,#0X00]
LDR R0,=0x0000001F; // STATICWAITRD0
LDR R1,=0x4000520C
STR R0,[R1,#0X00]
LDR R0,=0x0000001F; // STATICWAITPAGE0
LDR R1,=0x40005210
STR R0,[R1,#0X00]
LDR R0,=0x0000001F; //STATICWAITWR0
LDR R1,=0x40005214
STR R0,[R1,#0X00]
LDR R0,=0x0000000F; // STATICWAITTURN0
LDR R1,=0x40005218
STR R0,[R1,#0X00]
LDR R0,=0x00000008; // STATICEXTENDEDWAIT
LDR R1,=0x40005080
STR R0,[R1,#0X00]
LDR R0,=0x40005200
LDR R1,[R0,#0X00]
LDR R2,=0X00000100
ORR R1,R2
STR R1,[R0,#0X00]
;;//EMC REGISTER SET UP END
内核跑到204000000,emc跑的102000000 |