xref: /haiku/src/add-ons/kernel/bus_managers/firewire/fwohcireg.h (revision 438d564c08e497713fe5c396b920c341ef7e82d2)
1bb5ea4ebSJérôme Duval /*-
2bb5ea4ebSJérôme Duval  * Copyright (c) 2003 Hidetoshi Shimokawa
3bb5ea4ebSJérôme Duval  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
4bb5ea4ebSJérôme Duval  * All rights reserved.
5bb5ea4ebSJérôme Duval  *
6bb5ea4ebSJérôme Duval  * Redistribution and use in source and binary forms, with or without
7bb5ea4ebSJérôme Duval  * modification, are permitted provided that the following conditions
8bb5ea4ebSJérôme Duval  * are met:
9bb5ea4ebSJérôme Duval  * 1. Redistributions of source code must retain the above copyright
10bb5ea4ebSJérôme Duval  *    notice, this list of conditions and the following disclaimer.
11bb5ea4ebSJérôme Duval  * 2. Redistributions in binary form must reproduce the above copyright
12bb5ea4ebSJérôme Duval  *    notice, this list of conditions and the following disclaimer in the
13bb5ea4ebSJérôme Duval  *    documentation and/or other materials provided with the distribution.
14bb5ea4ebSJérôme Duval  * 3. All advertising materials mentioning features or use of this software
15bb5ea4ebSJérôme Duval  *    must display the acknowledgement as bellow:
16bb5ea4ebSJérôme Duval  *
17bb5ea4ebSJérôme Duval  *    This product includes software developed by K. Kobayashi and H. Shimokawa
18bb5ea4ebSJérôme Duval  *
19bb5ea4ebSJérôme Duval  * 4. The name of the author may not be used to endorse or promote products
20bb5ea4ebSJérôme Duval  *    derived from this software without specific prior written permission.
21bb5ea4ebSJérôme Duval  *
22bb5ea4ebSJérôme Duval  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23bb5ea4ebSJérôme Duval  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24bb5ea4ebSJérôme Duval  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25bb5ea4ebSJérôme Duval  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26bb5ea4ebSJérôme Duval  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27bb5ea4ebSJérôme Duval  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28bb5ea4ebSJérôme Duval  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29bb5ea4ebSJérôme Duval  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30bb5ea4ebSJérôme Duval  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31bb5ea4ebSJérôme Duval  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32bb5ea4ebSJérôme Duval  * POSSIBILITY OF SUCH DAMAGE.
33bb5ea4ebSJérôme Duval  *
34bb5ea4ebSJérôme Duval  * $FreeBSD: src/sys/dev/firewire/fwohcireg.h,v 1.23 2007/04/30 14:06:30 simokawa Exp $
35bb5ea4ebSJérôme Duval  *
36bb5ea4ebSJérôme Duval  */
37bb5ea4ebSJérôme Duval #define		PCI_CBMEM		PCIR_BAR(0)
38bb5ea4ebSJérôme Duval 
39*438d564cSPulkoMandy #define		FW_VENDORID_NATSEMI	0x100Bu
40*438d564cSPulkoMandy #define		FW_VENDORID_NEC		0x1033u
41*438d564cSPulkoMandy #define		FW_VENDORID_SIS		0x1039u
42*438d564cSPulkoMandy #define		FW_VENDORID_TI		0x104cu
43*438d564cSPulkoMandy #define		FW_VENDORID_SONY	0x104du
44*438d564cSPulkoMandy #define		FW_VENDORID_VIA		0x1106u
45*438d564cSPulkoMandy #define		FW_VENDORID_RICOH	0x1180u
46*438d564cSPulkoMandy #define		FW_VENDORID_APPLE	0x106bu
47*438d564cSPulkoMandy #define		FW_VENDORID_LUCENT	0x11c1u
48*438d564cSPulkoMandy #define		FW_VENDORID_INTEL	0x8086u
49*438d564cSPulkoMandy #define		FW_VENDORID_ADAPTEC	0x9004u
50*438d564cSPulkoMandy #define		FW_VENDORID_SUN		0x108eu
51bb5ea4ebSJérôme Duval 
52*438d564cSPulkoMandy #define		FW_DEVICE_CS4210	(0x000fu << 16)
53*438d564cSPulkoMandy #define		FW_DEVICE_UPD861	(0x0063u << 16)
54*438d564cSPulkoMandy #define		FW_DEVICE_UPD871	(0x00ceu << 16)
55*438d564cSPulkoMandy #define		FW_DEVICE_UPD72870	(0x00cdu << 16)
56*438d564cSPulkoMandy #define		FW_DEVICE_UPD72873	(0x00e7u << 16)
57*438d564cSPulkoMandy #define		FW_DEVICE_UPD72874	(0x00f2u << 16)
58*438d564cSPulkoMandy #define		FW_DEVICE_TITSB22	(0x8009u << 16)
59*438d564cSPulkoMandy #define		FW_DEVICE_TITSB23	(0x8019u << 16)
60*438d564cSPulkoMandy #define		FW_DEVICE_TITSB26	(0x8020u << 16)
61*438d564cSPulkoMandy #define		FW_DEVICE_TITSB43	(0x8021u << 16)
62*438d564cSPulkoMandy #define		FW_DEVICE_TITSB43A	(0x8023u << 16)
63*438d564cSPulkoMandy #define		FW_DEVICE_TITSB43AB23	(0x8024u << 16)
64*438d564cSPulkoMandy #define		FW_DEVICE_TITSB82AA2	(0x8025u << 16)
65*438d564cSPulkoMandy #define		FW_DEVICE_TITSB43AB21	(0x8026u << 16)
66*438d564cSPulkoMandy #define		FW_DEVICE_TIPCI4410A	(0x8017u << 16)
67*438d564cSPulkoMandy #define		FW_DEVICE_TIPCI4450	(0x8011u << 16)
68*438d564cSPulkoMandy #define		FW_DEVICE_TIPCI4451	(0x8027u << 16)
69*438d564cSPulkoMandy #define		FW_DEVICE_CXD1947	(0x8009u << 16)
70*438d564cSPulkoMandy #define		FW_DEVICE_CXD3222	(0x8039u << 16)
71*438d564cSPulkoMandy #define		FW_DEVICE_VT6306	(0x3044u << 16)
72*438d564cSPulkoMandy #define		FW_DEVICE_R5C551	(0x0551u << 16)
73*438d564cSPulkoMandy #define		FW_DEVICE_R5C552	(0x0552u << 16)
74*438d564cSPulkoMandy #define		FW_DEVICE_PANGEA	(0x0030u << 16)
75*438d564cSPulkoMandy #define		FW_DEVICE_UNINORTH	(0x0031u << 16)
76*438d564cSPulkoMandy #define		FW_DEVICE_AIC5800	(0x5800u << 16)
77*438d564cSPulkoMandy #define		FW_DEVICE_FW322		(0x5811u << 16)
78*438d564cSPulkoMandy #define		FW_DEVICE_7007		(0x7007u << 16)
79*438d564cSPulkoMandy #define		FW_DEVICE_82372FB	(0x7605u << 16)
80*438d564cSPulkoMandy #define		FW_DEVICE_PCIO2FW	(0x1102u << 16)
81bb5ea4ebSJérôme Duval 
82bb5ea4ebSJérôme Duval #define PCI_INTERFACE_OHCI	0x10
83bb5ea4ebSJérôme Duval 
84bb5ea4ebSJérôme Duval #define FW_OHCI_BASE_REG	0x10
85bb5ea4ebSJérôme Duval 
86bb5ea4ebSJérôme Duval #define		OHCI_DMA_ITCH		0x20
87bb5ea4ebSJérôme Duval #define		OHCI_DMA_IRCH		0x20
88bb5ea4ebSJérôme Duval 
89bb5ea4ebSJérôme Duval #define		OHCI_MAX_DMA_CH		(0x4 + OHCI_DMA_ITCH + OHCI_DMA_IRCH)
90bb5ea4ebSJérôme Duval 
91bb5ea4ebSJérôme Duval 
92bb5ea4ebSJérôme Duval typedef uint32_t 	fwohcireg_t;
93bb5ea4ebSJérôme Duval 
94bb5ea4ebSJérôme Duval /* for PCI */
95bb5ea4ebSJérôme Duval #if BYTE_ORDER == BIG_ENDIAN
96bb5ea4ebSJérôme Duval #ifdef __HAIKU__
97756ea297SAndreas Färber #define htole32(x) ((uint32_t)__swap_int32(x))
98756ea297SAndreas Färber #define le32toh(x) ((uint32_t)__swap_int32(x))
99bb5ea4ebSJérôme Duval #endif
100bb5ea4ebSJérôme Duval #define FWOHCI_DMA_WRITE(x, y)	((x) = htole32(y))
101bb5ea4ebSJérôme Duval #define FWOHCI_DMA_READ(x)	le32toh(x)
102bb5ea4ebSJérôme Duval #define FWOHCI_DMA_SET(x, y)	((x) |= htole32(y))
103bb5ea4ebSJérôme Duval #define FWOHCI_DMA_CLEAR(x, y)	((x) &= htole32(~(y)))
104bb5ea4ebSJérôme Duval #else
105bb5ea4ebSJérôme Duval #define FWOHCI_DMA_WRITE(x, y)	((x) = (y))
106bb5ea4ebSJérôme Duval #define FWOHCI_DMA_READ(x)	(x)
107bb5ea4ebSJérôme Duval #define FWOHCI_DMA_SET(x, y)	((x) |= (y))
108bb5ea4ebSJérôme Duval #define FWOHCI_DMA_CLEAR(x, y)	((x) &= ~(y))
109bb5ea4ebSJérôme Duval #endif
110bb5ea4ebSJérôme Duval 
111bb5ea4ebSJérôme Duval struct fwohcidb {
112bb5ea4ebSJérôme Duval 	union {
113bb5ea4ebSJérôme Duval 		struct {
114bb5ea4ebSJérôme Duval 			uint32_t cmd;
115bb5ea4ebSJérôme Duval 			uint32_t addr;
116bb5ea4ebSJérôme Duval 			uint32_t depend;
117bb5ea4ebSJérôme Duval 			uint32_t res;
118bb5ea4ebSJérôme Duval 		} desc;
119bb5ea4ebSJérôme Duval 		uint32_t immed[4];
120bb5ea4ebSJérôme Duval 	} db;
121bb5ea4ebSJérôme Duval #define OHCI_STATUS_SHIFT	16
122bb5ea4ebSJérôme Duval #define OHCI_COUNT_MASK		0xffff
123bb5ea4ebSJérôme Duval #define OHCI_OUTPUT_MORE	(0 << 28)
124bb5ea4ebSJérôme Duval #define OHCI_OUTPUT_LAST	(1 << 28)
125bb5ea4ebSJérôme Duval #define OHCI_INPUT_MORE		(2 << 28)
126bb5ea4ebSJérôme Duval #define OHCI_INPUT_LAST		(3 << 28)
127bb5ea4ebSJérôme Duval #define OHCI_STORE_QUAD		(4 << 28)
128bb5ea4ebSJérôme Duval #define OHCI_LOAD_QUAD		(5 << 28)
129bb5ea4ebSJérôme Duval #define OHCI_NOP		(6 << 28)
130bb5ea4ebSJérôme Duval #define OHCI_STOP		(7 << 28)
131bb5ea4ebSJérôme Duval #define OHCI_STORE		(8 << 28)
132bb5ea4ebSJérôme Duval #define OHCI_CMD_MASK		(0xf << 28)
133bb5ea4ebSJérôme Duval 
134bb5ea4ebSJérôme Duval #define	OHCI_UPDATE		(1 << 27)
135bb5ea4ebSJérôme Duval 
136bb5ea4ebSJérôme Duval #define OHCI_KEY_ST0		(0 << 24)
137bb5ea4ebSJérôme Duval #define OHCI_KEY_ST1		(1 << 24)
138bb5ea4ebSJérôme Duval #define OHCI_KEY_ST2		(2 << 24)
139bb5ea4ebSJérôme Duval #define OHCI_KEY_ST3		(3 << 24)
140bb5ea4ebSJérôme Duval #define OHCI_KEY_REGS		(5 << 24)
141bb5ea4ebSJérôme Duval #define OHCI_KEY_SYS		(6 << 24)
142bb5ea4ebSJérôme Duval #define OHCI_KEY_DEVICE		(7 << 24)
143bb5ea4ebSJérôme Duval #define OHCI_KEY_MASK		(7 << 24)
144bb5ea4ebSJérôme Duval 
145bb5ea4ebSJérôme Duval #define OHCI_INTERRUPT_NEVER	(0 << 20)
146bb5ea4ebSJérôme Duval #define OHCI_INTERRUPT_TRUE	(1 << 20)
147bb5ea4ebSJérôme Duval #define OHCI_INTERRUPT_FALSE	(2 << 20)
148bb5ea4ebSJérôme Duval #define OHCI_INTERRUPT_ALWAYS	(3 << 20)
149bb5ea4ebSJérôme Duval 
150bb5ea4ebSJérôme Duval #define OHCI_BRANCH_NEVER	(0 << 18)
151bb5ea4ebSJérôme Duval #define OHCI_BRANCH_TRUE	(1 << 18)
152bb5ea4ebSJérôme Duval #define OHCI_BRANCH_FALSE	(2 << 18)
153bb5ea4ebSJérôme Duval #define OHCI_BRANCH_ALWAYS	(3 << 18)
154bb5ea4ebSJérôme Duval #define OHCI_BRANCH_MASK	(3 << 18)
155bb5ea4ebSJérôme Duval 
156bb5ea4ebSJérôme Duval #define OHCI_WAIT_NEVER		(0 << 16)
157bb5ea4ebSJérôme Duval #define OHCI_WAIT_TRUE		(1 << 16)
158bb5ea4ebSJérôme Duval #define OHCI_WAIT_FALSE		(2 << 16)
159bb5ea4ebSJérôme Duval #define OHCI_WAIT_ALWAYS	(3 << 16)
160bb5ea4ebSJérôme Duval };
161bb5ea4ebSJérôme Duval 
162bb5ea4ebSJérôme Duval #define OHCI_SPD_S100 0x4
163bb5ea4ebSJérôme Duval #define OHCI_SPD_S200 0x1
164bb5ea4ebSJérôme Duval #define OHCI_SPD_S400 0x2
165bb5ea4ebSJérôme Duval 
166bb5ea4ebSJérôme Duval 
167bb5ea4ebSJérôme Duval #define FWOHCIEV_NOSTAT 0
168bb5ea4ebSJérôme Duval #define FWOHCIEV_LONGP 2
169bb5ea4ebSJérôme Duval #define FWOHCIEV_MISSACK 3
170bb5ea4ebSJérôme Duval #define FWOHCIEV_UNDRRUN 4
171bb5ea4ebSJérôme Duval #define FWOHCIEV_OVRRUN 5
172bb5ea4ebSJérôme Duval #define FWOHCIEV_DESCERR 6
173bb5ea4ebSJérôme Duval #define FWOHCIEV_DTRDERR 7
174bb5ea4ebSJérôme Duval #define FWOHCIEV_DTWRERR 8
175bb5ea4ebSJérôme Duval #define FWOHCIEV_BUSRST 9
176bb5ea4ebSJérôme Duval #define FWOHCIEV_TIMEOUT 0xa
177bb5ea4ebSJérôme Duval #define FWOHCIEV_TCODERR 0xb
178bb5ea4ebSJérôme Duval #define FWOHCIEV_UNKNOWN 0xe
179bb5ea4ebSJérôme Duval #define FWOHCIEV_FLUSHED 0xf
180bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKCOMPL 0x11
181bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKPEND 0x12
182bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKBSX 0x14
183bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKBSA 0x15
184bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKBSB 0x16
185bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKTARD 0x1b
186bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKDERR 0x1d
187bb5ea4ebSJérôme Duval #define FWOHCIEV_ACKTERR 0x1e
188bb5ea4ebSJérôme Duval 
189bb5ea4ebSJérôme Duval #define FWOHCIEV_MASK 0x1f
190bb5ea4ebSJérôme Duval 
191bb5ea4ebSJérôme Duval struct ohci_dma{
192bb5ea4ebSJérôme Duval 	fwohcireg_t	cntl;
193bb5ea4ebSJérôme Duval 
194bb5ea4ebSJérôme Duval #define	OHCI_CNTL_CYCMATCH_S	(0x1 << 31)
195bb5ea4ebSJérôme Duval 
196bb5ea4ebSJérôme Duval #define	OHCI_CNTL_BUFFIL	(0x1 << 31)
197bb5ea4ebSJérôme Duval #define	OHCI_CNTL_ISOHDR	(0x1 << 30)
198bb5ea4ebSJérôme Duval #define	OHCI_CNTL_CYCMATCH_R	(0x1 << 29)
199bb5ea4ebSJérôme Duval #define	OHCI_CNTL_MULTICH	(0x1 << 28)
200bb5ea4ebSJérôme Duval 
201bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_RUN	(0x1 << 15)
202bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_WAKE	(0x1 << 12)
203bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_DEAD	(0x1 << 11)
204bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_ACTIVE	(0x1 << 10)
205bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_BT	(0x1 << 8)
206bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_BAD	(0x1 << 7)
207bb5ea4ebSJérôme Duval #define	OHCI_CNTL_DMA_STAT	(0xff)
208bb5ea4ebSJérôme Duval 
209bb5ea4ebSJérôme Duval 	fwohcireg_t	cntl_clr;
210bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy0;
211bb5ea4ebSJérôme Duval 	fwohcireg_t	cmd;
212bb5ea4ebSJérôme Duval 	fwohcireg_t	match;
213bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy1;
214bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy2;
215bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy3;
216bb5ea4ebSJérôme Duval };
217bb5ea4ebSJérôme Duval 
218bb5ea4ebSJérôme Duval struct ohci_itdma{
219bb5ea4ebSJérôme Duval 	fwohcireg_t	cntl;
220bb5ea4ebSJérôme Duval 	fwohcireg_t	cntl_clr;
221bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy0;
222bb5ea4ebSJérôme Duval 	fwohcireg_t	cmd;
223bb5ea4ebSJérôme Duval };
224bb5ea4ebSJérôme Duval 
225bb5ea4ebSJérôme Duval struct ohci_registers {
226bb5ea4ebSJérôme Duval 	fwohcireg_t	ver;		/* Version No. 0x0 */
227bb5ea4ebSJérôme Duval 	fwohcireg_t	guid;		/* GUID_ROM No. 0x4 */
228bb5ea4ebSJérôme Duval 	fwohcireg_t	retry;		/* AT retries 0x8 */
229bb5ea4ebSJérôme Duval #define FWOHCI_RETRY	0x8
230bb5ea4ebSJérôme Duval 	fwohcireg_t	csr_data;	/* CSR data   0xc */
231bb5ea4ebSJérôme Duval 	fwohcireg_t	csr_cmp;	/* CSR compare 0x10 */
232bb5ea4ebSJérôme Duval 	fwohcireg_t	csr_cntl;	/* CSR compare 0x14 */
233bb5ea4ebSJérôme Duval 	fwohcireg_t	rom_hdr;	/* config ROM ptr. 0x18 */
234bb5ea4ebSJérôme Duval 	fwohcireg_t	bus_id;		/* BUS_ID 0x1c */
235bb5ea4ebSJérôme Duval 	fwohcireg_t	bus_opt;	/* BUS option 0x20 */
236bb5ea4ebSJérôme Duval #define	FWOHCIGUID_H	0x24
237bb5ea4ebSJérôme Duval #define	FWOHCIGUID_L	0x28
238bb5ea4ebSJérôme Duval 	fwohcireg_t	guid_hi;	/* GUID hi 0x24 */
239bb5ea4ebSJérôme Duval 	fwohcireg_t	guid_lo;	/* GUID lo 0x28 */
240bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy0[2];	/* dummy 0x2c-0x30 */
241bb5ea4ebSJérôme Duval 	fwohcireg_t	config_rom;	/* config ROM map 0x34 */
242bb5ea4ebSJérôme Duval 	fwohcireg_t	post_wr_lo;	/* post write addr lo 0x38 */
243bb5ea4ebSJérôme Duval 	fwohcireg_t	post_wr_hi;	/* post write addr hi 0x3c */
244bb5ea4ebSJérôme Duval 	fwohcireg_t	vender;		/* vender ID 0x40 */
245bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy1[3];	/* dummy 0x44-0x4c */
246bb5ea4ebSJérôme Duval 	fwohcireg_t	hcc_cntl_set;	/* HCC control set 0x50 */
247bb5ea4ebSJérôme Duval 	fwohcireg_t	hcc_cntl_clr;	/* HCC control clr 0x54 */
248bb5ea4ebSJérôme Duval #define	OHCI_HCC_BIBIV	(1 << 31)	/* BIBimage Valid */
249bb5ea4ebSJérôme Duval #define	OHCI_HCC_BIGEND	(1 << 30)	/* noByteSwapData */
250bb5ea4ebSJérôme Duval #define	OHCI_HCC_PRPHY	(1 << 23)	/* programPhyEnable */
251bb5ea4ebSJérôme Duval #define	OHCI_HCC_PHYEN	(1 << 22)	/* aPhyEnhanceEnable */
252bb5ea4ebSJérôme Duval #define	OHCI_HCC_LPS	(1 << 19)	/* LPS */
253bb5ea4ebSJérôme Duval #define	OHCI_HCC_POSTWR	(1 << 18)	/* postedWriteEnable */
254bb5ea4ebSJérôme Duval #define	OHCI_HCC_LINKEN	(1 << 17)	/* linkEnable */
255bb5ea4ebSJérôme Duval #define	OHCI_HCC_RESET	(1 << 16)	/* softReset */
256bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy2[2];	/* dummy 0x58-0x5c */
257bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy3[1];	/* dummy 0x60 */
258bb5ea4ebSJérôme Duval 	fwohcireg_t	sid_buf;	/* self id buffer 0x64 */
259bb5ea4ebSJérôme Duval 	fwohcireg_t	sid_cnt;	/* self id count 0x68 */
260bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy4[1];	/* dummy 0x6c */
261bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_mask_hi_set;	/* ir mask hi set 0x70 */
262bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_mask_hi_clr;	/* ir mask hi set 0x74 */
263bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_mask_lo_set;	/* ir mask hi set 0x78 */
264bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_mask_lo_clr;	/* ir mask hi set 0x7c */
265bb5ea4ebSJérôme Duval #define	FWOHCI_INTSTAT		0x80
266bb5ea4ebSJérôme Duval #define	FWOHCI_INTSTATCLR	0x84
267bb5ea4ebSJérôme Duval #define	FWOHCI_INTMASK		0x88
268bb5ea4ebSJérôme Duval #define	FWOHCI_INTMASKCLR	0x8c
269bb5ea4ebSJérôme Duval 	fwohcireg_t	int_stat;   /*       0x80 */
270bb5ea4ebSJérôme Duval 	fwohcireg_t	int_clear;  /*       0x84 */
271bb5ea4ebSJérôme Duval 	fwohcireg_t	int_mask;   /*       0x88 */
272bb5ea4ebSJérôme Duval 	fwohcireg_t	int_mask_clear;   /*       0x8c */
273bb5ea4ebSJérôme Duval 	fwohcireg_t	it_int_stat;   /*       0x90 */
274bb5ea4ebSJérôme Duval 	fwohcireg_t	it_int_clear;  /*       0x94 */
275bb5ea4ebSJérôme Duval 	fwohcireg_t	it_int_mask;   /*       0x98 */
276bb5ea4ebSJérôme Duval 	fwohcireg_t	it_mask_clear;   /*       0x9c */
277bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_int_stat;   /*       0xa0 */
278bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_int_clear;  /*       0xa4 */
279bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_int_mask;   /*       0xa8 */
280bb5ea4ebSJérôme Duval 	fwohcireg_t	ir_mask_clear;   /*       0xac */
281bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy5[11];	/* dummy 0xb0-d8 */
282bb5ea4ebSJérôme Duval 	fwohcireg_t	fairness;   /* fairness control      0xdc */
283bb5ea4ebSJérôme Duval 	fwohcireg_t	link_cntl;		/* Chip control 0xe0*/
284bb5ea4ebSJérôme Duval 	fwohcireg_t	link_cntl_clr;	/* Chip control clear 0xe4*/
285bb5ea4ebSJérôme Duval #define FWOHCI_NODEID	0xe8
286bb5ea4ebSJérôme Duval 	fwohcireg_t	node;		/* Node ID 0xe8 */
287bb5ea4ebSJérôme Duval #define	OHCI_NODE_VALID	(1 << 31)
288bb5ea4ebSJérôme Duval #define	OHCI_NODE_ROOT	(1 << 30)
289bb5ea4ebSJérôme Duval 
290bb5ea4ebSJérôme Duval #define	OHCI_ASYSRCBUS	1
291bb5ea4ebSJérôme Duval 
292bb5ea4ebSJérôme Duval 	fwohcireg_t	phy_access;	/* PHY cntl 0xec */
293bb5ea4ebSJérôme Duval #define	PHYDEV_RDDONE		(1<<31)
294bb5ea4ebSJérôme Duval #define	PHYDEV_RDCMD		(1<<15)
295bb5ea4ebSJérôme Duval #define	PHYDEV_WRCMD		(1<<14)
296bb5ea4ebSJérôme Duval #define	PHYDEV_REGADDR		8
297bb5ea4ebSJérôme Duval #define	PHYDEV_WRDATA		0
298bb5ea4ebSJérôme Duval #define	PHYDEV_RDADDR		24
299bb5ea4ebSJérôme Duval #define	PHYDEV_RDDATA		16
300bb5ea4ebSJérôme Duval 
301bb5ea4ebSJérôme Duval 	fwohcireg_t	cycle_timer;	/* Cycle Timer 0xf0 */
302bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy6[3];	/* dummy 0xf4-fc */
303bb5ea4ebSJérôme Duval 	fwohcireg_t	areq_hi;	/* Async req. filter hi 0x100 */
304bb5ea4ebSJérôme Duval 	fwohcireg_t	areq_hi_clr;	/* Async req. filter hi 0x104 */
305bb5ea4ebSJérôme Duval 	fwohcireg_t	areq_lo;	/* Async req. filter lo 0x108 */
306bb5ea4ebSJérôme Duval 	fwohcireg_t	areq_lo_clr;	/* Async req. filter lo 0x10c */
307bb5ea4ebSJérôme Duval 	fwohcireg_t	preq_hi;	/* Async req. filter hi 0x110 */
308bb5ea4ebSJérôme Duval 	fwohcireg_t	preq_hi_clr;	/* Async req. filter hi 0x114 */
309bb5ea4ebSJérôme Duval 	fwohcireg_t	preq_lo;	/* Async req. filter lo 0x118 */
310bb5ea4ebSJérôme Duval 	fwohcireg_t	preq_lo_clr;	/* Async req. filter lo 0x11c */
311bb5ea4ebSJérôme Duval 
312bb5ea4ebSJérôme Duval 	fwohcireg_t	pys_upper;	/* Physical Upper bound 0x120 */
313bb5ea4ebSJérôme Duval 
314bb5ea4ebSJérôme Duval 	fwohcireg_t	dummy7[23];	/* dummy 0x124-0x17c */
315bb5ea4ebSJérôme Duval 
316bb5ea4ebSJérôme Duval 	/*       0x180, 0x184, 0x188, 0x18c */
317bb5ea4ebSJérôme Duval 	/*       0x190, 0x194, 0x198, 0x19c */
318bb5ea4ebSJérôme Duval 	/*       0x1a0, 0x1a4, 0x1a8, 0x1ac */
319bb5ea4ebSJérôme Duval 	/*       0x1b0, 0x1b4, 0x1b8, 0x1bc */
320bb5ea4ebSJérôme Duval 	/*       0x1c0, 0x1c4, 0x1c8, 0x1cc */
321bb5ea4ebSJérôme Duval 	/*       0x1d0, 0x1d4, 0x1d8, 0x1dc */
322bb5ea4ebSJérôme Duval 	/*       0x1e0, 0x1e4, 0x1e8, 0x1ec */
323bb5ea4ebSJérôme Duval 	/*       0x1f0, 0x1f4, 0x1f8, 0x1fc */
324bb5ea4ebSJérôme Duval 	struct ohci_dma dma_ch[0x4];
325bb5ea4ebSJérôme Duval 
326bb5ea4ebSJérôme Duval 	/*       0x200, 0x204, 0x208, 0x20c */
327bb5ea4ebSJérôme Duval 	/*       0x210, 0x204, 0x208, 0x20c */
328bb5ea4ebSJérôme Duval 	struct ohci_itdma dma_itch[0x20];
329bb5ea4ebSJérôme Duval 
330bb5ea4ebSJérôme Duval 	/*       0x400, 0x404, 0x408, 0x40c */
331bb5ea4ebSJérôme Duval 	/*       0x410, 0x404, 0x408, 0x40c */
332bb5ea4ebSJérôme Duval 	struct ohci_dma dma_irch[0x20];
333bb5ea4ebSJérôme Duval };
334bb5ea4ebSJérôme Duval 
335bb5ea4ebSJérôme Duval struct fwohcidb_tr{
336bb5ea4ebSJérôme Duval 	STAILQ_ENTRY(fwohcidb_tr) link;
337bb5ea4ebSJérôme Duval 	struct fw_xfer *xfer;
338bb5ea4ebSJérôme Duval 	struct fwohcidb *db;
339bb5ea4ebSJérôme Duval //	bus_dmamap_t dma_map;
340bb5ea4ebSJérôme Duval 	caddr_t buf;
341bb5ea4ebSJérôme Duval 	bus_addr_t bus_addr;
342bb5ea4ebSJérôme Duval 	int dbcnt;
343bb5ea4ebSJérôme Duval };
344bb5ea4ebSJérôme Duval 
345bb5ea4ebSJérôme Duval /*
346bb5ea4ebSJérôme Duval  * OHCI info structure.
347bb5ea4ebSJérôme Duval  */
348bb5ea4ebSJérôme Duval struct fwohci_txpkthdr{
349bb5ea4ebSJérôme Duval 	union{
350bb5ea4ebSJérôme Duval 		uint32_t ld[4];
351bb5ea4ebSJérôme Duval 		struct {
352bb5ea4ebSJérôme Duval #if BYTE_ORDER == BIG_ENDIAN
353bb5ea4ebSJérôme Duval 			uint32_t spd:16, /* XXX include reserved field */
354bb5ea4ebSJérôme Duval 				 :8,
355bb5ea4ebSJérôme Duval 				 tcode:4,
356bb5ea4ebSJérôme Duval 				 :4;
357bb5ea4ebSJérôme Duval #else
358bb5ea4ebSJérôme Duval 			uint32_t :4,
359bb5ea4ebSJérôme Duval 				 tcode:4,
360bb5ea4ebSJérôme Duval 				 :8,
361bb5ea4ebSJérôme Duval 				 spd:16; /* XXX include reserved fields */
362bb5ea4ebSJérôme Duval #endif
363bb5ea4ebSJérôme Duval 		}common;
364bb5ea4ebSJérôme Duval 		struct {
365bb5ea4ebSJérôme Duval #if BYTE_ORDER == BIG_ENDIAN
366bb5ea4ebSJérôme Duval 			uint32_t :8,
367bb5ea4ebSJérôme Duval 				 srcbus:1,
368bb5ea4ebSJérôme Duval 				 :4,
369bb5ea4ebSJérôme Duval 				 spd:3,
370bb5ea4ebSJérôme Duval 				 tlrt:8,
371bb5ea4ebSJérôme Duval 				 tcode:4,
372bb5ea4ebSJérôme Duval 				 :4;
373bb5ea4ebSJérôme Duval #else
374bb5ea4ebSJérôme Duval 			uint32_t :4,
375bb5ea4ebSJérôme Duval 				 tcode:4,
376bb5ea4ebSJérôme Duval 				 tlrt:8,
377bb5ea4ebSJérôme Duval 				 spd:3,
378bb5ea4ebSJérôme Duval 				 :4,
379bb5ea4ebSJérôme Duval 				 srcbus:1,
380bb5ea4ebSJérôme Duval 				 :8;
381bb5ea4ebSJérôme Duval #endif
382bb5ea4ebSJérôme Duval 			BIT16x2(dst, );
383bb5ea4ebSJérôme Duval 		}asycomm;
384bb5ea4ebSJérôme Duval 		struct {
385bb5ea4ebSJérôme Duval #if BYTE_ORDER == BIG_ENDIAN
386bb5ea4ebSJérôme Duval 			uint32_t :13,
387bb5ea4ebSJérôme Duval 			         spd:3,
388bb5ea4ebSJérôme Duval 				 chtag:8,
389bb5ea4ebSJérôme Duval 				 tcode:4,
390bb5ea4ebSJérôme Duval 				 sy:4;
391bb5ea4ebSJérôme Duval #else
392bb5ea4ebSJérôme Duval 			uint32_t sy:4,
393bb5ea4ebSJérôme Duval 				 tcode:4,
394bb5ea4ebSJérôme Duval 				 chtag:8,
395bb5ea4ebSJérôme Duval 			         spd:3,
396bb5ea4ebSJérôme Duval 				 :13;
397bb5ea4ebSJérôme Duval #endif
398bb5ea4ebSJérôme Duval 			BIT16x2(len, );
399bb5ea4ebSJérôme Duval 		}stream;
400bb5ea4ebSJérôme Duval 	}mode;
401bb5ea4ebSJérôme Duval };
402bb5ea4ebSJérôme Duval struct fwohci_trailer{
403bb5ea4ebSJérôme Duval #if BYTE_ORDER == BIG_ENDIAN
404bb5ea4ebSJérôme Duval 	uint32_t stat:16,
405bb5ea4ebSJérôme Duval 		  time:16;
406bb5ea4ebSJérôme Duval #else
407bb5ea4ebSJérôme Duval 	uint32_t time:16,
408bb5ea4ebSJérôme Duval 		  stat:16;
409bb5ea4ebSJérôme Duval #endif
410bb5ea4ebSJérôme Duval };
411bb5ea4ebSJérôme Duval 
412bb5ea4ebSJérôme Duval #define	OHCI_CNTL_CYCSRC	(0x1 << 22)
413bb5ea4ebSJérôme Duval #define	OHCI_CNTL_CYCMTR	(0x1 << 21)
414bb5ea4ebSJérôme Duval #define	OHCI_CNTL_CYCTIMER	(0x1 << 20)
415bb5ea4ebSJérôme Duval #define	OHCI_CNTL_PHYPKT	(0x1 << 10)
416bb5ea4ebSJérôme Duval #define	OHCI_CNTL_SID		(0x1 << 9)
417bb5ea4ebSJérôme Duval 
4181719f7a6SStephan Aßmus /*
4191719f7a6SStephan Aßmus  * defined in OHCI 1.1
4201719f7a6SStephan Aßmus  * chapter 6.1
4211719f7a6SStephan Aßmus  */
422bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_ATRQ	(0x1 << 0)
423bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_ATRS	(0x1 << 1)
424bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_ARRQ	(0x1 << 2)
425bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_ARRS	(0x1 << 3)
426bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_PRRQ	(0x1 << 4)
427bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_PRRS	(0x1 << 5)
428bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_IT		(0x1 << 6)
429bb5ea4ebSJérôme Duval #define OHCI_INT_DMA_IR		(0x1 << 7)
430bb5ea4ebSJérôme Duval #define OHCI_INT_PW_ERR		(0x1 << 8)
431bb5ea4ebSJérôme Duval #define OHCI_INT_LR_ERR		(0x1 << 9)
432bb5ea4ebSJérôme Duval #define OHCI_INT_PHY_SID	(0x1 << 16)
433bb5ea4ebSJérôme Duval #define OHCI_INT_PHY_BUS_R	(0x1 << 17)
434bb5ea4ebSJérôme Duval #define OHCI_INT_REG_FAIL	(0x1 << 18)
435bb5ea4ebSJérôme Duval #define OHCI_INT_PHY_INT	(0x1 << 19)
436bb5ea4ebSJérôme Duval #define OHCI_INT_CYC_START	(0x1 << 20)
437bb5ea4ebSJérôme Duval #define OHCI_INT_CYC_64SECOND	(0x1 << 21)
438bb5ea4ebSJérôme Duval #define OHCI_INT_CYC_LOST	(0x1 << 22)
439bb5ea4ebSJérôme Duval #define OHCI_INT_CYC_ERR	(0x1 << 23)
440bb5ea4ebSJérôme Duval #define OHCI_INT_ERR		(0x1 << 24)
441bb5ea4ebSJérôme Duval #define OHCI_INT_CYC_LONG	(0x1 << 25)
442bb5ea4ebSJérôme Duval #define OHCI_INT_PHY_REG	(0x1 << 26)
443bb5ea4ebSJérôme Duval #define OHCI_INT_EN		(0x1 << 31)
444bb5ea4ebSJérôme Duval 
445bb5ea4ebSJérôme Duval #define IP_CHANNELS             0x0234
446bb5ea4ebSJérôme Duval #define FWOHCI_MAXREC		2048
447bb5ea4ebSJérôme Duval 
448bb5ea4ebSJérôme Duval #define	OHCI_ISORA		0x02
449bb5ea4ebSJérôme Duval #define	OHCI_ISORB		0x04
450bb5ea4ebSJérôme Duval 
451bb5ea4ebSJérôme Duval #define FWOHCITCODE_PHY		0xe
452