bonitoreg.h revision 1.7 1 1.7 bouyer /* $NetBSD: bonitoreg.h,v 1.7 2011/08/27 12:59:17 bouyer Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*
4 1.5 simonb * Bonito Register Map
5 1.1 thorpej * Copyright (c) 1999 Algorithmics Ltd
6 1.1 thorpej *
7 1.1 thorpej * Algorithmics gives permission for anyone to use and modify this file
8 1.1 thorpej * without any obligation or license condition except that you retain
9 1.1 thorpej * this copyright message in any source redistribution in whole or part.
10 1.1 thorpej *
11 1.1 thorpej * Updated copies of this and other files can be found at
12 1.1 thorpej * ftp://ftp.algor.co.uk/pub/bonito/
13 1.5 simonb *
14 1.1 thorpej * Users of the Bonito controller are warmly recommended to contribute
15 1.1 thorpej * any useful changes back to Algorithmics (mail to
16 1.1 thorpej * bonito (at) algor.co.uk).
17 1.1 thorpej */
18 1.1 thorpej
19 1.5 simonb /* Revision 1.48 autogenerated on 08/17/99 15:20:01 */
20 1.1 thorpej
21 1.1 thorpej #ifndef _BONITO_H_
22 1.1 thorpej
23 1.2 thorpej #define BONITO(x) (BONITO_REG_BASE + (x))
24 1.1 thorpej
25 1.7 bouyer
26 1.7 bouyer #ifdef _LP64
27 1.7 bouyer #define REGVAL(x) *((volatile u_int32_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x))
28 1.7 bouyer #define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_XKPHYS_UNCACHED(x))
29 1.7 bouyer #else
30 1.6 perry #define REGVAL(x) *((volatile u_int32_t *) MIPS_PHYS_TO_KSEG1(x))
31 1.7 bouyer #define REGVAL8(x) *((volatile u_int8_t *)MIPS_PHYS_TO_KSEG1(x))
32 1.7 bouyer #endif
33 1.1 thorpej
34 1.1 thorpej #define BONITO_BOOT_BASE 0x1fc00000
35 1.1 thorpej #define BONITO_BOOT_SIZE 0x00100000
36 1.5 simonb #define BONITO_BOOT_TOP (BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1)
37 1.1 thorpej #define BONITO_FLASH_BASE 0x1c000000
38 1.1 thorpej #define BONITO_FLASH_SIZE 0x03000000
39 1.5 simonb #define BONITO_FLASH_TOP (BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1)
40 1.1 thorpej #define BONITO_SOCKET_BASE 0x1f800000
41 1.1 thorpej #define BONITO_SOCKET_SIZE 0x00400000
42 1.5 simonb #define BONITO_SOCKET_TOP (BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1)
43 1.1 thorpej #define BONITO_REG_BASE 0x1fe00000
44 1.1 thorpej #define BONITO_REG_SIZE 0x00040000
45 1.5 simonb #define BONITO_REG_TOP (BONITO_REG_BASE+BONITO_REG_SIZE-1)
46 1.1 thorpej #define BONITO_DEV_BASE 0x1ff00000
47 1.1 thorpej #define BONITO_DEV_SIZE 0x00100000
48 1.5 simonb #define BONITO_DEV_TOP (BONITO_DEV_BASE+BONITO_DEV_SIZE-1)
49 1.1 thorpej #define BONITO_PCILO_BASE 0x10000000
50 1.1 thorpej #define BONITO_PCILO_SIZE 0x0c000000
51 1.5 simonb #define BONITO_PCILO_TOP (BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1)
52 1.5 simonb #define BONITO_PCILO0_BASE 0x10000000
53 1.5 simonb #define BONITO_PCILO1_BASE 0x14000000
54 1.5 simonb #define BONITO_PCILO2_BASE 0x18000000
55 1.1 thorpej #define BONITO_PCIHI_BASE 0x20000000
56 1.1 thorpej #define BONITO_PCIHI_SIZE 0x20000000
57 1.5 simonb #define BONITO_PCIHI_TOP (BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1)
58 1.7 bouyer #define LS2F_PCIHI_BASE 0x40000000UL
59 1.7 bouyer #define LS2F_PCIHI_SIZE 0x40000000UL
60 1.7 bouyer #define LS2F_PCIHI_TOP (LS2F_PCIHI_BASE+LS2F_PCIHI_SIZE-1)
61 1.1 thorpej #define BONITO_PCIIO_BASE 0x1fd00000
62 1.7 bouyer #define BONITO_PCIIO_LEGACY 0x00004000UL
63 1.1 thorpej #define BONITO_PCIIO_SIZE 0x00100000
64 1.5 simonb #define BONITO_PCIIO_TOP (BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1)
65 1.1 thorpej #define BONITO_PCICFG_BASE 0x1fe80000
66 1.1 thorpej #define BONITO_PCICFG_SIZE 0x00080000
67 1.5 simonb #define BONITO_PCICFG_TOP (BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1)
68 1.5 simonb
69 1.1 thorpej
70 1.1 thorpej /* Bonito Register Bases */
71 1.1 thorpej
72 1.1 thorpej #define BONITO_PCICONFIGBASE 0x00
73 1.1 thorpej #define BONITO_REGBASE 0x100
74 1.1 thorpej
75 1.1 thorpej
76 1.1 thorpej /* PCI Configuration Registers */
77 1.1 thorpej
78 1.5 simonb #define BONITO_PCI_REG(x) BONITO(BONITO_PCICONFIGBASE + (x))
79 1.5 simonb #define BONITO_PCIDID BONITO_PCI_REG(0x00)
80 1.5 simonb #define BONITO_PCICMD BONITO_PCI_REG(0x04)
81 1.5 simonb #define BONITO_PCICLASS BONITO_PCI_REG(0x08)
82 1.5 simonb #define BONITO_PCILTIMER BONITO_PCI_REG(0x0c)
83 1.5 simonb #define BONITO_PCIBASE0 BONITO_PCI_REG(0x10)
84 1.5 simonb #define BONITO_PCIBASE1 BONITO_PCI_REG(0x14)
85 1.5 simonb #define BONITO_PCIBASE2 BONITO_PCI_REG(0x18)
86 1.5 simonb #define BONITO_PCIEXPRBASE BONITO_PCI_REG(0x30)
87 1.5 simonb #define BONITO_PCIINT BONITO_PCI_REG(0x3c)
88 1.1 thorpej
89 1.1 thorpej #define BONITO_PCICMD_PERR_CLR 0x80000000
90 1.1 thorpej #define BONITO_PCICMD_SERR_CLR 0x40000000
91 1.1 thorpej #define BONITO_PCICMD_MABORT_CLR 0x20000000
92 1.1 thorpej #define BONITO_PCICMD_MTABORT_CLR 0x10000000
93 1.1 thorpej #define BONITO_PCICMD_TABORT_CLR 0x08000000
94 1.1 thorpej #define BONITO_PCICMD_MPERR_CLR 0x01000000
95 1.1 thorpej #define BONITO_PCICMD_PERRRESPEN 0x00000040
96 1.1 thorpej #define BONITO_PCICMD_ASTEPEN 0x00000080
97 1.1 thorpej #define BONITO_PCICMD_SERREN 0x00000100
98 1.1 thorpej #define BONITO_PCILTIMER_BUSLATENCY 0x0000ff00
99 1.1 thorpej #define BONITO_PCILTIMER_BUSLATENCY_SHIFT 8
100 1.1 thorpej
101 1.1 thorpej
102 1.3 thorpej #define BONITO_REV_FPGA(x) ((x) & 0x80)
103 1.3 thorpej #define BONITO_REV_MAJOR(x) (((x) >> 4) & 0x7)
104 1.3 thorpej #define BONITO_REV_MINOR(x) ((x) & 0xf)
105 1.1 thorpej
106 1.1 thorpej
107 1.1 thorpej /* 1. Bonito h/w Configuration */
108 1.1 thorpej /* Power on register */
109 1.1 thorpej
110 1.1 thorpej #define BONITO_BONPONCFG BONITO(BONITO_REGBASE + 0x00)
111 1.1 thorpej
112 1.1 thorpej #define BONITO_BONPONCFG_SYSCONTROLLERRD 0x00040000
113 1.1 thorpej #define BONITO_BONPONCFG_ROMCS1SAMP 0x00020000
114 1.1 thorpej #define BONITO_BONPONCFG_ROMCS0SAMP 0x00010000
115 1.1 thorpej #define BONITO_BONPONCFG_CPUBIGEND 0x00004000
116 1.1 thorpej #define BONITO_BONPONCFG_CPUPARITY 0x00002000
117 1.5 simonb #define BONITO_BONPONCFG_BURSTORDER 0x00001000
118 1.1 thorpej #define BONITO_BONPONCFG_CPUTYPE 0x00000007
119 1.1 thorpej #define BONITO_BONPONCFG_CPUTYPE_SHIFT 0
120 1.1 thorpej #define BONITO_BONPONCFG_PCIRESET_OUT 0x00000008
121 1.1 thorpej #define BONITO_BONPONCFG_IS_ARBITER 0x00000010
122 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT 0x000000c0
123 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT_SHIFT 6
124 1.1 thorpej
125 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT_FLASH (0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
126 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
127 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT_SDRAM (0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
128 1.1 thorpej #define BONITO_BONPONCFG_ROMBOOT_CPURESET (0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
129 1.1 thorpej
130 1.1 thorpej #define BONITO_BONPONCFG_ROMCS0WIDTH 0x00000100
131 1.1 thorpej #define BONITO_BONPONCFG_ROMCS1WIDTH 0x00000200
132 1.1 thorpej #define BONITO_BONPONCFG_ROMCS0FAST 0x00000400
133 1.1 thorpej #define BONITO_BONPONCFG_ROMCS1FAST 0x00000800
134 1.1 thorpej #define BONITO_BONPONCFG_CONFIG_DIS 0x00000020
135 1.1 thorpej
136 1.1 thorpej
137 1.1 thorpej /* Other Bonito configuration */
138 1.1 thorpej
139 1.5 simonb #define BONITO_BONGENCFG_OFFSET 0x4
140 1.5 simonb #define BONITO_BONGENCFG BONITO(BONITO_REGBASE + BONITO_BONGENCFG_OFFSET)
141 1.1 thorpej
142 1.1 thorpej #define BONITO_BONGENCFG_DEBUGMODE 0x00000001
143 1.1 thorpej #define BONITO_BONGENCFG_SNOOPEN 0x00000002
144 1.1 thorpej #define BONITO_BONGENCFG_CPUSELFRESET 0x00000004
145 1.1 thorpej
146 1.1 thorpej #define BONITO_BONGENCFG_FORCE_IRQA 0x00000008
147 1.1 thorpej #define BONITO_BONGENCFG_IRQA_ISOUT 0x00000010
148 1.1 thorpej #define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
149 1.1 thorpej #define BONITO_BONGENCFG_BYTESWAP 0x00000040
150 1.1 thorpej
151 1.1 thorpej #define BONITO_BONGENCFG_UNCACHED 0x00000080
152 1.1 thorpej #define BONITO_BONGENCFG_PREFETCHEN 0x00000100
153 1.1 thorpej #define BONITO_BONGENCFG_WBEHINDEN 0x00000200
154 1.1 thorpej #define BONITO_BONGENCFG_CACHEALG 0x00000c00
155 1.1 thorpej #define BONITO_BONGENCFG_CACHEALG_SHIFT 10
156 1.1 thorpej #define BONITO_BONGENCFG_PCIQUEUE 0x00001000
157 1.1 thorpej #define BONITO_BONGENCFG_CACHESTOP 0x00002000
158 1.1 thorpej #define BONITO_BONGENCFG_MSTRBYTESWAP 0x00004000
159 1.5 simonb #define BONITO_BONGENCFG_BUSERREN 0x00008000
160 1.1 thorpej #define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
161 1.5 simonb #define BONITO_BONGENCFG_SHORTCOPYTIMEOUT 0x00020000
162 1.1 thorpej
163 1.1 thorpej /* 2. IO & IDE configuration */
164 1.1 thorpej
165 1.1 thorpej #define BONITO_IODEVCFG BONITO(BONITO_REGBASE + 0x08)
166 1.1 thorpej
167 1.1 thorpej /* 3. IO & IDE configuration */
168 1.1 thorpej
169 1.1 thorpej #define BONITO_SDCFG BONITO(BONITO_REGBASE + 0x0c)
170 1.1 thorpej
171 1.1 thorpej /* 4. PCI address map control */
172 1.1 thorpej
173 1.1 thorpej #define BONITO_PCIMAP BONITO(BONITO_REGBASE + 0x10)
174 1.1 thorpej #define BONITO_PCIMEMBASECFG BONITO(BONITO_REGBASE + 0x14)
175 1.1 thorpej #define BONITO_PCIMAP_CFG BONITO(BONITO_REGBASE + 0x18)
176 1.1 thorpej
177 1.1 thorpej /* 5. ICU & GPIO regs */
178 1.5 simonb
179 1.1 thorpej /* GPIO Regs - r/w */
180 1.1 thorpej
181 1.5 simonb #define BONITO_GPIODATA_OFFSET 0x1c
182 1.5 simonb #define BONITO_GPIODATA BONITO(BONITO_REGBASE + BONITO_GPIODATA_OFFSET)
183 1.1 thorpej #define BONITO_GPIOIE BONITO(BONITO_REGBASE + 0x20)
184 1.1 thorpej
185 1.1 thorpej /* ICU Configuration Regs - r/w */
186 1.1 thorpej
187 1.1 thorpej #define BONITO_INTEDGE BONITO(BONITO_REGBASE + 0x24)
188 1.1 thorpej #define BONITO_INTSTEER BONITO(BONITO_REGBASE + 0x28)
189 1.1 thorpej #define BONITO_INTPOL BONITO(BONITO_REGBASE + 0x2c)
190 1.1 thorpej
191 1.1 thorpej /* ICU Enable Regs - IntEn & IntISR are r/o. */
192 1.1 thorpej
193 1.1 thorpej #define BONITO_INTENSET BONITO(BONITO_REGBASE + 0x30)
194 1.1 thorpej #define BONITO_INTENCLR BONITO(BONITO_REGBASE + 0x34)
195 1.1 thorpej #define BONITO_INTEN BONITO(BONITO_REGBASE + 0x38)
196 1.1 thorpej #define BONITO_INTISR BONITO(BONITO_REGBASE + 0x3c)
197 1.1 thorpej
198 1.1 thorpej /* PCI mail boxes */
199 1.1 thorpej
200 1.5 simonb #define BONITO_PCIMAIL0_OFFSET 0x40
201 1.5 simonb #define BONITO_PCIMAIL1_OFFSET 0x44
202 1.5 simonb #define BONITO_PCIMAIL2_OFFSET 0x48
203 1.5 simonb #define BONITO_PCIMAIL3_OFFSET 0x4c
204 1.1 thorpej #define BONITO_PCIMAIL0 BONITO(BONITO_REGBASE + 0x40)
205 1.1 thorpej #define BONITO_PCIMAIL1 BONITO(BONITO_REGBASE + 0x44)
206 1.1 thorpej #define BONITO_PCIMAIL2 BONITO(BONITO_REGBASE + 0x48)
207 1.1 thorpej #define BONITO_PCIMAIL3 BONITO(BONITO_REGBASE + 0x4c)
208 1.1 thorpej
209 1.1 thorpej
210 1.1 thorpej /* 6. PCI cache */
211 1.1 thorpej
212 1.1 thorpej #define BONITO_PCICACHECTRL BONITO(BONITO_REGBASE + 0x50)
213 1.1 thorpej #define BONITO_PCICACHETAG BONITO(BONITO_REGBASE + 0x54)
214 1.1 thorpej
215 1.1 thorpej #define BONITO_PCIBADADDR BONITO(BONITO_REGBASE + 0x58)
216 1.1 thorpej #define BONITO_PCIMSTAT BONITO(BONITO_REGBASE + 0x5c)
217 1.1 thorpej
218 1.1 thorpej
219 1.1 thorpej /*
220 1.1 thorpej #define BONITO_PCIRDPOST BONITO(BONITO_REGBASE + 0x60)
221 1.1 thorpej #define BONITO_PCIDATA BONITO(BONITO_REGBASE + 0x64)
222 1.1 thorpej */
223 1.1 thorpej
224 1.1 thorpej /* 7. IDE DMA & Copier */
225 1.5 simonb
226 1.1 thorpej #define BONITO_CONFIGBASE 0x000
227 1.1 thorpej #define BONITO_BONITOBASE 0x100
228 1.1 thorpej #define BONITO_LDMABASE 0x200
229 1.1 thorpej #define BONITO_COPBASE 0x300
230 1.1 thorpej #define BONITO_REG_BLOCKMASK 0x300
231 1.1 thorpej
232 1.1 thorpej #define BONITO_LDMACTRL BONITO(BONITO_LDMABASE + 0x0)
233 1.1 thorpej #define BONITO_LDMASTAT BONITO(BONITO_LDMABASE + 0x0)
234 1.1 thorpej #define BONITO_LDMAADDR BONITO(BONITO_LDMABASE + 0x4)
235 1.1 thorpej #define BONITO_LDMAGO BONITO(BONITO_LDMABASE + 0x8)
236 1.1 thorpej #define BONITO_LDMADATA BONITO(BONITO_LDMABASE + 0xc)
237 1.1 thorpej
238 1.1 thorpej #define BONITO_COPCTRL BONITO(BONITO_COPBASE + 0x0)
239 1.1 thorpej #define BONITO_COPSTAT BONITO(BONITO_COPBASE + 0x0)
240 1.1 thorpej #define BONITO_COPPADDR BONITO(BONITO_COPBASE + 0x4)
241 1.1 thorpej #define BONITO_COPDADDR BONITO(BONITO_COPBASE + 0x8)
242 1.1 thorpej #define BONITO_COPGO BONITO(BONITO_COPBASE + 0xc)
243 1.1 thorpej
244 1.1 thorpej
245 1.1 thorpej /* ###### Bit Definitions for individual Registers #### */
246 1.1 thorpej
247 1.1 thorpej /* Gen DMA. */
248 1.1 thorpej
249 1.1 thorpej #define BONITO_IDECOPDADDR_DMA_DADDR 0x0ffffffc
250 1.1 thorpej #define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT 2
251 1.1 thorpej #define BONITO_IDECOPPADDR_DMA_PADDR 0xfffffffc
252 1.1 thorpej #define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT 2
253 1.5 simonb #define BONITO_IDECOPGO_DMA_SIZE 0x0000fffe
254 1.1 thorpej #define BONITO_IDECOPGO_DMA_SIZE_SHIFT 0
255 1.1 thorpej #define BONITO_IDECOPGO_DMA_WRITE 0x00010000
256 1.5 simonb #define BONITO_IDECOPGO_DMAWCOUNT 0x000f0000
257 1.5 simonb #define BONITO_IDECOPGO_DMAWCOUNT_SHIFT 16
258 1.1 thorpej
259 1.1 thorpej #define BONITO_IDECOPCTRL_DMA_STARTBIT 0x80000000
260 1.1 thorpej #define BONITO_IDECOPCTRL_DMA_RSTBIT 0x40000000
261 1.1 thorpej
262 1.1 thorpej /* DRAM - sdCfg */
263 1.1 thorpej
264 1.1 thorpej #define BONITO_SDCFG_AROWBITS 0x00000003
265 1.1 thorpej #define BONITO_SDCFG_AROWBITS_SHIFT 0
266 1.1 thorpej #define BONITO_SDCFG_ACOLBITS 0x0000000c
267 1.1 thorpej #define BONITO_SDCFG_ACOLBITS_SHIFT 2
268 1.1 thorpej #define BONITO_SDCFG_ABANKBIT 0x00000010
269 1.1 thorpej #define BONITO_SDCFG_ASIDES 0x00000020
270 1.1 thorpej #define BONITO_SDCFG_AABSENT 0x00000040
271 1.1 thorpej #define BONITO_SDCFG_AWIDTH64 0x00000080
272 1.1 thorpej
273 1.1 thorpej #define BONITO_SDCFG_BROWBITS 0x00000300
274 1.1 thorpej #define BONITO_SDCFG_BROWBITS_SHIFT 8
275 1.1 thorpej #define BONITO_SDCFG_BCOLBITS 0x00000c00
276 1.1 thorpej #define BONITO_SDCFG_BCOLBITS_SHIFT 10
277 1.1 thorpej #define BONITO_SDCFG_BBANKBIT 0x00001000
278 1.1 thorpej #define BONITO_SDCFG_BSIDES 0x00002000
279 1.1 thorpej #define BONITO_SDCFG_BABSENT 0x00004000
280 1.1 thorpej #define BONITO_SDCFG_BWIDTH64 0x00008000
281 1.1 thorpej
282 1.1 thorpej #define BONITO_SDCFG_EXTRDDATA 0x00010000
283 1.1 thorpej #define BONITO_SDCFG_EXTRASCAS 0x00020000
284 1.1 thorpej #define BONITO_SDCFG_EXTPRECH 0x00040000
285 1.1 thorpej #define BONITO_SDCFG_EXTRASWIDTH 0x00180000
286 1.1 thorpej #define BONITO_SDCFG_EXTRASWIDTH_SHIFT 19
287 1.5 simonb #define BONITO_SDCFG_DRAMMODESET 0x00200000
288 1.1 thorpej #define BONITO_SDCFG_DRAMEXTREGS 0x00400000
289 1.5 simonb #define BONITO_SDCFG_DRAMPARITY 0x00800000
290 1.5 simonb #define BONITO_SDCFG_DRAMBURSTLEN 0x03000000
291 1.5 simonb #define BONITO_SDCFG_DRAMBURSTLEN_SHIFT 24
292 1.5 simonb #define BONITO_SDCFG_DRAMMODESET_DONE 0x80000000
293 1.5 simonb
294 1.5 simonb #define BONITO_SDCFG_DRAMRFSHMULT 0xfc000000
295 1.5 simonb #define BONITO_SDCFG_DRAMRFSHMULT_SHIFT 26
296 1.1 thorpej
297 1.1 thorpej /* PCI Cache - pciCacheCtrl */
298 1.1 thorpej
299 1.1 thorpej #define BONITO_PCICACHECTRL_CACHECMD 0x00000007
300 1.1 thorpej #define BONITO_PCICACHECTRL_CACHECMD_SHIFT 0
301 1.1 thorpej #define BONITO_PCICACHECTRL_CACHECMDLINE 0x00000018
302 1.1 thorpej #define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT 3
303 1.1 thorpej #define BONITO_PCICACHECTRL_CMDEXEC 0x00000020
304 1.1 thorpej
305 1.1 thorpej #define BONITO_IODEVCFG_BUFFBIT_CS0 0x00000001
306 1.1 thorpej #define BONITO_IODEVCFG_SPEEDBIT_CS0 0x00000002
307 1.1 thorpej #define BONITO_IODEVCFG_MOREABITS_CS0 0x00000004
308 1.1 thorpej
309 1.1 thorpej #define BONITO_IODEVCFG_BUFFBIT_CS1 0x00000008
310 1.1 thorpej #define BONITO_IODEVCFG_SPEEDBIT_CS1 0x00000010
311 1.1 thorpej #define BONITO_IODEVCFG_MOREABITS_CS1 0x00000020
312 1.1 thorpej
313 1.1 thorpej #define BONITO_IODEVCFG_BUFFBIT_CS2 0x00000040
314 1.1 thorpej #define BONITO_IODEVCFG_SPEEDBIT_CS2 0x00000080
315 1.1 thorpej #define BONITO_IODEVCFG_MOREABITS_CS2 0x00000100
316 1.1 thorpej
317 1.1 thorpej #define BONITO_IODEVCFG_BUFFBIT_CS3 0x00000200
318 1.1 thorpej #define BONITO_IODEVCFG_SPEEDBIT_CS3 0x00000400
319 1.1 thorpej #define BONITO_IODEVCFG_MOREABITS_CS3 0x00000800
320 1.1 thorpej
321 1.1 thorpej #define BONITO_IODEVCFG_BUFFBIT_IDE 0x00001000
322 1.1 thorpej #define BONITO_IODEVCFG_SPEEDBIT_IDE 0x00002000
323 1.1 thorpej #define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
324 1.1 thorpej #define BONITO_IODEVCFG_MODEBIT_IDE 0x00008000
325 1.1 thorpej #define BONITO_IODEVCFG_DMAON_IDE 0x001f0000
326 1.1 thorpej #define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
327 1.1 thorpej #define BONITO_IODEVCFG_DMAOFF_IDE 0x01e00000
328 1.1 thorpej #define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT 21
329 1.5 simonb #define BONITO_IODEVCFG_EPROMSPLIT 0x02000000
330 1.5 simonb #define BONITO_IODEVCFG_CPUCLOCKPERIOD 0xfc000000
331 1.5 simonb #define BONITO_IODEVCFG_CPUCLOCKPERIOD_SHIFT 26
332 1.1 thorpej
333 1.1 thorpej /* gpio */
334 1.1 thorpej #define BONITO_GPIO_GPIOW 0x000003ff
335 1.1 thorpej #define BONITO_GPIO_GPIOW_SHIFT 0
336 1.1 thorpej #define BONITO_GPIO_GPIOR 0x01ff0000
337 1.1 thorpej #define BONITO_GPIO_GPIOR_SHIFT 16
338 1.1 thorpej #define BONITO_GPIO_GPINR 0xfe000000
339 1.1 thorpej #define BONITO_GPIO_GPINR_SHIFT 25
340 1.1 thorpej #define BONITO_GPIO_IOW(N) (1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
341 1.1 thorpej #define BONITO_GPIO_IOR(N) (1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
342 1.1 thorpej #define BONITO_GPIO_INR(N) (1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
343 1.1 thorpej
344 1.1 thorpej /* ICU */
345 1.1 thorpej #define BONITO_ICU_MBOXES 0x0000000f
346 1.1 thorpej #define BONITO_ICU_MBOXES_SHIFT 0
347 1.1 thorpej #define BONITO_ICU_DMARDY 0x00000010
348 1.1 thorpej #define BONITO_ICU_DMAEMPTY 0x00000020
349 1.1 thorpej #define BONITO_ICU_COPYRDY 0x00000040
350 1.1 thorpej #define BONITO_ICU_COPYEMPTY 0x00000080
351 1.1 thorpej #define BONITO_ICU_COPYERR 0x00000100
352 1.1 thorpej #define BONITO_ICU_PCIIRQ 0x00000200
353 1.1 thorpej #define BONITO_ICU_MASTERERR 0x00000400
354 1.1 thorpej #define BONITO_ICU_SYSTEMERR 0x00000800
355 1.1 thorpej #define BONITO_ICU_DRAMPERR 0x00001000
356 1.4 thorpej #define BONITO_ICU_RETRYERR 0x00002000
357 1.1 thorpej #define BONITO_ICU_GPIOS 0x01ff0000
358 1.1 thorpej #define BONITO_ICU_GPIOS_SHIFT 16
359 1.1 thorpej #define BONITO_ICU_GPINS 0x7e000000
360 1.1 thorpej #define BONITO_ICU_GPINS_SHIFT 25
361 1.1 thorpej #define BONITO_ICU_MBOX(N) (1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
362 1.1 thorpej #define BONITO_ICU_GPIO(N) (1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
363 1.1 thorpej #define BONITO_ICU_GPIN(N) (1<<(BONITO_ICU_GPINS_SHIFT+(N)))
364 1.1 thorpej
365 1.1 thorpej /* pcimap */
366 1.1 thorpej
367 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO0 0x0000003f
368 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO0_SHIFT 0
369 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO1 0x00000fc0
370 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO1_SHIFT 6
371 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO2 0x0003f000
372 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_LO2_SHIFT 12
373 1.1 thorpej #define BONITO_PCIMAP_PCIMAP_2 0x00040000
374 1.5 simonb #define BONITO_PCIMAP_WIN(WIN,ADDR) ((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
375 1.5 simonb
376 1.5 simonb #define BONITO_PCIMAP_WINSIZE (1<<26)
377 1.5 simonb #define BONITO_PCIMAP_WINOFFSET(ADDR) ((ADDR) & (BONITO_PCIMAP_WINSIZE - 1))
378 1.5 simonb #define BONITO_PCIMAP_WINBASE(ADDR) ((ADDR) << 26)
379 1.1 thorpej
380 1.1 thorpej /* pcimembaseCfg */
381 1.1 thorpej
382 1.5 simonb #define BONITO_PCIMEMBASECFG_MASK 0xf0000000
383 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK 0x0000001f
384 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT 0
385 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS 0x000003e0
386 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT 5
387 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED 0x00000400
388 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE0_IO 0x00000800
389 1.1 thorpej
390 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK 0x0001f000
391 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT 12
392 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS 0x003e0000
393 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT 17
394 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED 0x00400000
395 1.1 thorpej #define BONITO_PCIMEMBASECFG_MEMBASE1_IO 0x00800000
396 1.1 thorpej
397 1.1 thorpej #define BONITO_PCIMEMBASECFG_ASHIFT 23
398 1.5 simonb #define BONITO_PCIMEMBASECFG_AMASK 0x007fffff
399 1.1 thorpej #define BONITO_PCIMEMBASECFGSIZE(WIN,SIZE) (((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
400 1.1 thorpej #define BONITO_PCIMEMBASECFGBASE(WIN,BASE) (((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
401 1.2 thorpej
402 1.5 simonb #define BONITO_PCIMEMBASECFG_SIZE(WIN,CFG) (((((~(CFG)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)) << (BONITO_PCIMEMBASECFG_ASHIFT - BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) | BONITO_PCIMEMBASECFG_AMASK)
403 1.5 simonb
404 1.5 simonb #define BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
405 1.5 simonb #define BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
406 1.5 simonb #define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
407 1.5 simonb
408 1.5 simonb #define BONITO_PCITOPHYS(WIN,ADDR,CFG) ( \
409 1.5 simonb (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN,CFG)))) | \
410 1.5 simonb (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN,CFG)) \
411 1.5 simonb )
412 1.2 thorpej /* PCIMAP Cfg */
413 1.2 thorpej
414 1.5 simonb #define BONITO_PCIMAPCFG_TYPE1 0x00010000
415 1.1 thorpej
416 1.1 thorpej /* PCICmd */
417 1.1 thorpej
418 1.1 thorpej #define BONITO_PCICMD_MEMEN 0x00000002
419 1.1 thorpej #define BONITO_PCICMD_MSTREN 0x00000004
420 1.1 thorpej
421 1.1 thorpej
422 1.5 simonb #define BONITO_TIMERCFG BONITO(BONITO_REGBASE + 0x60)
423 1.7 bouyer
424 1.7 bouyer /*
425 1.7 bouyer * Bonito interrupt assignments
426 1.7 bouyer */
427 1.7 bouyer
428 1.7 bouyer /*
429 1.7 bouyer * Loongson 2F assignments
430 1.7 bouyer */
431 1.7 bouyer
432 1.7 bouyer #define LOONGSON_INTR_GPIO0 0
433 1.7 bouyer #define LOONGSON_INTR_GPIO1 1
434 1.7 bouyer #define LOONGSON_INTR_GPIO2 2
435 1.7 bouyer #define LOONGSON_INTR_GPIO3 3
436 1.7 bouyer
437 1.7 bouyer /* pci interrupts */
438 1.7 bouyer #define LOONGSON_INTR_PCIA 4
439 1.7 bouyer #define LOONGSON_INTR_PCIB 5
440 1.7 bouyer #define LOONGSON_INTR_PCIC 6
441 1.7 bouyer #define LOONGSON_INTR_PCID 7
442 1.7 bouyer
443 1.7 bouyer #define LOONGSON_INTR_PCI_PARERR 8
444 1.7 bouyer #define LOONGSON_INTR_PCI_SYSERR 9
445 1.7 bouyer #define LOONGSON_INTR_DRAM_PARERR 10
446 1.7 bouyer
447 1.7 bouyer /* non-PCI interrupts */
448 1.7 bouyer #define LOONGSON_INTR_INT0 11
449 1.7 bouyer #define LOONGSON_INTR_INT1 12
450 1.7 bouyer #define LOONGSON_INTR_INT2 13
451 1.7 bouyer #define LOONGSON_INTR_INT3 14
452 1.7 bouyer
453 1.7 bouyer #define LOONGSON_INTRMASK_GPIO0 0x00000001 /* can't interrupt */
454 1.7 bouyer #define LOONGSON_INTRMASK_GPIO1 0x00000002
455 1.7 bouyer #define LOONGSON_INTRMASK_GPIO2 0x00000004
456 1.7 bouyer #define LOONGSON_INTRMASK_GPIO3 0x00000008
457 1.7 bouyer
458 1.7 bouyer #define LOONGSON_INTRMASK_GPIO 0x0000000f
459 1.7 bouyer
460 1.7 bouyer /* pci interrupts */
461 1.7 bouyer #define LOONGSON_INTRMASK_PCIA 0x00000010
462 1.7 bouyer #define LOONGSON_INTRMASK_PCIB 0x00000020
463 1.7 bouyer #define LOONGSON_INTRMASK_PCIC 0x00000040
464 1.7 bouyer #define LOONGSON_INTRMASK_PCID 0x00000080
465 1.7 bouyer
466 1.7 bouyer #define LOONGSON_INTRMASK_PCI_PARERR 0x00000100
467 1.7 bouyer #define LOONGSON_INTRMASK_PCI_SYSERR 0x00000200
468 1.7 bouyer #define LOONGSON_INTRMASK_DRAM_PARERR 0x00000400
469 1.7 bouyer
470 1.7 bouyer /* non-PCI interrupts */
471 1.7 bouyer #define LOONGSON_INTRMASK_INT0 0x00000800
472 1.7 bouyer #define LOONGSON_INTRMASK_INT1 0x00001000
473 1.7 bouyer #define LOONGSON_INTRMASK_INT2 0x00002000
474 1.7 bouyer #define LOONGSON_INTRMASK_INT3 0x00004000
475 1.7 bouyer
476 1.7 bouyer #define LOONGSON_INTRMASK_LVL0 0x00007800 /* not maskable in bonito */
477 1.7 bouyer #define LOONGSON_INTRMASK_LVL4 0x000007ff
478 1.7 bouyer
479 1.7 bouyer /*
480 1.7 bouyer * Loongson 2E (Bonito64) assignments
481 1.7 bouyer */
482 1.7 bouyer
483 1.7 bouyer #define BONITO_INTRMASK_MBOX 0x0000000f
484 1.7 bouyer #define BONITO_INTR_MBOX 0
485 1.7 bouyer #define BONITO_INTRMASK_DMARDY 0x00000010
486 1.7 bouyer #define BONITO_INTRMASK_DMAEMPTY 0x00000020
487 1.7 bouyer #define BONITO_INTRMASK_COPYRDY 0x00000040
488 1.7 bouyer #define BONITO_INTRMASK_COPYEMPTY 0x00000080
489 1.7 bouyer #define BONITO_INTRMASK_COPYERR 0x00000100
490 1.7 bouyer #define BONITO_INTRMASK_PCIIRQ 0x00000200
491 1.7 bouyer #define BONITO_INTRMASK_MASTERERR 0x00000400
492 1.7 bouyer #define BONITO_INTRMASK_SYSTEMERR 0x00000800
493 1.7 bouyer #define BONITO_INTRMASK_DRAMPERR 0x00001000
494 1.7 bouyer #define BONITO_INTRMASK_RETRYERR 0x00002000
495 1.7 bouyer #define BONITO_INTRMASK_GPIO 0x01ff0000
496 1.7 bouyer #define BONITO_INTR_GPIO 16
497 1.7 bouyer #define BONITO_INTRMASK_GPIN 0x7e000000
498 1.7 bouyer #define BONITO_INTR_GPIN 25
499 1.7 bouyer
500 1.7 bouyer /*
501 1.7 bouyer * Bonito interrupt handling recipes:
502 1.7 bouyer * - we have up to 32 interrupts at the Bonito level.
503 1.7 bouyer * - systems with ISA devices also have 16 (well, 15) ISA interrupts with the
504 1.7 bouyer * usual 8259 pair. Bonito and ISA interrupts happen on two different levels.
505 1.7 bouyer *
506 1.7 bouyer * These arbitrary values may be changed as long as interrupt mask variables
507 1.7 bouyer * use large enough integer types and always use the following macros to
508 1.7 bouyer * handle interrupt masks.
509 1.7 bouyer */
510 1.7 bouyer
511 1.7 bouyer #define INTPRI_BONITO (INTPRI_CLOCK + 1)
512 1.7 bouyer #define INTPRI_ISA (INTPRI_BONITO + 1)
513 1.7 bouyer
514 1.7 bouyer #define BONITO_NDIRECT 32
515 1.7 bouyer #define BONITO_NISA 16
516 1.7 bouyer #define BONITO_NINTS (BONITO_NDIRECT + BONITO_NISA)
517 1.7 bouyer #define BONITO_ISA_IRQ(i) ((i) + BONITO_NDIRECT)
518 1.7 bouyer #define BONITO_DIRECT_IRQ(i) (i)
519 1.7 bouyer #define BONITO_IRQ_IS_ISA(i) ((i) >= BONITO_NDIRECT)
520 1.7 bouyer #define BONITO_IRQ_TO_ISA(i) ((i) - BONITO_NDIRECT)
521 1.7 bouyer
522 1.7 bouyer #define BONITO_DIRECT_MASK(imask) ((imask) & ((1L << BONITO_NDIRECT) - 1))
523 1.7 bouyer #define BONITO_ISA_MASK(imask) ((imask) >> BONITO_NDIRECT)
524 1.1 thorpej #endif /* _BONITO_H_ */
525