xref: /freebsd/sys/dev/usb/controller/dwc_otgreg.h (revision 734e82fe33aa764367791a7d603b383996c6b40b)
1 
2 /*-
3  * SPDX-License-Identifier: BSD-2-Clause
4  *
5  * Copyright (c) 2010,2011 Aleksandr Rybalko. All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 #ifndef _DWC_OTGREG_H_
30 #define	_DWC_OTGREG_H_
31 
32 #define	DOTG_GOTGCTL		0x0000
33 #define	DOTG_GOTGINT		0x0004
34 #define	DOTG_GAHBCFG		0x0008
35 #define	DOTG_GUSBCFG		0x000C
36 #define	DOTG_GRSTCTL		0x0010
37 #define	DOTG_GINTSTS		0x0014
38 #define	DOTG_GINTMSK		0x0018
39 #define	DOTG_GRXSTSRD		0x001C
40 #define	DOTG_GRXSTSRH		0x001C
41 #define	DOTG_GRXSTSPD		0x0020
42 #define	DOTG_GRXSTSPH		0x0020
43 #define	DOTG_GRXFSIZ		0x0024
44 #define	DOTG_GNPTXFSIZ		0x0028
45 #define	DOTG_GNPTXSTS		0x002C
46 #define	DOTG_GI2CCTL		0x0030
47 #define	DOTG_GPVNDCTL		0x0034
48 #define	DOTG_GGPIO		0x0038
49 #define	DOTG_GUID		0x003C
50 #define	DOTG_GSNPSID		0x0040
51 #define	DOTG_GSNPSID_REV_2_80a	0x4f54280a	/* RPi model B/RPi2 */
52 #define	DOTG_GSNPSID_REV_3_10a	0x4f54310a	/* ODROID-C1 */
53 #define	DOTG_GHWCFG1		0x0044
54 #define	DOTG_GHWCFG2		0x0048
55 #define	DOTG_GHWCFG3		0x004C
56 #define	DOTG_GHWCFG4		0x0050
57 #define	DOTG_GLPMCFG		0x0054
58 #define	DOTG_GPWRDN		0x0058
59 #define	DOTG_GDFIFOCFG		0x005C
60 #define	DOTG_GADPCTL		0x0060
61 
62 #define	DOTG_HPTXFSIZ		0x0100
63 /* start from 0x104, but fifo0 not exists */
64 #define	DOTG_DPTXFSIZ(fifo)	(0x0100 + (4*(fifo)))
65 #define	DOTG_DIEPTXF(fifo)	(0x0100 + (4*(fifo)))
66 
67 #define	DOTG_HCFG		0x0400
68 #define	DOTG_HFIR		0x0404
69 #define	DOTG_HFNUM		0x0408
70 #define	DOTG_HPTXSTS		0x0410
71 #define	DOTG_HAINT		0x0414
72 #define	DOTG_HAINTMSK		0x0418
73 #define	DOTG_HPRT		0x0440
74 
75 #define	DOTG_HCCHAR(ch)		(0x0500 + (32*(ch)))
76 #define	DOTG_HCSPLT(ch)		(0x0504 + (32*(ch)))
77 #define	DOTG_HCINT(ch)		(0x0508 + (32*(ch)))
78 #define	DOTG_HCINTMSK(ch)	(0x050C + (32*(ch)))
79 #define	DOTG_HCTSIZ(ch)		(0x0510 + (32*(ch)))
80 #define	DOTG_HCDMA(ch)		(0x0514 + (32*(ch)))
81 #define	DOTG_HCDMAI(ch)		(0x0514 + (32*(ch)))
82 #define	DOTG_HCDMAO(ch)		(0x0514 + (32*(ch)))
83 #define	DOTG_HCDMAB(ch)		(0x051C + (32*(ch)))
84 
85 /* Device Mode */
86 #define	DOTG_DCFG		0x0800
87 #define	DOTG_DCTL		0x0804
88 #define	DOTG_DSTS		0x0808
89 #define	DOTG_DIEPMSK		0x0810
90 #define	DOTG_DOEPMSK		0x0814
91 #define	DOTG_DAINT		0x0818
92 #define	DOTG_DAINTMSK		0x081C
93 #define	DOTG_DTKNQR1		0x0820
94 #define	DOTG_DTKNQR2		0x0824
95 #define	DOTG_DVBUSDIS		0x0828
96 #define	DOTG_DVBUSPULSE		0x082C
97 #define	DOTG_DTHRCTL		0x0830
98 #define	DOTG_DTKNQR4		0x0834
99 #define	DOTG_DIEPEMPMSK		0x0834
100 #define	DOTG_DEACHINT		0x0838
101 #define	DOTG_DEACHINTMSK	0x083C
102 #define	DOTG_DIEPEACHINTMSK(ch)	(0x0840 + (4*(ch)))
103 #define	DOTG_DOEPEACHINTMSK(ch)	(0x0880 + (4*(ch)))
104 
105 #define	DOTG_DIEPCTL(ep)	(0x0900 + (32*(ep)))
106 #define	DOTG_DIEPINT(ep)	(0x0908 + (32*(ep)))
107 #define	DOTG_DIEPTSIZ(ep)	(0x0910 + (32*(ep)))
108 #define	DOTG_DIEPDMA(ep)	(0x0914 + (32*(ep)))
109 #define	DOTG_DTXFSTS(ep)	(0x0918 + (32*(ep)))
110 #define	DOTG_DIEPDMAB(ep)	(0x091c + (32*(ep)))
111 
112 #define	DOTG_DOEPCTL(ep)	(0x0B00 + (32*(ep)))
113 #define	DOTG_DOEPFN(ep)		(0x0B04 + (32*(ep)))
114 #define	DOTG_DOEPINT(ep)	(0x0B08 + (32*(ep)))
115 #define	DOTG_DOEPTSIZ(ep)	(0x0B10 + (32*(ep)))
116 #define	DOTG_DOEPDMA(ep)	(0x0B14 + (32*(ep)))
117 #define	DOTG_DOEPDMAB(ep)	(0x0B1c + (32*(ep)))
118 /* End Device Mode */
119 
120 /* Host Mode
121 #define	DOTG_CTL_STATUS		0x0800
122 #define	DOTG_DMA0_INB_CHN0	0x0818
123 #define	DOTG_DMA0_INB_CHN1	0x0820
124 #define	DOTG_DMA0_INB_CHN2	0x0828
125 #define	DOTG_DVBUSDIS		0x0828
126 #define	DOTG_DVBUSPULSE		0x082c
127 #define	DOTG_DMA0_INB_CHN3	0x0830
128 #define	DOTG_DMA0_INB_CHN4	0x0838
129 #define	DOTG_DMA0_INB_CHN5	0x0840
130 #define	DOTG_DMA0_INB_CHN6	0x0848
131 #define	DOTG_DMA0_INB_CHN7	0x0850
132 #define	DOTG_DMA0_OUTB_CHN0	0x0858
133 #define	DOTG_DMA0_OUTB_CHN1	0x0860
134 #define	DOTG_DMA0_OUTB_CHN2	0x0868
135 #define	DOTG_DMA0_OUTB_CHN3	0x0870
136 #define	DOTG_DMA0_OUTB_CHN4	0x0878
137 #define	DOTG_DMA0_OUTB_CHN5	0x0880
138 #define	DOTG_DMA0_OUTB_CHN6	0x0888
139 #define	DOTG_DMA0_OUTB_CHN7	0x0890
140  End Host Mode */
141 
142 /* Power and clock gating CSR */
143 
144 #define	DOTG_PCGCCTL		0x0E00
145 
146 /* FIFO access registers (PIO-mode) */
147 
148 #define	DOTG_DFIFO(n)		(0x1000 + (0x1000 * (n)))
149 
150 #define	GOTGCTL_CHIRP_ON		(1<<27)
151 #define	GOTGCTL_BSESVLD			(1<<19)
152 #define	GOTGCTL_ASESVLD			(1<<18)
153 #define	GOTGCTL_DBNCTIME		(1<<17)
154 #define	GOTGCTL_CONIDSTS		(1<<16)
155 #define	GOTGCTL_DEVHNPEN		(1<<11)
156 #define	GOTGCTL_HSTSETHNPEN		(1<<10)
157 #define	GOTGCTL_HNPREQ			(1<<9)
158 #define	GOTGCTL_HSTNEGSCS		(1<<8)
159 #define	GOTGCTL_SESREQ			(1<<1)
160 #define	GOTGCTL_SESREQSCS		(1<<0)
161 
162 #define	GOTGCTL_DBNCEDONE		(1<<19)
163 #define	GOTGCTL_ADEVTOUTCHG		(1<<18)
164 #define	GOTGCTL_HSTNEGDET		(1<<17)
165 #define	GOTGCTL_HSTNEGSUCSTSCHG		(1<<9)
166 #define	GOTGCTL_SESREQSUCSTSCHG		(1<<8)
167 #define	GOTGCTL_SESENDDET		(1<<2)
168 
169 #define	GAHBCFG_PTXFEMPLVL		(1<<8)
170 #define	GAHBCFG_NPTXFEMPLVL		(1<<7)
171 #define	GAHBCFG_DMAEN			(1<<5)
172 #define	GAHBCFG_HBSTLEN_MASK		0x0000001e
173 #define	GAHBCFG_HBSTLEN_SHIFT		1
174 #define	GAHBCFG_GLBLINTRMSK		(1<<0)
175 
176 #define	GUSBCFG_CORRUPTTXPACKET		(1<<31)
177 #define	GUSBCFG_FORCEDEVMODE		(1<<30)
178 #define	GUSBCFG_FORCEHOSTMODE		(1<<29)
179 #define	GUSBCFG_NO_PULLUP		(1<<27)
180 #define	GUSBCFG_IC_USB_CAP		(1<<26)
181 #define	GUSBCFG_TERMSELDLPULSE		(1<<22)
182 #define	GUSBCFG_ULPIEXTVBUSINDICATOR	(1<<21)
183 #define	GUSBCFG_ULPIEXTVBUSDRV		(1<<20)
184 #define	GUSBCFG_ULPICLKSUSM		(1<<19)
185 #define	GUSBCFG_ULPIAUTORES		(1<<18)
186 #define	GUSBCFG_ULPIFSLS		(1<<17)
187 #define	GUSBCFG_OTGI2CSEL		(1<<16)
188 #define	GUSBCFG_PHYLPWRCLKSEL		(1<<15)
189 #define	GUSBCFG_USBTRDTIM_MASK		0x00003c00
190 #define	GUSBCFG_USBTRDTIM_SHIFT		10
191 #define	GUSBCFG_TRD_TIM_SET(x)		(((x) & 15) << 10)
192 #define	GUSBCFG_HNPCAP			(1<<9)
193 #define	GUSBCFG_SRPCAP			(1<<8)
194 #define	GUSBCFG_DDRSEL			(1<<7)
195 #define	GUSBCFG_PHYSEL			(1<<6)
196 #define	GUSBCFG_FSINTF			(1<<5)
197 #define	GUSBCFG_ULPI_UTMI_SEL		(1<<4)
198 #define	GUSBCFG_PHYIF			(1<<3)
199 #define	GUSBCFG_TOUTCAL_MASK		0x00000007
200 #define	GUSBCFG_TOUTCAL_SHIFT		0
201 
202 /* STM32F4 */
203 #define	DOTG_GGPIO_NOVBUSSENS		(1 << 21)
204 #define	DOTG_GGPIO_SOFOUTEN		(1 << 20)
205 #define	DOTG_GGPIO_VBUSBSEN		(1 << 19)
206 #define	DOTG_GGPIO_VBUSASEN		(1 << 18)
207 #define	DOTG_GGPIO_I2CPADEN		(1 << 17)
208 #define	DOTG_GGPIO_PWRDWN		(1 << 16)
209 
210 #define	GRSTCTL_AHBIDLE			(1<<31)
211 #define	GRSTCTL_DMAREQ			(1<<30)
212 #define	GRSTCTL_TXFNUM_MASK		0x000007c0
213 #define	GRSTCTL_TXFNUM_SHIFT		6
214 #define	GRSTCTL_TXFIFO(n)		(((n) & 31) << 6)
215 #define	GRSTCTL_TXFFLSH			(1<<5)
216 #define	GRSTCTL_RXFFLSH			(1<<4)
217 #define	GRSTCTL_INTKNQFLSH		(1<<3)
218 #define	GRSTCTL_FRMCNTRRST		(1<<2)
219 #define	GRSTCTL_HSFTRST			(1<<1)
220 #define	GRSTCTL_CSFTRST			(1<<0)
221 
222 #define	GINTSTS_WKUPINT			(1<<31)
223 #define	GINTSTS_SESSREQINT		(1<<30)
224 #define	GINTSTS_DISCONNINT		(1<<29)
225 #define	GINTSTS_CONIDSTSCHNG		(1<<28)
226 #define	GINTSTS_LPM			(1<<27)
227 #define	GINTSTS_PTXFEMP			(1<<26)
228 #define	GINTSTS_HCHINT			(1<<25)
229 #define	GINTSTS_PRTINT			(1<<24)
230 #define	GINTSTS_RESETDET		(1<<23)
231 #define	GINTSTS_FETSUSP			(1<<22)
232 #define	GINTSTS_INCOMPLP		(1<<21)
233 #define	GINTSTS_INCOMPISOIN		(1<<20)
234 #define	GINTSTS_OEPINT			(1<<19)
235 #define	GINTSTS_IEPINT			(1<<18)
236 #define	GINTSTS_EPMIS			(1<<17)
237 #define	GINTSTS_RESTORE_DONE		(1<<16)
238 #define	GINTSTS_EOPF			(1<<15)
239 #define	GINTSTS_ISOOUTDROP		(1<<14)
240 #define	GINTSTS_ENUMDONE		(1<<13)
241 #define	GINTSTS_USBRST			(1<<12)
242 #define	GINTSTS_USBSUSP			(1<<11)
243 #define	GINTSTS_ERLYSUSP		(1<<10)
244 #define	GINTSTS_I2CINT			(1<<9)
245 #define	GINTSTS_ULPICKINT		(1<<8)
246 #define	GINTSTS_GOUTNAKEFF		(1<<7)
247 #define	GINTSTS_GINNAKEFF		(1<<6)
248 #define	GINTSTS_NPTXFEMP		(1<<5)
249 #define	GINTSTS_RXFLVL			(1<<4)
250 #define	GINTSTS_SOF			(1<<3)
251 #define	GINTSTS_OTGINT			(1<<2)
252 #define	GINTSTS_MODEMIS			(1<<1)
253 #define	GINTSTS_CURMOD			(1<<0)
254 
255 #define	GINTMSK_WKUPINTMSK		(1<<31)
256 #define	GINTMSK_SESSREQINTMSK		(1<<30)
257 #define	GINTMSK_DISCONNINTMSK		(1<<29)
258 #define	GINTMSK_CONIDSTSCHNGMSK		(1<<28)
259 #define	GINTMSK_PTXFEMPMSK		(1<<26)
260 #define	GINTMSK_HCHINTMSK		(1<<25)
261 #define	GINTMSK_PRTINTMSK		(1<<24)
262 #define	GINTMSK_FETSUSPMSK		(1<<22)
263 #define	GINTMSK_INCOMPLPMSK		(1<<21)
264 #define	GINTMSK_INCOMPISOINMSK		(1<<20)
265 #define	GINTMSK_OEPINTMSK		(1<<19)
266 #define	GINTMSK_IEPINTMSK		(1<<18)
267 #define	GINTMSK_EPMISMSK		(1<<17)
268 #define	GINTMSK_EOPFMSK			(1<<15)
269 #define	GINTMSK_ISOOUTDROPMSK		(1<<14)
270 #define	GINTMSK_ENUMDONEMSK		(1<<13)
271 #define	GINTMSK_USBRSTMSK		(1<<12)
272 #define	GINTMSK_USBSUSPMSK		(1<<11)
273 #define	GINTMSK_ERLYSUSPMSK		(1<<10)
274 #define	GINTMSK_I2CINTMSK		(1<<9)
275 #define	GINTMSK_ULPICKINTMSK		(1<<8)
276 #define	GINTMSK_GOUTNAKEFFMSK		(1<<7)
277 #define	GINTMSK_GINNAKEFFMSK		(1<<6)
278 #define	GINTMSK_NPTXFEMPMSK		(1<<5)
279 #define	GINTMSK_RXFLVLMSK		(1<<4)
280 #define	GINTMSK_SOFMSK			(1<<3)
281 #define	GINTMSK_OTGINTMSK		(1<<2)
282 #define	GINTMSK_MODEMISMSK		(1<<1)
283 #define	GINTMSK_CURMODMSK		(1<<0)
284 
285 #define	GRXSTSRH_PKTSTS_MASK		0x001e0000
286 #define	GRXSTSRH_PKTSTS_SHIFT		17
287 #define	GRXSTSRH_DPID_MASK		0x00018000
288 #define	GRXSTSRH_DPID_SHIFT		15
289 #define	GRXSTSRH_BCNT_MASK		0x00007ff0
290 #define	GRXSTSRH_BCNT_SHIFT		4
291 #define	GRXSTSRH_CHNUM_MASK		0x0000000f
292 #define	GRXSTSRH_CHNUM_SHIFT		0
293 
294 #define	GRXSTSRD_FN_MASK		0x01e00000
295 #define	GRXSTSRD_FN_GET(x)		(((x) >> 21) & 15)
296 #define	GRXSTSRD_FN_SHIFT		21
297 #define	GRXSTSRD_PKTSTS_MASK		0x001e0000
298 #define	GRXSTSRD_PKTSTS_SHIFT		17
299 #define	GRXSTSRH_IN_DATA		(2<<17)
300 #define	GRXSTSRH_IN_COMPLETE		(3<<17)
301 #define	GRXSTSRH_DT_ERROR		(5<<17)
302 #define	GRXSTSRH_HALTED			(7<<17)
303 #define	GRXSTSRD_GLOB_OUT_NAK		(1<<17)
304 #define	GRXSTSRD_OUT_DATA		(2<<17)
305 #define	GRXSTSRD_OUT_COMPLETE		(3<<17)
306 #define	GRXSTSRD_STP_COMPLETE		(4<<17)
307 #define	GRXSTSRD_STP_DATA		(6<<17)
308 #define	GRXSTSRD_DPID_MASK		0x00018000
309 #define	GRXSTSRD_DPID_SHIFT		15
310 #define	GRXSTSRD_DPID_DATA0		(0<<15)
311 #define	GRXSTSRD_DPID_DATA1		(2<<15)
312 #define	GRXSTSRD_DPID_DATA2		(1<<15)
313 #define	GRXSTSRD_DPID_MDATA		(3<<15)
314 #define	GRXSTSRD_BCNT_MASK		0x00007ff0
315 #define	GRXSTSRD_BCNT_GET(x)		(((x) >> 4) & 0x7FF)
316 #define	GRXSTSRD_BCNT_SHIFT		4
317 #define	GRXSTSRD_CHNUM_MASK		0x0000000f
318 #define	GRXSTSRD_CHNUM_GET(x)		((x) & 15)
319 #define	GRXSTSRD_CHNUM_SHIFT		0
320 
321 #define	GRXFSIZ_RXFDEP_MASK		0x0000ffff
322 #define	GRXFSIZ_RXFDEP_SHIFT		0
323 
324 #define	GNPTXFSIZ_NPTXFDEP_MASK		0xffff0000
325 #define	GNPTXFSIZ_NPTXFDEP_SHIFT	0
326 #define	GNPTXFSIZ_NPTXFSTADDR_MASK	0x0000ffff
327 #define	GNPTXFSIZ_NPTXFSTADDR_SHIFT	16
328 
329 #define	GNPTXSTS_NPTXQTOP_SHIFT		24
330 #define	GNPTXSTS_NPTXQTOP_MASK		0x7f000000
331 #define	GNPTXSTS_NPTXQSPCAVAIL_SHIFT	16
332 #define	GNPTXSTS_NPTXQSPCAVAIL_MASK	0x00ff0000
333 #define	GNPTXSTS_NPTXFSPCAVAIL_SHIFT	0
334 #define	GNPTXSTS_NPTXFSPCAVAIL_MASK	0x0000ffff
335 
336 #define	GI2CCTL_BSYDNE_SC		(1<<31)
337 #define	GI2CCTL_RW			(1<<30)
338 #define	GI2CCTL_I2CDATSE0		(1<<28)
339 #define	GI2CCTL_I2CDEVADR_SHIFT		26
340 #define	GI2CCTL_I2CDEVADR_MASK		0x0c000000
341 #define	GI2CCTL_I2CSUSPCTL		(1<<25)
342 #define	GI2CCTL_ACK			(1<<24)
343 #define	GI2CCTL_I2CEN			(1<<23)
344 #define	GI2CCTL_ADDR_SHIFT		16
345 #define	GI2CCTL_ADDR_MASK		0x007f0000
346 #define	GI2CCTL_REGADDR_SHIFT		8
347 #define	GI2CCTL_REGADDR_MASK		0x0000ff00
348 #define	GI2CCTL_RWDATA_SHIFT		0
349 #define	GI2CCTL_RWDATA_MASK		0x000000ff
350 
351 #define	GPVNDCTL_DISULPIDRVR		(1<<31)
352 #define	GPVNDCTL_VSTSDONE		(1<<27)
353 #define	GPVNDCTL_VSTSBSY		(1<<26)
354 #define	GPVNDCTL_NEWREGREQ		(1<<25)
355 #define	GPVNDCTL_REGWR			(1<<22)
356 #define	GPVNDCTL_REGADDR_SHIFT		16
357 #define	GPVNDCTL_REGADDR_MASK		0x003f0000
358 #define	GPVNDCTL_VCTRL_SHIFT		8
359 #define	GPVNDCTL_VCTRL_MASK		0x0000ff00
360 #define	GPVNDCTL_REGDATA_SHIFT		0
361 #define	GPVNDCTL_REGDATA_MASK		0x000000ff
362 
363 #define	GGPIO_GPO_SHIFT			16
364 #define	GGPIO_GPO_MASK			0xffff0000
365 #define	GGPIO_GPI_SHIFT			0
366 #define	GGPIO_GPI_MASK			0x0000ffff
367 
368 #define	GHWCFG1_GET_DIR(x, n)		(((x) >> (2 * (n))) & 3)
369 #define	GHWCFG1_BIDIR			0
370 #define	GHWCFG1_IN			1
371 #define	GHWCFG1_OUT			2
372 
373 #define	GHWCFG2_TKNQDEPTH_SHIFT		26
374 #define	GHWCFG2_TKNQDEPTH_MASK		0x7c000000
375 #define	GHWCFG2_PTXQDEPTH_SHIFT		24
376 #define	GHWCFG2_PTXQDEPTH_MASK		0x03000000
377 #define	GHWCFG2_NPTXQDEPTH_SHIFT	22
378 #define	GHWCFG2_NPTXQDEPTH_MASK		0x00c00000
379 #define	GHWCFG2_MPI			(1<<20)
380 #define	GHWCFG2_DYNFIFOSIZING		(1<<19)
381 #define	GHWCFG2_PERIOSUPPORT		(1<<18)
382 #define	GHWCFG2_NUMHSTCHNL_SHIFT	14
383 #define	GHWCFG2_NUMHSTCHNL_MASK		0x0003c000
384 #define	GHWCFG2_NUMHSTCHNL_GET(x)	((((x) >> 14) & 15) + 1)
385 #define	GHWCFG2_NUMDEVEPS_SHIFT		10
386 #define	GHWCFG2_NUMDEVEPS_MASK		0x00003c00
387 #define	GHWCFG2_NUMDEVEPS_GET(x)	((((x) >> 10) & 15) + 1)
388 #define	GHWCFG2_FSPHYTYPE_SHIFT		8
389 #define	GHWCFG2_FSPHYTYPE_MASK		0x00000300
390 #define	GHWCFG2_HSPHYTYPE_SHIFT		6
391 #define	GHWCFG2_HSPHYTYPE_MASK		0x000000c0
392 #define	GHWCFG2_SINGPNT			(1<<5)
393 #define	GHWCFG2_OTGARCH_SHIFT		3
394 #define	GHWCFG2_OTGARCH_MASK		0x00000018
395 #define	GHWCFG2_OTGMODE_SHIFT		0
396 #define	GHWCFG2_OTGMODE_MASK		0x00000007
397 
398 #define	GHWCFG3_DFIFODEPTH_SHIFT	16
399 #define	GHWCFG3_DFIFODEPTH_MASK		0xffff0000
400 #define	GHWCFG3_DFIFODEPTH_GET(x)	((x) >> 16)
401 #define	GHWCFG3_RSTTYPE			(1<<11)
402 #define	GHWCFG3_OPTFEATURE		(1<<10)
403 #define	GHWCFG3_VNDCTLSUPT		(1<<9)
404 #define	GHWCFG3_I2CINTSEL		(1<<8)
405 #define	GHWCFG3_OTGEN			(1<<7)
406 #define	GHWCFG3_PKTSIZEWIDTH_SHIFT	4
407 #define	GHWCFG3_PKTSIZEWIDTH_MASK	0x00000070
408 #define	GHWCFG3_PKTSIZE_GET(x)		(0x10<<(((x) >> 4) & 7))
409 #define	GHWCFG3_XFERSIZEWIDTH_SHIFT	0
410 #define	GHWCFG3_XFERSIZEWIDTH_MASK	0x0000000f
411 #define	GHWCFG3_XFRRSIZE_GET(x)		(0x400<<(((x) >> 0) & 15))
412 
413 #define	GHWCFG4_NUM_IN_EP_GET(x)	((((x) >> 26) & 15) + 1)
414 #define	GHWCFG4_SESSENDFLTR		(1<<24)
415 #define	GHWCFG4_BVALIDFLTR		(1<<23)
416 #define	GHWCFG4_AVALIDFLTR		(1<<22)
417 #define	GHWCFG4_VBUSVALIDFLTR		(1<<21)
418 #define	GHWCFG4_IDDGFLTR		(1<<20)
419 #define	GHWCFG4_NUMCTLEPS_SHIFT		16
420 #define	GHWCFG4_NUMCTLEPS_MASK		0x000f0000
421 #define	GHWCFG4_NUMCTLEPS_GET(x)	(((x) >> 16) & 15)
422 #define	GHWCFG4_PHYDATAWIDTH_SHIFT	14
423 #define	GHWCFG4_PHYDATAWIDTH_MASK	0x0000c000
424 #define	GHWCFG4_AHBFREQ			(1<<5)
425 #define	GHWCFG4_ENABLEPWROPT		(1<<4)
426 #define	GHWCFG4_NUMDEVPERIOEPS_SHIFT	0
427 #define	GHWCFG4_NUMDEVPERIOEPS_MASK	0x0000000f
428 #define	GHWCFG4_NUMDEVPERIOEPS_GET(x)	(((x) >> 0) & 15)
429 
430 #define	GLPMCFG_HSIC_CONN		(1<<30)
431 
432 #define	GPWRDN_BVALID			(1<<22)
433 #define	GPWRDN_IDDIG			(1<<21)
434 #define	GPWRDN_CONNDET_INT		(1<<14)
435 #define	GPWRDN_CONNDET			(1<<13)
436 #define	GPWRDN_DISCONN_INT		(1<<12)
437 #define	GPWRDN_DISCONN			(1<<11)
438 #define	GPWRDN_RESETDET_INT		(1<<10)
439 #define	GPWRDN_RESETDET			(1<<9)
440 #define	GPWRDN_LINESTATE_INT		(1<<8)
441 #define	GPWRDN_LINESTATE		(1<<7)
442 #define	GPWRDN_DISABLE_VBUS		(1<<6)
443 #define	GPWRDN_POWER_DOWN		(1<<5)
444 #define	GPWRDN_POWER_DOWN_RST		(1<<4)
445 #define	GPWRDN_POWER_DOWN_CLAMP		(1<<3)
446 #define	GPWRDN_RESTORE			(1<<2)
447 #define	GPWRDN_PMU_ACTIVE		(1<<1)
448 #define	GPWRDN_PMU_IRQ_SEL		(1<<0)
449 
450 #define	HPTXFSIZ_PTXFSIZE_SHIFT		16
451 #define	HPTXFSIZ_PTXFSIZE_MASK		0xffff0000
452 #define	HPTXFSIZ_PTXFSTADDR_SHIFT	0
453 #define	HPTXFSIZ_PTXFSTADDR_MASK	0x0000ffff
454 
455 #define	DPTXFSIZN_DPTXFSIZE_SHIFT	16
456 #define	DPTXFSIZN_DPTXFSIZE_MASK	0xffff0000
457 #define	DPTXFSIZN_PTXFSTADDR_SHIFT	0
458 #define	DPTXFSIZN_PTXFSTADDR_MASK	0x0000ffff
459 
460 #define	DIEPTXFN_INEPNTXFDEP_SHIFT	16
461 #define	DIEPTXFN_INEPNTXFDEP_MASK	0xffff0000
462 #define	DIEPTXFN_INEPNTXFSTADDR_SHIFT	0
463 #define	DIEPTXFN_INEPNTXFSTADDR_MASK	0x0000ffff
464 
465 #define	HCFG_MODECHANGERDY		(1<<31)
466 #define	HCFG_PERSCHEDENABLE		(1<<26)
467 #define	HCFG_FLENTRIES_SHIFT		24
468 #define	HCFG_FLENTRIES_MASK		0x03000000
469 #define	HCFG_FLENTRIES_8		(0)
470 #define	HCFG_FLENTRIES_16		(1)
471 #define	HCFG_FLENTRIES_32		(2)
472 #define	HCFG_FLENTRIES_64		(3)
473 #define	HCFG_MULTISEGDMA		(1<<23)
474 #define	HCFG_32KHZSUSPEND		(1<<7)
475 #define	HCFG_FSLSSUPP			(1<<2)
476 #define	HCFG_FSLSPCLKSEL_SHIFT		0
477 #define	HCFG_FSLSPCLKSEL_MASK		0x00000003
478 
479 #define	HFIR_RELOADCTRL			(1<<16)
480 #define	HFIR_FRINT_SHIFT		0
481 #define	HFIR_FRINT_MASK			0x0000ffff
482 
483 #define	HFNUM_FRREM_SHIFT		16
484 #define	HFNUM_FRREM_MASK		0xffff0000
485 #define	HFNUM_FRNUM_SHIFT		0
486 #define	HFNUM_FRNUM_MASK		0x0000ffff
487 
488 #define	HPTXSTS_ODD			(1<<31)
489 #define	HPTXSTS_CHAN_SHIFT		27
490 #define	HPTXSTS_CHAN_MASK		0x78000000
491 #define	HPTXSTS_TOKEN_SHIFT		25
492 #define	HPTXSTS_TOKEN_MASK		0x06000000
493 #define	HPTXSTS_TOKEN_ZL		0
494 #define	HPTXSTS_TOKEN_PING		1
495 #define	HPTXSTS_TOKEN_DISABLE		2
496 #define	HPTXSTS_TERMINATE		(1<<24)
497 #define	HPTXSTS_PTXQSPCAVAIL_SHIFT	16
498 #define	HPTXSTS_PTXQSPCAVAIL_MASK	0x00ff0000
499 #define	HPTXSTS_PTXFSPCAVAIL_SHIFT	0
500 #define	HPTXSTS_PTXFSPCAVAIL_MASK	0x0000ffff
501 
502 #define	HAINT_HAINT_SHIFT		0
503 #define	HAINT_HAINT_MASK		0x0000ffff
504 #define	HAINTMSK_HAINTMSK_SHIFT		0
505 #define	HAINTMSK_HAINTMSK_MASK		0x0000ffff
506 
507 #define	HPRT_PRTSPD_SHIFT		17
508 #define	HPRT_PRTSPD_MASK		0x00060000
509 #define	HPRT_PRTSPD_HIGH		0
510 #define	HPRT_PRTSPD_FULL		1
511 #define	HPRT_PRTSPD_LOW			2
512 #define	HPRT_PRTSPD_MASK		0x00060000
513 #define	HPRT_PRTTSTCTL_SHIFT		13
514 #define	HPRT_PRTTSTCTL_MASK		0x0001e000
515 #define	HPRT_PRTPWR			(1<<12)
516 #define	HPRT_PRTLNSTS_SHIFT		10
517 #define	HPRT_PRTLNSTS_MASK		0x00000c00
518 #define	HPRT_PRTRST			(1<<8)
519 #define	HPRT_PRTSUSP			(1<<7)
520 #define	HPRT_PRTRES			(1<<6)
521 #define	HPRT_PRTOVRCURRCHNG		(1<<5)
522 #define	HPRT_PRTOVRCURRACT		(1<<4)
523 #define	HPRT_PRTENCHNG			(1<<3)
524 #define	HPRT_PRTENA			(1<<2)
525 #define	HPRT_PRTCONNDET			(1<<1)
526 #define	HPRT_PRTCONNSTS			(1<<0)
527 
528 #define	HCCHAR_CHENA			(1<<31)
529 #define	HCCHAR_CHDIS			(1<<30)
530 #define	HCCHAR_ODDFRM			(1<<29)
531 #define	HCCHAR_DEVADDR_SHIFT		22
532 #define	HCCHAR_DEVADDR_MASK		0x1fc00000
533 #define	HCCHAR_MC_SHIFT			20
534 #define	HCCHAR_MC_MASK			0x00300000
535 #define	HCCHAR_EPTYPE_SHIFT		18
536 #define	HCCHAR_EPTYPE_MASK		0x000c0000
537 #define	HCCHAR_LSPDDEV			(1<<17)
538 #define	HCCHAR_EPDIR			(1<<15)
539 #define	HCCHAR_EPDIR_IN			(1<<15)
540 #define	HCCHAR_EPDIR_OUT		0
541 #define	HCCHAR_EPNUM_SHIFT		11
542 #define	HCCHAR_EPNUM_MASK		0x00007800
543 #define	HCCHAR_MPS_SHIFT		0
544 #define	HCCHAR_MPS_MASK			0x000007ff
545 
546 #define	HCSPLT_SPLTENA			(1<<31)
547 #define	HCSPLT_COMPSPLT			(1<<16)
548 #define	HCSPLT_XACTPOS_SHIFT		14
549 #define	HCSPLT_XACTPOS_MASK		0x0000c000
550 #define	HCSPLT_XACTPOS_MIDDLE		0
551 #define	HCSPLT_XACTPOS_LAST		1
552 #define	HCSPLT_XACTPOS_BEGIN		2
553 #define	HCSPLT_XACTPOS_ALL		3
554 #define	HCSPLT_XACTLEN_BURST		1023	/* bytes */
555 #define	HCSPLT_HUBADDR_SHIFT		7
556 #define	HCSPLT_HUBADDR_MASK		0x00003f80
557 #define	HCSPLT_PRTADDR_SHIFT		0
558 #define	HCSPLT_PRTADDR_MASK		0x0000007f
559 
560 #define	HCINT_ERRORS \
561     (HCINT_BBLERR | HCINT_XACTERR)
562 #define	HCINT_RETRY \
563     (HCINT_DATATGLERR | HCINT_FRMOVRUN | HCINT_NAK)
564 #define	HCINT_DEFAULT_MASK \
565   (HCINT_STALL | HCINT_BBLERR | \
566    HCINT_XACTERR | HCINT_NAK | HCINT_ACK | HCINT_NYET | \
567    HCINT_CHHLTD | HCINT_FRMOVRUN | \
568    HCINT_DATATGLERR)
569 #define	HCINT_HCH_DONE_MASK \
570   (HCINT_ACK | HCINT_RETRY | HCINT_NYET | \
571    HCINT_ERRORS | HCINT_STALL | HCINT_SOFTWARE_ONLY)
572 
573 #define	HCINT_SOFTWARE_ONLY		(1<<20)	/* BSD only */
574 #define	HCINT_DATATGLERR		(1<<10)
575 #define	HCINT_FRMOVRUN			(1<<9)
576 #define	HCINT_BBLERR			(1<<8)
577 #define	HCINT_XACTERR			(1<<7)
578 #define	HCINT_NYET			(1<<6)
579 #define	HCINT_ACK			(1<<5)
580 #define	HCINT_NAK			(1<<4)
581 #define	HCINT_STALL			(1<<3)
582 #define	HCINT_AHBERR			(1<<2)
583 #define	HCINT_CHHLTD			(1<<1)
584 #define	HCINT_XFERCOMPL			(1<<0)
585 
586 #define	HCINTMSK_DATATGLERRMSK		(1<<10)
587 #define	HCINTMSK_FRMOVRUNMSK		(1<<9)
588 #define	HCINTMSK_BBLERRMSK		(1<<8)
589 #define	HCINTMSK_XACTERRMSK		(1<<7)
590 #define	HCINTMSK_NYETMSK		(1<<6)
591 #define	HCINTMSK_ACKMSK			(1<<5)
592 #define	HCINTMSK_NAKMSK			(1<<4)
593 #define	HCINTMSK_STALLMSK		(1<<3)
594 #define	HCINTMSK_AHBERRMSK		(1<<2)
595 #define	HCINTMSK_CHHLTDMSK		(1<<1)
596 #define	HCINTMSK_XFERCOMPLMSK		(1<<0)
597 
598 #define	HCTSIZ_DOPNG			(1<<31)
599 #define	HCTSIZ_PID_SHIFT		29
600 #define	HCTSIZ_PID_MASK			0x60000000
601 #define	HCTSIZ_PID_DATA0		0
602 #define	HCTSIZ_PID_DATA2		1
603 #define	HCTSIZ_PID_DATA1		2
604 #define	HCTSIZ_PID_MDATA		3
605 #define	HCTSIZ_PID_SETUP		3
606 #define	HCTSIZ_PKTCNT_SHIFT		19
607 #define	HCTSIZ_PKTCNT_MASK		0x1ff80000
608 #define	HCTSIZ_XFERSIZE_SHIFT		0
609 #define	HCTSIZ_XFERSIZE_MASK		0x0007ffff
610 
611 #define	DCFG_EPMISCNT_SHIFT		18
612 #define	DCFG_EPMISCNT_MASK		0x007c0000
613 #define	DCFG_PERFRINT_SHIFT		11
614 #define	DCFG_PERFRINT_MASK		0x00001800
615 #define	DCFG_DEVADDR_SHIFT		4
616 #define	DCFG_DEVADDR_MASK		0x000007f0
617 #define	DCFG_DEVADDR_SET(x)		(((x) & 0x7F) << 4)
618 #define	DCFG_NZSTSOUTHSHK		(1<<2)
619 #define	DCFG_DEVSPD_SHIFT		0
620 #define	DCFG_DEVSPD_MASK		0x00000003
621 #define	DCFG_DEVSPD_SET(x)		((x) & 0x3)
622 #define	DCFG_DEVSPD_HI			0
623 #define	DCFG_DEVSPD_FULL20		1
624 #define	DCFG_DEVSPD_FULL10		3
625 
626 #define	DCTL_PWRONPRGDONE		(1<<11)
627 #define	DCTL_CGOUTNAK			(1<<10)
628 #define	DCTL_SGOUTNAK			(1<<9)
629 #define	DCTL_CGNPINNAK			(1<<8)
630 #define	DCTL_SGNPINNAK			(1<<7)
631 #define	DCTL_TSTCTL_SHIFT		4
632 #define	DCTL_TSTCTL_MASK		0x00000070
633 #define	DCTL_GOUTNAKSTS			(1<<3)
634 #define	DCTL_GNPINNAKSTS		(1<<2)
635 #define	DCTL_SFTDISCON			(1<<1)
636 #define	DCTL_RMTWKUPSIG			(1<<0)
637 
638 #define	DSTS_SOFFN_SHIFT		8
639 #define	DSTS_SOFFN_MASK			0x003fff00
640 #define	DSTS_SOFFN_GET(x)		(((x) >> 8) & 0x3FFF)
641 #define	DSTS_ERRTICERR			(1<<3)
642 #define	DSTS_ENUMSPD_SHIFT		1
643 #define	DSTS_ENUMSPD_MASK		0x00000006
644 #define	DSTS_ENUMSPD_GET(x)		(((x) >> 1) & 3)
645 #define	DSTS_ENUMSPD_HI			0
646 #define	DSTS_ENUMSPD_FULL20		1
647 #define	DSTS_ENUMSPD_LOW10		2
648 #define	DSTS_ENUMSPD_FULL10		3
649 #define	DSTS_SUSPSTS			(1<<0)
650 
651 #define	DIEPMSK_TXFIFOUNDRNMSK		(1<<8)
652 #define	DIEPMSK_INEPNAKEFFMSK		(1<<6)
653 #define	DIEPMSK_INTKNEPMISMSK		(1<<5)
654 #define	DIEPMSK_INTKNTXFEMPMSK		(1<<4)
655 #define	DIEPMSK_FIFOEMPTY		(1<<4)
656 #define	DIEPMSK_TIMEOUTMSK		(1<<3)
657 #define	DIEPMSK_AHBERRMSK		(1<<2)
658 #define	DIEPMSK_EPDISBLDMSK		(1<<1)
659 #define	DIEPMSK_XFERCOMPLMSK		(1<<0)
660 
661 #define	DOEPMSK_OUTPKTERRMSK		(1<<8)
662 #define	DOEPMSK_BACK2BACKSETUP		(1<<6)
663 #define	DOEPMSK_OUTTKNEPDISMSK		(1<<4)
664 #define	DOEPMSK_FIFOEMPTY		(1<<4)
665 #define	DOEPMSK_SETUPMSK		(1<<3)
666 #define	DOEPMSK_AHBERRMSK		(1<<2)
667 #define	DOEPMSK_EPDISBLDMSK		(1<<1)
668 #define	DOEPMSK_XFERCOMPLMSK		(1<<0)
669 
670 #define	DIEPINT_TXFIFOUNDRN		(1<<8)
671 #define	DIEPINT_INEPNAKEFF		(1<<6)
672 #define	DIEPINT_INTKNEPMIS		(1<<5)
673 #define	DIEPINT_INTKNTXFEMP		(1<<4)
674 #define	DIEPINT_TIMEOUT			(1<<3)
675 #define	DIEPINT_AHBERR			(1<<2)
676 #define	DIEPINT_EPDISBLD		(1<<1)
677 #define	DIEPINT_XFERCOMPL		(1<<0)
678 
679 #define	DOEPINT_OUTPKTERR		(1<<8)
680 #define	DOEPINT_BACK2BACKSETUP		(1<<6)
681 #define	DOEPINT_OUTTKNEPDIS		(1<<4)
682 #define	DOEPINT_SETUP			(1<<3)
683 #define	DOEPINT_AHBERR			(1<<2)
684 #define	DOEPINT_EPDISBLD		(1<<1)
685 #define	DOEPINT_XFERCOMPL		(1<<0)
686 
687 #define	DAINT_INEPINT_MASK		0xffff0000
688 #define	DAINT_INEPINT_SHIFT		0
689 #define	DAINT_OUTEPINT_MASK		0x0000ffff
690 #define	DAINT_OUTEPINT_SHIFT		16
691 
692 #define	DAINTMSK_INEPINT_MASK		0xffff0000
693 #define	DAINTMSK_INEPINT_SHIFT		0
694 #define	DAINTMSK_OUTEPINT_MASK		0x0000ffff
695 #define	DAINTMSK_OUTEPINT_SHIFT		16
696 
697 #define	DTKNQR1_EPTKN_SHIFT		8
698 #define	DTKNQR1_EPTKN_MASK		0xffffff00
699 #define	DTKNQR1_WRAPBIT			(1<<7)
700 #define	DTKNQR1_INTKNWPTR_SHIFT		0
701 #define	DTKNQR1_INTKNWPTR_MASK		0x0000001f
702 
703 #define	DVBUSDIS_DVBUSDIS_SHIFT		0
704 #define	DVBUSDIS_DVBUSDIS_MASK		0x0000ffff
705 
706 #define	DVBUSPULSE_DVBUSPULSE_SHIFT	0
707 #define	DVBUSPULSE_DVBUSPULSE_MASK	0x00000fff
708 
709 #define	DTHRCTL_ARBPRKEN		(1<<27)
710 #define	DTHRCTL_RXTHRLEN_SHIFT		17
711 #define	DTHRCTL_RXTHRLEN_MASK		0x03fe0000
712 #define	DTHRCTL_RXTHREN			(1<<16)
713 #define	DTHRCTL_TXTHRLEN_SHIFT		2
714 #define	DTHRCTL_TXTHRLEN_MASK		0x000007fc
715 #define	DTHRCTL_ISOTHREN		(1<<1)
716 #define	DTHRCTL_NONISOTHREN		(1<<0)
717 
718 #define	DIEPEMPMSK_INEPTXFEMPMSK_SHIFT	0
719 #define	DIEPEMPMSK_INEPTXFEMPMSK_MASK	0x0000ffff
720 
721 #define	DIEPCTL_EPENA			(1<<31)
722 #define	DIEPCTL_EPDIS			(1<<30)
723 #define	DIEPCTL_SETD1PID		(1<<29)
724 #define	DIEPCTL_SETD0PID		(1<<28)
725 #define	DIEPCTL_SNAK			(1<<27)
726 #define	DIEPCTL_CNAK			(1<<26)
727 #define	DIEPCTL_TXFNUM_SHIFT		22
728 #define	DIEPCTL_TXFNUM_MASK		0x03c00000
729 #define	DIEPCTL_TXFNUM_SET(n)		(((n) & 15) << 22)
730 #define	DIEPCTL_STALL			(1<<21)
731 #define	DIEPCTL_EPTYPE_SHIFT		18
732 #define	DIEPCTL_EPTYPE_MASK		0x000c0000
733 #define	DIEPCTL_EPTYPE_SET(n)		(((n) & 3) << 18)
734 #define	DIEPCTL_EPTYPE_CONTROL		0
735 #define	DIEPCTL_EPTYPE_ISOC		1
736 #define	DIEPCTL_EPTYPE_BULK		2
737 #define	DIEPCTL_EPTYPE_INTERRUPT	3
738 #define	DIEPCTL_NAKSTS			(1<<17)
739 #define	DIEPCTL_USBACTEP		(1<<15)
740 #define	DIEPCTL_NEXTEP_SHIFT		11
741 #define	DIEPCTL_NEXTEP_MASK		0x00007800
742 #define	DIEPCTL_MPS_SHIFT		0
743 #define	DIEPCTL_MPS_MASK		0x000007ff
744 #define	DIEPCTL_MPS_SET(n)		((n) & 0x7FF)
745 #define	DIEPCTL_MPS_64			(0<<0)
746 #define	DIEPCTL_MPS_32			(1<<0)
747 #define	DIEPCTL_MPS_16			(2<<0)
748 #define	DIEPCTL_MPS_8			(3<<0)
749 
750 #define	DOEPCTL_EPENA			(1<<31)
751 #define	DOEPCTL_EPDIS			(1<<30)
752 #define	DOEPCTL_SETD1PID		(1<<29)
753 #define	DOEPCTL_SETD0PID		(1<<28)
754 #define	DOEPCTL_SNAK			(1<<27)
755 #define	DOEPCTL_CNAK			(1<<26)
756 #define	DOEPCTL_FNUM_SET(n)		(((n) & 15) << 22)
757 #define	DOEPCTL_STALL			(1<<21)
758 #define	DOEPCTL_EPTYPE_SHIFT		18
759 #define	DOEPCTL_EPTYPE_MASK		0x000c0000
760 #define	DOEPCTL_EPTYPE_SET(n)		(((n) & 3) << 18)
761 #define	DOEPCTL_NAKSTS			(1<<17)
762 #define	DOEPCTL_USBACTEP		(1<<15)
763 #define	DOEPCTL_MPS_SHIFT		0
764 #define	DOEPCTL_MPS_MASK		0x000007ff
765 #define	DOEPCTL_MPS_SET(n)		((n) & 0x7FF)
766 #define	DOEPCTL_MPS_64			(0<<0)
767 #define	DOEPCTL_MPS_32			(1<<0)
768 #define	DOEPCTL_MPS_16			(2<<0)
769 #define	DOEPCTL_MPS_8			(3<<0)
770 
771 /* common bits */
772 #define	DXEPINT_TXFEMP			(1<<7)
773 #define	DXEPINT_SETUP			(1<<3)
774 #define	DXEPINT_XFER_COMPL		(1<<0)
775 
776 #define	DIEPTSIZ_XFERSIZE_MASK		0x0007ffff
777 #define	DIEPTSIZ_XFERSIZE_SHIFT		0
778 #define	DIEPTSIZ_PKTCNT_MASK		0x1ff80000
779 #define	DIEPTSIZ_PKTCNT_SHIFT		19
780 #define	DIEPTSIZ_MC_MASK		0x60000000
781 #define	DIEPTSIZ_MC_SHIFT		29
782 
783 #define	DOEPTSIZ_XFERSIZE_MASK		0x0007ffff
784 #define	DOEPTSIZ_XFERSIZE_SHIFT		0
785 #define	DOEPTSIZ_PKTCNT_MASK		0x1ff80000
786 #define	DOEPTSIZ_PKTCNT_SHIFT		19
787 #define	DOEPTSIZ_MC_MASK		0x60000000
788 #define	DOEPTSIZ_MC_SHIFT		29
789 
790 /* common bits */
791 #define	DXEPTSIZ_SET_MULTI(n)		(((n) & 3) << 29)
792 #define	DXEPTSIZ_SET_NPKT(n)		(((n) & 0x3FF) << 19)
793 #define	DXEPTSIZ_GET_NPKT(n)		(((n) >> 19) & 0x3FF)
794 #define	DXEPTSIZ_SET_NBYTES(n)		(((n) & 0x7FFFFF) << 0)
795 #define	DXEPTSIZ_GET_NBYTES(n)		(((n) >> 0) & 0x7FFFFF)
796 
797 /* generic endpoint mask */
798 
799 #define	ENDPOINT_MASK(x,in) \
800 	((in) ? (1U << ((x) & 15U)) : \
801 	 (0x10000U << ((x) & 15U)))
802 
803 #endif					/* _DWC_OTGREG_H_ */
804