xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/mips-boards/bonito64.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Bonito Register Map
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * This file is the original bonito.h from Algorithmics with minor changes
5*4882a593Smuzhiyun  * to fit into linux.
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 1999 Algorithmics Ltd
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * Carsten Langgaard, carstenl@mips.com
10*4882a593Smuzhiyun  * Copyright (C) 2001 MIPS Technologies, Inc.  All rights reserved.
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Algorithmics gives permission for anyone to use and modify this file
13*4882a593Smuzhiyun  * without any obligation or license condition except that you retain
14*4882a593Smuzhiyun  * this copyright message in any source redistribution in whole or part.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun /* Revision 1.48 autogenerated on 08/17/99 15:20:01 */
19*4882a593Smuzhiyun /* This bonito64 version editted from bonito.h Revision 1.48 on 11/09/00 */
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun #ifndef _ASM_MIPS_BOARDS_BONITO64_H
22*4882a593Smuzhiyun #define _ASM_MIPS_BOARDS_BONITO64_H
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun #ifdef __ASSEMBLY__
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /* offsets from base register */
27*4882a593Smuzhiyun #define BONITO(x)	(x)
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun #else
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /*
32*4882a593Smuzhiyun  * Algorithmics Bonito64 system controller register base.
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun extern unsigned long _pcictrl_bonito;
35*4882a593Smuzhiyun extern unsigned long _pcictrl_bonito_pcicfg;
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #define BONITO(x)		*(volatile u32 *)(_pcictrl_bonito + (x))
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun #endif /* __ASSEMBLY__ */
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun #define BONITO_BOOT_BASE		0x1fc00000
43*4882a593Smuzhiyun #define BONITO_BOOT_SIZE		0x00100000
44*4882a593Smuzhiyun #define BONITO_BOOT_TOP			(BONITO_BOOT_BASE+BONITO_BOOT_SIZE-1)
45*4882a593Smuzhiyun #define BONITO_FLASH_BASE		0x1c000000
46*4882a593Smuzhiyun #define BONITO_FLASH_SIZE		0x03000000
47*4882a593Smuzhiyun #define BONITO_FLASH_TOP		(BONITO_FLASH_BASE+BONITO_FLASH_SIZE-1)
48*4882a593Smuzhiyun #define BONITO_SOCKET_BASE		0x1f800000
49*4882a593Smuzhiyun #define BONITO_SOCKET_SIZE		0x00400000
50*4882a593Smuzhiyun #define BONITO_SOCKET_TOP		(BONITO_SOCKET_BASE+BONITO_SOCKET_SIZE-1)
51*4882a593Smuzhiyun #define BONITO_REG_BASE			0x1fe00000
52*4882a593Smuzhiyun #define BONITO_REG_SIZE			0x00040000
53*4882a593Smuzhiyun #define BONITO_REG_TOP			(BONITO_REG_BASE+BONITO_REG_SIZE-1)
54*4882a593Smuzhiyun #define BONITO_DEV_BASE			0x1ff00000
55*4882a593Smuzhiyun #define BONITO_DEV_SIZE			0x00100000
56*4882a593Smuzhiyun #define BONITO_DEV_TOP			(BONITO_DEV_BASE+BONITO_DEV_SIZE-1)
57*4882a593Smuzhiyun #define BONITO_PCILO_BASE		0x10000000
58*4882a593Smuzhiyun #define BONITO_PCILO_SIZE		0x0c000000
59*4882a593Smuzhiyun #define BONITO_PCILO_TOP		(BONITO_PCILO_BASE+BONITO_PCILO_SIZE-1)
60*4882a593Smuzhiyun #define BONITO_PCILO0_BASE		0x10000000
61*4882a593Smuzhiyun #define BONITO_PCILO1_BASE		0x14000000
62*4882a593Smuzhiyun #define BONITO_PCILO2_BASE		0x18000000
63*4882a593Smuzhiyun #define BONITO_PCIHI_BASE		0x20000000
64*4882a593Smuzhiyun #define BONITO_PCIHI_SIZE		0x20000000
65*4882a593Smuzhiyun #define BONITO_PCIHI_TOP		(BONITO_PCIHI_BASE+BONITO_PCIHI_SIZE-1)
66*4882a593Smuzhiyun #define BONITO_PCIIO_BASE		0x1fd00000
67*4882a593Smuzhiyun #define BONITO_PCIIO_SIZE		0x00100000
68*4882a593Smuzhiyun #define BONITO_PCIIO_TOP		(BONITO_PCIIO_BASE+BONITO_PCIIO_SIZE-1)
69*4882a593Smuzhiyun #define BONITO_PCICFG_BASE		0x1fe80000
70*4882a593Smuzhiyun #define BONITO_PCICFG_SIZE		0x00080000
71*4882a593Smuzhiyun #define BONITO_PCICFG_TOP		(BONITO_PCICFG_BASE+BONITO_PCICFG_SIZE-1)
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun /* Bonito Register Bases */
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun #define BONITO_PCICONFIGBASE		0x00
77*4882a593Smuzhiyun #define BONITO_REGBASE			0x100
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /* PCI Configuration  Registers */
81*4882a593Smuzhiyun 
82*4882a593Smuzhiyun #define BONITO_PCI_REG(x)		BONITO(BONITO_PCICONFIGBASE + (x))
83*4882a593Smuzhiyun #define BONITO_PCIDID			BONITO_PCI_REG(0x00)
84*4882a593Smuzhiyun #define BONITO_PCICMD			BONITO_PCI_REG(0x04)
85*4882a593Smuzhiyun #define BONITO_PCICLASS			BONITO_PCI_REG(0x08)
86*4882a593Smuzhiyun #define BONITO_PCILTIMER		BONITO_PCI_REG(0x0c)
87*4882a593Smuzhiyun #define BONITO_PCIBASE0			BONITO_PCI_REG(0x10)
88*4882a593Smuzhiyun #define BONITO_PCIBASE1			BONITO_PCI_REG(0x14)
89*4882a593Smuzhiyun #define BONITO_PCIBASE2			BONITO_PCI_REG(0x18)
90*4882a593Smuzhiyun #define BONITO_PCIEXPRBASE		BONITO_PCI_REG(0x30)
91*4882a593Smuzhiyun #define BONITO_PCIINT			BONITO_PCI_REG(0x3c)
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun #define BONITO_PCICMD_PERR_CLR		0x80000000
94*4882a593Smuzhiyun #define BONITO_PCICMD_SERR_CLR		0x40000000
95*4882a593Smuzhiyun #define BONITO_PCICMD_MABORT_CLR	0x20000000
96*4882a593Smuzhiyun #define BONITO_PCICMD_MTABORT_CLR	0x10000000
97*4882a593Smuzhiyun #define BONITO_PCICMD_TABORT_CLR	0x08000000
98*4882a593Smuzhiyun #define BONITO_PCICMD_MPERR_CLR		0x01000000
99*4882a593Smuzhiyun #define BONITO_PCICMD_PERRRESPEN	0x00000040
100*4882a593Smuzhiyun #define BONITO_PCICMD_ASTEPEN		0x00000080
101*4882a593Smuzhiyun #define BONITO_PCICMD_SERREN		0x00000100
102*4882a593Smuzhiyun #define BONITO_PCILTIMER_BUSLATENCY	0x0000ff00
103*4882a593Smuzhiyun #define BONITO_PCILTIMER_BUSLATENCY_SHIFT	8
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun /* 1. Bonito h/w Configuration */
109*4882a593Smuzhiyun /* Power on register */
110*4882a593Smuzhiyun 
111*4882a593Smuzhiyun #define BONITO_BONPONCFG		BONITO(BONITO_REGBASE + 0x00)
112*4882a593Smuzhiyun 
113*4882a593Smuzhiyun #define BONITO_BONPONCFG_SYSCONTROLLERRD	0x00040000
114*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS1SAMP	0x00020000
115*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS0SAMP	0x00010000
116*4882a593Smuzhiyun #define BONITO_BONPONCFG_CPUBIGEND	0x00004000
117*4882a593Smuzhiyun /* Added by RPF 11-9-00 */
118*4882a593Smuzhiyun #define BONITO_BONPONCFG_BURSTORDER	0x00001000
119*4882a593Smuzhiyun /* --- */
120*4882a593Smuzhiyun #define BONITO_BONPONCFG_CPUPARITY	0x00002000
121*4882a593Smuzhiyun #define BONITO_BONPONCFG_CPUTYPE	0x00000007
122*4882a593Smuzhiyun #define BONITO_BONPONCFG_CPUTYPE_SHIFT	0
123*4882a593Smuzhiyun #define BONITO_BONPONCFG_PCIRESET_OUT	0x00000008
124*4882a593Smuzhiyun #define BONITO_BONPONCFG_IS_ARBITER	0x00000010
125*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT	0x000000c0
126*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT_SHIFT	6
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT_FLASH	(0x0<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
129*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT_SOCKET (0x1<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
130*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT_SDRAM	(0x2<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
131*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMBOOT_CPURESET	(0x3<<BONITO_BONPONCFG_ROMBOOT_SHIFT)
132*4882a593Smuzhiyun 
133*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS0WIDTH	0x00000100
134*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS1WIDTH	0x00000200
135*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS0FAST	0x00000400
136*4882a593Smuzhiyun #define BONITO_BONPONCFG_ROMCS1FAST	0x00000800
137*4882a593Smuzhiyun #define BONITO_BONPONCFG_CONFIG_DIS	0x00000020
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun 
140*4882a593Smuzhiyun /* Other Bonito configuration */
141*4882a593Smuzhiyun 
142*4882a593Smuzhiyun #define BONITO_BONGENCFG_OFFSET		0x4
143*4882a593Smuzhiyun #define BONITO_BONGENCFG		BONITO(BONITO_REGBASE + BONITO_BONGENCFG_OFFSET)
144*4882a593Smuzhiyun 
145*4882a593Smuzhiyun #define BONITO_BONGENCFG_DEBUGMODE	0x00000001
146*4882a593Smuzhiyun #define BONITO_BONGENCFG_SNOOPEN	0x00000002
147*4882a593Smuzhiyun #define BONITO_BONGENCFG_CPUSELFRESET	0x00000004
148*4882a593Smuzhiyun 
149*4882a593Smuzhiyun #define BONITO_BONGENCFG_FORCE_IRQA	0x00000008
150*4882a593Smuzhiyun #define BONITO_BONGENCFG_IRQA_ISOUT	0x00000010
151*4882a593Smuzhiyun #define BONITO_BONGENCFG_IRQA_FROM_INT1 0x00000020
152*4882a593Smuzhiyun #define BONITO_BONGENCFG_BYTESWAP	0x00000040
153*4882a593Smuzhiyun 
154*4882a593Smuzhiyun #define BONITO_BONGENCFG_UNCACHED	0x00000080
155*4882a593Smuzhiyun #define BONITO_BONGENCFG_PREFETCHEN	0x00000100
156*4882a593Smuzhiyun #define BONITO_BONGENCFG_WBEHINDEN	0x00000200
157*4882a593Smuzhiyun #define BONITO_BONGENCFG_CACHEALG	0x00000c00
158*4882a593Smuzhiyun #define BONITO_BONGENCFG_CACHEALG_SHIFT 10
159*4882a593Smuzhiyun #define BONITO_BONGENCFG_PCIQUEUE	0x00001000
160*4882a593Smuzhiyun #define BONITO_BONGENCFG_CACHESTOP	0x00002000
161*4882a593Smuzhiyun #define BONITO_BONGENCFG_MSTRBYTESWAP	0x00004000
162*4882a593Smuzhiyun #define BONITO_BONGENCFG_BUSERREN	0x00008000
163*4882a593Smuzhiyun #define BONITO_BONGENCFG_NORETRYTIMEOUT 0x00010000
164*4882a593Smuzhiyun #define BONITO_BONGENCFG_SHORTCOPYTIMEOUT	0x00020000
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun /* 2. IO & IDE configuration */
167*4882a593Smuzhiyun 
168*4882a593Smuzhiyun #define BONITO_IODEVCFG			BONITO(BONITO_REGBASE + 0x08)
169*4882a593Smuzhiyun 
170*4882a593Smuzhiyun /* 3. IO & IDE configuration */
171*4882a593Smuzhiyun 
172*4882a593Smuzhiyun #define BONITO_SDCFG			BONITO(BONITO_REGBASE + 0x0c)
173*4882a593Smuzhiyun 
174*4882a593Smuzhiyun /* 4. PCI address map control */
175*4882a593Smuzhiyun 
176*4882a593Smuzhiyun #define BONITO_PCIMAP			BONITO(BONITO_REGBASE + 0x10)
177*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG		BONITO(BONITO_REGBASE + 0x14)
178*4882a593Smuzhiyun #define BONITO_PCIMAP_CFG		BONITO(BONITO_REGBASE + 0x18)
179*4882a593Smuzhiyun 
180*4882a593Smuzhiyun /* 5. ICU & GPIO regs */
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun /* GPIO Regs - r/w */
183*4882a593Smuzhiyun 
184*4882a593Smuzhiyun #define BONITO_GPIODATA_OFFSET		0x1c
185*4882a593Smuzhiyun #define BONITO_GPIODATA			BONITO(BONITO_REGBASE + BONITO_GPIODATA_OFFSET)
186*4882a593Smuzhiyun #define BONITO_GPIOIE			BONITO(BONITO_REGBASE + 0x20)
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun /* ICU Configuration Regs - r/w */
189*4882a593Smuzhiyun 
190*4882a593Smuzhiyun #define BONITO_INTEDGE			BONITO(BONITO_REGBASE + 0x24)
191*4882a593Smuzhiyun #define BONITO_INTSTEER			BONITO(BONITO_REGBASE + 0x28)
192*4882a593Smuzhiyun #define BONITO_INTPOL			BONITO(BONITO_REGBASE + 0x2c)
193*4882a593Smuzhiyun 
194*4882a593Smuzhiyun /* ICU Enable Regs - IntEn & IntISR are r/o. */
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun #define BONITO_INTENSET			BONITO(BONITO_REGBASE + 0x30)
197*4882a593Smuzhiyun #define BONITO_INTENCLR			BONITO(BONITO_REGBASE + 0x34)
198*4882a593Smuzhiyun #define BONITO_INTEN			BONITO(BONITO_REGBASE + 0x38)
199*4882a593Smuzhiyun #define BONITO_INTISR			BONITO(BONITO_REGBASE + 0x3c)
200*4882a593Smuzhiyun 
201*4882a593Smuzhiyun /* PCI mail boxes */
202*4882a593Smuzhiyun 
203*4882a593Smuzhiyun #define BONITO_PCIMAIL0_OFFSET		0x40
204*4882a593Smuzhiyun #define BONITO_PCIMAIL1_OFFSET		0x44
205*4882a593Smuzhiyun #define BONITO_PCIMAIL2_OFFSET		0x48
206*4882a593Smuzhiyun #define BONITO_PCIMAIL3_OFFSET		0x4c
207*4882a593Smuzhiyun #define BONITO_PCIMAIL0			BONITO(BONITO_REGBASE + 0x40)
208*4882a593Smuzhiyun #define BONITO_PCIMAIL1			BONITO(BONITO_REGBASE + 0x44)
209*4882a593Smuzhiyun #define BONITO_PCIMAIL2			BONITO(BONITO_REGBASE + 0x48)
210*4882a593Smuzhiyun #define BONITO_PCIMAIL3			BONITO(BONITO_REGBASE + 0x4c)
211*4882a593Smuzhiyun 
212*4882a593Smuzhiyun 
213*4882a593Smuzhiyun /* 6. PCI cache */
214*4882a593Smuzhiyun 
215*4882a593Smuzhiyun #define BONITO_PCICACHECTRL		BONITO(BONITO_REGBASE + 0x50)
216*4882a593Smuzhiyun #define BONITO_PCICACHETAG		BONITO(BONITO_REGBASE + 0x54)
217*4882a593Smuzhiyun 
218*4882a593Smuzhiyun #define BONITO_PCIBADADDR		BONITO(BONITO_REGBASE + 0x58)
219*4882a593Smuzhiyun #define BONITO_PCIMSTAT			BONITO(BONITO_REGBASE + 0x5c)
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun 
222*4882a593Smuzhiyun /*
223*4882a593Smuzhiyun #define BONITO_PCIRDPOST		BONITO(BONITO_REGBASE + 0x60)
224*4882a593Smuzhiyun #define BONITO_PCIDATA			BONITO(BONITO_REGBASE + 0x64)
225*4882a593Smuzhiyun */
226*4882a593Smuzhiyun 
227*4882a593Smuzhiyun /* 7. IDE DMA & Copier */
228*4882a593Smuzhiyun 
229*4882a593Smuzhiyun #define BONITO_CONFIGBASE		0x000
230*4882a593Smuzhiyun #define BONITO_BONITOBASE		0x100
231*4882a593Smuzhiyun #define BONITO_LDMABASE			0x200
232*4882a593Smuzhiyun #define BONITO_COPBASE			0x300
233*4882a593Smuzhiyun #define BONITO_REG_BLOCKMASK		0x300
234*4882a593Smuzhiyun 
235*4882a593Smuzhiyun #define BONITO_LDMACTRL			BONITO(BONITO_LDMABASE + 0x0)
236*4882a593Smuzhiyun #define BONITO_LDMASTAT			BONITO(BONITO_LDMABASE + 0x0)
237*4882a593Smuzhiyun #define BONITO_LDMAADDR			BONITO(BONITO_LDMABASE + 0x4)
238*4882a593Smuzhiyun #define BONITO_LDMAGO			BONITO(BONITO_LDMABASE + 0x8)
239*4882a593Smuzhiyun #define BONITO_LDMADATA			BONITO(BONITO_LDMABASE + 0xc)
240*4882a593Smuzhiyun 
241*4882a593Smuzhiyun #define BONITO_COPCTRL			BONITO(BONITO_COPBASE + 0x0)
242*4882a593Smuzhiyun #define BONITO_COPSTAT			BONITO(BONITO_COPBASE + 0x0)
243*4882a593Smuzhiyun #define BONITO_COPPADDR			BONITO(BONITO_COPBASE + 0x4)
244*4882a593Smuzhiyun #define BONITO_COPDADDR			BONITO(BONITO_COPBASE + 0x8)
245*4882a593Smuzhiyun #define BONITO_COPGO			BONITO(BONITO_COPBASE + 0xc)
246*4882a593Smuzhiyun 
247*4882a593Smuzhiyun 
248*4882a593Smuzhiyun /* ###### Bit Definitions for individual Registers #### */
249*4882a593Smuzhiyun 
250*4882a593Smuzhiyun /* Gen DMA. */
251*4882a593Smuzhiyun 
252*4882a593Smuzhiyun #define BONITO_IDECOPDADDR_DMA_DADDR	0x0ffffffc
253*4882a593Smuzhiyun #define BONITO_IDECOPDADDR_DMA_DADDR_SHIFT	2
254*4882a593Smuzhiyun #define BONITO_IDECOPPADDR_DMA_PADDR	0xfffffffc
255*4882a593Smuzhiyun #define BONITO_IDECOPPADDR_DMA_PADDR_SHIFT	2
256*4882a593Smuzhiyun #define BONITO_IDECOPGO_DMA_SIZE	0x0000fffe
257*4882a593Smuzhiyun #define BONITO_IDECOPGO_DMA_SIZE_SHIFT	0
258*4882a593Smuzhiyun #define BONITO_IDECOPGO_DMA_WRITE	0x00010000
259*4882a593Smuzhiyun #define BONITO_IDECOPGO_DMAWCOUNT	0x000f0000
260*4882a593Smuzhiyun #define BONITO_IDECOPGO_DMAWCOUNT_SHIFT 16
261*4882a593Smuzhiyun 
262*4882a593Smuzhiyun #define BONITO_IDECOPCTRL_DMA_STARTBIT	0x80000000
263*4882a593Smuzhiyun #define BONITO_IDECOPCTRL_DMA_RSTBIT	0x40000000
264*4882a593Smuzhiyun 
265*4882a593Smuzhiyun /* DRAM - sdCfg */
266*4882a593Smuzhiyun 
267*4882a593Smuzhiyun #define BONITO_SDCFG_AROWBITS		0x00000003
268*4882a593Smuzhiyun #define BONITO_SDCFG_AROWBITS_SHIFT	0
269*4882a593Smuzhiyun #define BONITO_SDCFG_ACOLBITS		0x0000000c
270*4882a593Smuzhiyun #define BONITO_SDCFG_ACOLBITS_SHIFT	2
271*4882a593Smuzhiyun #define BONITO_SDCFG_ABANKBIT		0x00000010
272*4882a593Smuzhiyun #define BONITO_SDCFG_ASIDES		0x00000020
273*4882a593Smuzhiyun #define BONITO_SDCFG_AABSENT		0x00000040
274*4882a593Smuzhiyun #define BONITO_SDCFG_AWIDTH64		0x00000080
275*4882a593Smuzhiyun 
276*4882a593Smuzhiyun #define BONITO_SDCFG_BROWBITS		0x00000300
277*4882a593Smuzhiyun #define BONITO_SDCFG_BROWBITS_SHIFT	8
278*4882a593Smuzhiyun #define BONITO_SDCFG_BCOLBITS		0x00000c00
279*4882a593Smuzhiyun #define BONITO_SDCFG_BCOLBITS_SHIFT	10
280*4882a593Smuzhiyun #define BONITO_SDCFG_BBANKBIT		0x00001000
281*4882a593Smuzhiyun #define BONITO_SDCFG_BSIDES		0x00002000
282*4882a593Smuzhiyun #define BONITO_SDCFG_BABSENT		0x00004000
283*4882a593Smuzhiyun #define BONITO_SDCFG_BWIDTH64		0x00008000
284*4882a593Smuzhiyun 
285*4882a593Smuzhiyun #define BONITO_SDCFG_EXTRDDATA		0x00010000
286*4882a593Smuzhiyun #define BONITO_SDCFG_EXTRASCAS		0x00020000
287*4882a593Smuzhiyun #define BONITO_SDCFG_EXTPRECH		0x00040000
288*4882a593Smuzhiyun #define BONITO_SDCFG_EXTRASWIDTH	0x00180000
289*4882a593Smuzhiyun #define BONITO_SDCFG_EXTRASWIDTH_SHIFT	19
290*4882a593Smuzhiyun /* Changed by RPF 11-9-00 */
291*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMMODESET	0x00200000
292*4882a593Smuzhiyun /* --- */
293*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMEXTREGS	0x00400000
294*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMPARITY		0x00800000
295*4882a593Smuzhiyun /* Added by RPF 11-9-00 */
296*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMBURSTLEN	0x03000000
297*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMBURSTLEN_SHIFT 24
298*4882a593Smuzhiyun #define BONITO_SDCFG_DRAMMODESET_DONE	0x80000000
299*4882a593Smuzhiyun /* --- */
300*4882a593Smuzhiyun 
301*4882a593Smuzhiyun /* PCI Cache - pciCacheCtrl */
302*4882a593Smuzhiyun 
303*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CACHECMD	0x00000007
304*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CACHECMD_SHIFT	0
305*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CACHECMDLINE	0x00000018
306*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CACHECMDLINE_SHIFT	3
307*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CMDEXEC	0x00000020
308*4882a593Smuzhiyun 
309*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_IOBCCOH_PRES	0x00000100
310*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_IOBCCOH_EN	0x00000200
311*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CPUCOH_PRES 0x00000400
312*4882a593Smuzhiyun #define BONITO_PCICACHECTRL_CPUCOH_EN	0x00000800
313*4882a593Smuzhiyun 
314*4882a593Smuzhiyun #define BONITO_IODEVCFG_BUFFBIT_CS0	0x00000001
315*4882a593Smuzhiyun #define BONITO_IODEVCFG_SPEEDBIT_CS0	0x00000002
316*4882a593Smuzhiyun #define BONITO_IODEVCFG_MOREABITS_CS0	0x00000004
317*4882a593Smuzhiyun 
318*4882a593Smuzhiyun #define BONITO_IODEVCFG_BUFFBIT_CS1	0x00000008
319*4882a593Smuzhiyun #define BONITO_IODEVCFG_SPEEDBIT_CS1	0x00000010
320*4882a593Smuzhiyun #define BONITO_IODEVCFG_MOREABITS_CS1	0x00000020
321*4882a593Smuzhiyun 
322*4882a593Smuzhiyun #define BONITO_IODEVCFG_BUFFBIT_CS2	0x00000040
323*4882a593Smuzhiyun #define BONITO_IODEVCFG_SPEEDBIT_CS2	0x00000080
324*4882a593Smuzhiyun #define BONITO_IODEVCFG_MOREABITS_CS2	0x00000100
325*4882a593Smuzhiyun 
326*4882a593Smuzhiyun #define BONITO_IODEVCFG_BUFFBIT_CS3	0x00000200
327*4882a593Smuzhiyun #define BONITO_IODEVCFG_SPEEDBIT_CS3	0x00000400
328*4882a593Smuzhiyun #define BONITO_IODEVCFG_MOREABITS_CS3	0x00000800
329*4882a593Smuzhiyun 
330*4882a593Smuzhiyun #define BONITO_IODEVCFG_BUFFBIT_IDE	0x00001000
331*4882a593Smuzhiyun #define BONITO_IODEVCFG_SPEEDBIT_IDE	0x00002000
332*4882a593Smuzhiyun #define BONITO_IODEVCFG_WORDSWAPBIT_IDE 0x00004000
333*4882a593Smuzhiyun #define BONITO_IODEVCFG_MODEBIT_IDE	0x00008000
334*4882a593Smuzhiyun #define BONITO_IODEVCFG_DMAON_IDE	0x001f0000
335*4882a593Smuzhiyun #define BONITO_IODEVCFG_DMAON_IDE_SHIFT 16
336*4882a593Smuzhiyun #define BONITO_IODEVCFG_DMAOFF_IDE	0x01e00000
337*4882a593Smuzhiyun #define BONITO_IODEVCFG_DMAOFF_IDE_SHIFT	21
338*4882a593Smuzhiyun #define BONITO_IODEVCFG_EPROMSPLIT	0x02000000
339*4882a593Smuzhiyun /* Added by RPF 11-9-00 */
340*4882a593Smuzhiyun #define BONITO_IODEVCFG_CPUCLOCKPERIOD	0xfc000000
341*4882a593Smuzhiyun #define BONITO_IODEVCFG_CPUCLOCKPERIOD_SHIFT 26
342*4882a593Smuzhiyun /* --- */
343*4882a593Smuzhiyun 
344*4882a593Smuzhiyun /* gpio */
345*4882a593Smuzhiyun #define BONITO_GPIO_GPIOW		0x000003ff
346*4882a593Smuzhiyun #define BONITO_GPIO_GPIOW_SHIFT		0
347*4882a593Smuzhiyun #define BONITO_GPIO_GPIOR		0x01ff0000
348*4882a593Smuzhiyun #define BONITO_GPIO_GPIOR_SHIFT		16
349*4882a593Smuzhiyun #define BONITO_GPIO_GPINR		0xfe000000
350*4882a593Smuzhiyun #define BONITO_GPIO_GPINR_SHIFT		25
351*4882a593Smuzhiyun #define BONITO_GPIO_IOW(N)		(1<<(BONITO_GPIO_GPIOW_SHIFT+(N)))
352*4882a593Smuzhiyun #define BONITO_GPIO_IOR(N)		(1<<(BONITO_GPIO_GPIOR_SHIFT+(N)))
353*4882a593Smuzhiyun #define BONITO_GPIO_INR(N)		(1<<(BONITO_GPIO_GPINR_SHIFT+(N)))
354*4882a593Smuzhiyun 
355*4882a593Smuzhiyun /* ICU */
356*4882a593Smuzhiyun #define BONITO_ICU_MBOXES		0x0000000f
357*4882a593Smuzhiyun #define BONITO_ICU_MBOXES_SHIFT		0
358*4882a593Smuzhiyun #define BONITO_ICU_DMARDY		0x00000010
359*4882a593Smuzhiyun #define BONITO_ICU_DMAEMPTY		0x00000020
360*4882a593Smuzhiyun #define BONITO_ICU_COPYRDY		0x00000040
361*4882a593Smuzhiyun #define BONITO_ICU_COPYEMPTY		0x00000080
362*4882a593Smuzhiyun #define BONITO_ICU_COPYERR		0x00000100
363*4882a593Smuzhiyun #define BONITO_ICU_PCIIRQ		0x00000200
364*4882a593Smuzhiyun #define BONITO_ICU_MASTERERR		0x00000400
365*4882a593Smuzhiyun #define BONITO_ICU_SYSTEMERR		0x00000800
366*4882a593Smuzhiyun #define BONITO_ICU_DRAMPERR		0x00001000
367*4882a593Smuzhiyun #define BONITO_ICU_RETRYERR		0x00002000
368*4882a593Smuzhiyun #define BONITO_ICU_GPIOS		0x01ff0000
369*4882a593Smuzhiyun #define BONITO_ICU_GPIOS_SHIFT		16
370*4882a593Smuzhiyun #define BONITO_ICU_GPINS		0x7e000000
371*4882a593Smuzhiyun #define BONITO_ICU_GPINS_SHIFT		25
372*4882a593Smuzhiyun #define BONITO_ICU_MBOX(N)		(1<<(BONITO_ICU_MBOXES_SHIFT+(N)))
373*4882a593Smuzhiyun #define BONITO_ICU_GPIO(N)		(1<<(BONITO_ICU_GPIOS_SHIFT+(N)))
374*4882a593Smuzhiyun #define BONITO_ICU_GPIN(N)		(1<<(BONITO_ICU_GPINS_SHIFT+(N)))
375*4882a593Smuzhiyun 
376*4882a593Smuzhiyun /* pcimap */
377*4882a593Smuzhiyun 
378*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO0	0x0000003f
379*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO0_SHIFT	0
380*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO1	0x00000fc0
381*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO1_SHIFT	6
382*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO2	0x0003f000
383*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_LO2_SHIFT	12
384*4882a593Smuzhiyun #define BONITO_PCIMAP_PCIMAP_2		0x00040000
385*4882a593Smuzhiyun #define BONITO_PCIMAP_WIN(WIN, ADDR)	((((ADDR)>>26) & BONITO_PCIMAP_PCIMAP_LO0) << ((WIN)*6))
386*4882a593Smuzhiyun 
387*4882a593Smuzhiyun #define BONITO_PCIMAP_WINSIZE		(1<<26)
388*4882a593Smuzhiyun #define BONITO_PCIMAP_WINOFFSET(ADDR)	((ADDR) & (BONITO_PCIMAP_WINSIZE - 1))
389*4882a593Smuzhiyun #define BONITO_PCIMAP_WINBASE(ADDR)	((ADDR) << 26)
390*4882a593Smuzhiyun 
391*4882a593Smuzhiyun /* pcimembaseCfg */
392*4882a593Smuzhiyun 
393*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MASK		0xf0000000
394*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK	0x0000001f
395*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_MASK_SHIFT	0
396*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS	0x000003e0
397*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_TRANS_SHIFT	5
398*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_CACHED	0x00000400
399*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE0_IO	0x00000800
400*4882a593Smuzhiyun 
401*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK	0x0001f000
402*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_MASK_SHIFT	12
403*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS	0x003e0000
404*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_TRANS_SHIFT	17
405*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_CACHED	0x00400000
406*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_MEMBASE1_IO	0x00800000
407*4882a593Smuzhiyun 
408*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_ASHIFT	23
409*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_AMASK		0x007fffff
410*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFGSIZE(WIN, SIZE)	(((~((SIZE)-1))>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)
411*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFGBASE(WIN, BASE)	(((BASE)>>(BONITO_PCIMEMBASECFG_ASHIFT-BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS)
412*4882a593Smuzhiyun 
413*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_SIZE(WIN, CFG)  (((((~(CFG)) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK)) << (BONITO_PCIMEMBASECFG_ASHIFT - BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT)) | BONITO_PCIMEMBASECFG_AMASK)
414*4882a593Smuzhiyun 
415*4882a593Smuzhiyun 
416*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG)	 ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_MASK_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
417*4882a593Smuzhiyun #define BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG) ((((CFG) & BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS) >> BONITO_PCIMEMBASECFG_MEMBASE##WIN##_TRANS_SHIFT) << BONITO_PCIMEMBASECFG_ASHIFT)
418*4882a593Smuzhiyun 
419*4882a593Smuzhiyun #define BONITO_PCITOPHYS(WIN, ADDR, CFG)	  ( \
420*4882a593Smuzhiyun 						  (((ADDR) & (~(BONITO_PCIMEMBASECFG_MASK))) & (~(BONITO_PCIMEMBASECFG_ADDRMASK(WIN, CFG)))) | \
421*4882a593Smuzhiyun 						  (BONITO_PCIMEMBASECFG_ADDRTRANS(WIN, CFG)) \
422*4882a593Smuzhiyun 						)
423*4882a593Smuzhiyun 
424*4882a593Smuzhiyun /* PCICmd */
425*4882a593Smuzhiyun 
426*4882a593Smuzhiyun #define BONITO_PCICMD_MEMEN		0x00000002
427*4882a593Smuzhiyun #define BONITO_PCICMD_MSTREN		0x00000004
428*4882a593Smuzhiyun 
429*4882a593Smuzhiyun 
430*4882a593Smuzhiyun #endif /* _ASM_MIPS_BOARDS_BONITO64_H */
431