blob: 97ce46e6aaedd75477843644919893a2a39fbf48 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*********************************************************************
2 °æÈ¨ËùÓÐ (C)2003, ÉîÛÚÊÐÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
3
4 ÎļþÃû³Æ£º zx2802.a
5 ÄÚÈÝÕªÒª£º ¶¨Òåinit.sʹÓõij£Á¿
6 ×÷ Õߣº ÖÐÐËͨѶ £º¹Ù»ª²®
7 Íê³ÉÈÕÆÚ£º 2006Äê04ÔÂ02ÈÕ
8**********************************************************************/
9
10/*ÐÞ¸ÄÀúÊ·£º
112003-06-30: hbguan,´´½¨
122003-12-22: hbguan,Ôö¼ÓSDRAM¿ØÖÆÆ÷¼Ä´æÆ÷µØÖ·µÄ¶¨Òå¡£
132006.04.02 hbguan, Ð޸ģ¬ÓÃÓÚÖ§³Özx2802µÄ²âÊÔ¹¦ÄÜ
142007.04.02 hbguan, Ð޸ģ¬Ö§³Özx2802 ´Ónor flashÖÐboot
15*/
16
17
18
19/*------- Stacks config ------------------------------------
20TOTAL_STACK_LEN EQU 0x10000 ; stack length in bytes
21
22STACK_SIZE_UNDEF EQU 24
23STACK_SIZE_ABORT EQU 48
24STACK_SIZE_IRQ EQU 0x1000
25STACK_SIZE_FIQ EQU 0x1000
26STACK_SIZE_SVC EQU (TOTAL_STACK_LEN -STACK_SIZE_UNDEF -STACK_SIZE_ABORT -STACK_SIZE_IRQ -STACK_SIZE_FIQ)
27
28
29
30ARM926E-J CP15 control register 1
31Register Function
32bit
33----------------------------------------------------------
34[31:19] - Reserved.
35 When read returns an UNPREDICTABLE value.
36 When written SHOULD BE ZERO, or a value read from bits [31:19] on
37 the same processor.Using a read-modify-write sequence when modifying
38 this register provides the greatest future compatibility.
39[18] - Reserved, SBO. Read = 1, write = 1.
40[17] - Reserved, SBZ. Read = 0, write = 0.
41[16] - Reserved, SBO. Read = 1, write = 1.
42[15] L4 bit Determines if the T bit is set when load instructions change the PC:
43 0 = loads to PC set the T bit
44 1 = loads to PC do not set T bit (ARMv4 behavior).
45 For more details see the ARM Architecture Reference Manual.
46[14] RR bit Replacement strategy for ICache and DCache:
47 0 = Random replacement
48 1 = Round-robin replacement.
49[13] V bit Location of exception vectors:
50 0 = Normal exception vectors selected, address range = 0x0000 0000 to
51 0x0000 001C
52 1 = High exception vectors selected, address range = 0xFFFF 0000 to
53 0xFFFF 001C.
54 Set to the value of VINITHI on reset.
55[12] I bit ICache enable/disable:
56 0 = ICache disabled
57 1 = ICache enabled.
58[11:10] - SBZ.
59[9] R bit ROM protection.
60 This bit modifies the ROM protection system. See Domain access
61 control on page 3-23.
62[8] S bit System protection.
63 This bit modifies the MMU protection system. See Domain access
64 control register r3 on page 2-17.
65[7] B bit Endianness: 0 = Little-endian operation 1 = Big-endian operation. Set to
66 the value of BIGENDINIT on reset.
67[6:3] - Reserved. SBO.
68[2] C bit DCache enable/disable: 0 = Cache disabled 1 = Cache enabled.
69[1] A bit Alignment fault enable/disable: 0 = Data address alignment fault
70 checking disabled 1 = Data address alignment fault checking enabled.
71[0] M bit MMU enable/disable: 0 = disabled 1 = enabled.
72*/
73
74#ifndef _ZX2802_H
75#define _ZX2802_H
76
77#define DONT_SET_T (0x1<<15)
78#define ROUND_ROBIN (0x1<<14)
79#define HIGH_VECTOR (0x1<<13)
80#define ICACHE_ENABLE (0x1<<12)
81#ifndef LITTLE_ENDIAN
82#define LITTLE_ENDIAN (0x0<<7)
83#endif
84#define BIG_ENDIAN (0x1<<7)
85
86#define DCACHE_ENABLE (0x1<<2) /*bit2*/
87#define MMU_ENABLE (0x1) /*bit0*/
88
89
90/*Pre-defined constants*/
91#define MODEMASK 0x1f
92#define USERMODE 0x10
93#define FIQMODE 0x11
94#define IRQMODE 0x12
95#define SVCMODE 0x13
96#define ABORTMODE 0x17
97#define UNDEFMODE 0x1b
98#define SYSMODE 0x1f
99#define NOINT 0xc0
100#define I_BIT 0x80
101#define F_BIT 0x40
102#define MMU_I 0x1000 /*I-cache enable/disable*/
103
104/*Clock configure regs*/
105#define ARM_CONTROL_BASE (0x6000C000)
106
107#define ARM_CLK_CONFIG (ARM_CONTROL_BASE +4)
108#define ARM_PLL_CONFIG (ARM_CONTROL_BASE +8)
109#define ARM_RST_CONFIG (ARM_CONTROL_BASE +0x18)
110#define ZSP_SVT_ADDRESS (ARM_CONTROL_BASE +0x20)
111
112/*ARM_CLK_CONFIG*/
113#define CORE_CLOCK_DIV_MASK (0x3 <<6)
114#define CORE_CLOCK_DIV_1 (0x0 <<6)
115#define CORE_CLOCK_DIV_2 (0x1 <<6)
116#define CORE_CLOCK_DIV_3 (0x2 <<6)
117#define CORE_CLOCK_DIV_4 (0x3 <<6)
118
119#define BUS_CLOCK_DIV_MASK (0x3 <<4)
120#define BUS_CLOCK_DIV_1 (0x0 <<4)
121#define BUS_CLOCK_DIV_2 (0x1 <<4)
122#define BUS_CLOCK_DIV_3 (0x2 <<4)
123#define BUS_CLOCK_DIV_4 (0x3 <<4)
124
125#define CORE_CLOCK_SELECT_MASK (0x1 <<2)
126#define CORE_CLOCK_SELECT_MAIN (0x0 <<2)
127#define CORE_CLOCK_SELECT_32KHZ (0x1 <<2)
128#define CORE_CLOCK_SELECT_PLL (0x2 <<2)
129#define CORE_CLOCK_SELECT_RESERVED (0x3 <<2)
130
131#define UART_CLOCK_MASK (0x1 <<1)
132#define UART_CLOCK_MAIN_CLOCK (0x0 <<1)
133#define UART_CLOCK_BUS_CLOCK (0x1 <<1)
134
135#define TC_CLOCK_MASK (0x1 <<0)
136#define TC_CLOCK_MAIN_CLOCK (0x0 <<0)
137#define TC_CLOCK_BUS_CLOCK (0x1 <<0)
138
139
140/*interrupt controller register*/
141#define IC_BASE (0x60005000)
142#define INT_REQ_REG_ADDR (IC_BASE +0x00) /*ÖжÏÇëÇó¼Ä´æ*/
143#define INT_VEC_REG_ADDR (IC_BASE +0x04) /*ÆÕͨÖжÏÏòÁ¿¼Ä´æÆ÷*/
144#define INT_FIQ_VEC_REG_ADDR (IC_BASE +0x08) /*ÖжÏÏÖ³¡¼Ä´æ*/
145
146#define INT_STA_REG_ADDR (IC_BASE +0x10) /*ÖжÏ״̬¼Ä´æÆ÷*/
147#define INT_MASK_REG_ADDR (IC_BASE +0x14) /*ÖÐ¶ÏÆÁ±Î¼Ä´æÆ÷(1:¿ª·ÅÖжϣ¬0£ºÆÁ±ÎÖжÏ)*/
148#define INT_TEST_REG_ADDR (IC_BASE +0x18) /*ÖжϲâÊԼĴæÆ÷*/
149#define INT_EN_REG_ADDR (IC_BASE +0x1c) /*ÖжÏʹÄܼĴæ*/
150
151#define INT_DIS_EN_REG_ADDR (IC_BASE +0x20) /*ÖжÏȥʹÄܼĴæÆ÷*/
152#define INT_SET_REG_ADDR (IC_BASE +0x24) /*ÖжÏÖÃλ¼Ä´æÆ÷*/
153#define INT_CLEAR_REG_ADDR (IC_BASE +0x28) /*ÖжÏÇåλ¼Ä´æ*/
154
155#define NEST_BIT (0x1 <<10)
156
157/*CS configure*/
158#define SMC_BASE (0x40000000)
159#define SMC_CS0 (SMC_BASE + 0x200)
160#define SMC_CS1 (SMC_BASE + 0x220)
161#define SMC_CS2 (SMC_BASE + 0x240)
162
163/*nand flash*/
164#define SMC_CS0_VALUE (0x00) /* write enable &8bits*/
165/*nor flash*/
166#define SMC_CS1_VALUE (0x81) /* write enable &8 bits*/
167/*SDRAM*/
168#define SMC_CS2_VALUE (0x0081) /*write enable &16 bits*/
169
170#define SDRAM0_BASEADDR (0x10000000)
171
172#define REMAP_ADDR (0x40000000)
173#define REMAP_DEFAULT_VALUE (0x11)
174#define REMAP_SDRAM_TO_0x0 (0x31)
175
176
177/*GPIO regs*/
178#define ARMIO_BASE (0x60007000)
179#define GPIOADATA (ARMIO_BASE +0x0) /*0xc002ec00*/
180#define GPIOBDATA (ARMIO_BASE +0x4) /*0xc002ec04*/
181#define GPIODIRECTA (ARMIO_BASE +0x8) /*0xC002EC08*/
182#define GPIODIRECTB (ARMIO_BASE +0xc) /*0xC002EC0c*/
183
184
185/*watchdog configure*/
186#define WD_BASE 0x60000000
187#define WD_CTRL_REG (WD_BASE + 0x00000000) /* watchdog timer Control register */
188#define WD_LOAD_REG (WD_BASE + 0x00000004) /* Watchdog timer load register */
189#define WD_COUNTER_REG (WD_BASE + 0x00000008) /* Watchdog timer counter register */
190#define WD_STATE_REG (WD_BASE + 0x0000000C) /* Watchdog timer state register */
191
192#define WD_ST_FILL (0x01<<0) /*Æô¶¯¶¨Ê±Æ÷¹¤*/
193#define WD_PTV_FILL (0xff<<8) /* ÍⲿʱÖÓ·ÖÆµÏµÊý*/
194
195/*write key:µ±¿ØÖƼĴæÆ÷µÄ¸ß16λΪ16'h1234£¬¶Ô¸Ã¼Ä´æÆ÷дÓÐЧ£¬¶ÁʱΪ0 */
196#define WD_WRITE_KEY (0x1234<<16)
197
198#define WD_ST_POS 0 /* Æô¶¯¶¨Ê±Æ÷¹¤×÷*/
199#define WD_PTV_POS 8 /* ÍⲿʱÖÓ·ÖÆµ*/
200
201
202/*Òý½Å¸´ÓÃ*/
203#define ARM_PMM_IOCONF1 (0x6000b000)
204#define ARM_PMM_IOCONF2 (0x6000b004)
205
206/*ARM_PMM_IOCONF1*/
207#define USED_ARM_UART2_PINS (0x3 <<14)
208#define USED_ARM_UART1_PINS (0xf <<10)
209/*ARM_PMM_IOCONF2*/
210#define USED_DSP_UART_PINS (0x3 <<14)
211
212
213/*Mode_Stack_Area EQU (0x100000)*/
214
215#define reg(addr) (*(volatile unsigned *)(addr))
216#define reg8(addr) (*(volatile unsigned char*)(addr))
217#define reg16(addr) (*(volatile unsigned short*)(addr))
218#define reg32(addr) (*(volatile unsigned long*)(addr))
219
220#ifndef ERROR
221#define ERROR (-1)
222#endif
223
224
225#define READ_DEFAULT_WORDS 8
226
227#endif/*_ZX2802_H*/
228