libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
otg_common.h
Go to the documentation of this file.
1/*
2 * This file is part of the libopencm3 project.
3 *
4 * Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
5 *
6 * This library is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/*
21 * This file is intended to be included by either otg_hs.h or otg_fs.h
22 * It contains register definitions common to chips using DesignWare
23 * USB OTG controllers, including STM32 and EFM32
24 */
25
26#ifndef LIBOPENCM3_USB_DWC_OTG_COMMON_H
27#define LIBOPENCM3_USB_DWC_OTG_COMMON_H
28
29/* Core Global Control and Status Registers */
30#define OTG_GOTGCTL 0x000
31#define OTG_GOTGINT 0x004
32#define OTG_GAHBCFG 0x008
33#define OTG_GUSBCFG 0x00C
34#define OTG_GRSTCTL 0x010
35#define OTG_GINTSTS 0x014
36#define OTG_GINTMSK 0x018
37#define OTG_GRXSTSR 0x01C
38#define OTG_GRXSTSP 0x020
39#define OTG_GRXFSIZ 0x024
40#define OTG_GNPTXFSIZ 0x028
41#define OTG_GNPTXSTS 0x02C
42#define OTG_GCCFG 0x038
43#define OTG_CID 0x03C
44#define OTG_HPTXFSIZ 0x100
45#define OTG_DIEPTXF(x) (0x104 + 4*((x)-1))
46
47/* Host-mode Control and Status Registers */
48#define OTG_HCFG 0x400
49#define OTG_HFIR 0x404
50#define OTG_HFNUM 0x408
51#define OTG_HPTXSTS 0x410
52#define OTG_HAINT 0x414
53#define OTG_HAINTMSK 0x418
54#define OTG_HPRT 0x440
55#define OTG_HCCHAR(x) (0x500 + 0x20*(x))
56#define OTG_HCINT(x) (0x508 + 0x20*(x))
57#define OTG_HCINTMSK(x) (0x50C + 0x20*(x))
58#define OTG_HCTSIZ(x) (0x510 + 0x20*(x))
59
60
61/* Device-mode Control and Status Registers */
62#define OTG_DCFG 0x800
63#define OTG_DCTL 0x804
64#define OTG_DSTS 0x808
65#define OTG_DIEPMSK 0x810
66#define OTG_DOEPMSK 0x814
67#define OTG_DAINT 0x818
68#define OTG_DAINTMSK 0x81C
69#define OTG_DVBUSDIS 0x828
70#define OTG_DVBUSPULSE 0x82C
71#define OTG_DIEPEMPMSK 0x834
72
73#define OTG_DIEPCTL0 0x900
74#define OTG_DIEPCTL(x) (0x900 + 0x20*(x))
75#define OTG_DOEPCTL0 0xB00
76#define OTG_DOEPCTL(x) (0xB00 + 0x20*(x))
77#define OTG_DIEPINT(x) (0x908 + 0x20*(x))
78#define OTG_DOEPINT(x) (0xB08 + 0x20*(x))
79#define OTG_DIEPTSIZ0 0x910
80#define OTG_DIEPTSIZ(x) (0x910 + 0x20*(x))
81#define OTG_DOEPTSIZ0 0xB10
82#define OTG_DOEPTSIZ(x) (0xB10 + 0x20*(x))
83#define OTG_DTXFSTS(x) (0x918 + 0x20*(x))
84
85/* Power and clock gating control and status register */
86#define OTG_PCGCCTL 0xE00
87
88/* Data FIFO */
89#define OTG_FIFO(x) (((x) + 1) << 12)
90
91
92/* Global CSRs */
93/* OTG USB control registers (OTG_GOTGCTL) */
94#define OTG_GOTGCTL_BSVLD (1 << 19)
95#define OTG_GOTGCTL_ASVLD (1 << 18)
96#define OTG_GOTGCTL_DBCT (1 << 17)
97#define OTG_GOTGCTL_CIDSTS (1 << 16)
98#define OTG_GOTGCTL_DHNPEN (1 << 11)
99#define OTG_GOTGCTL_HSHNPEN (1 << 10)
100#define OTG_GOTGCTL_HNPRQ (1 << 9)
101#define OTG_GOTGCTL_HNGSCS (1 << 8)
102#define OTG_GOTGCTL_SRQ (1 << 1)
103#define OTG_GOTGCTL_SRQSCS (1 << 0)
104
105/* OTG USB control registers (OTG_GOTGINT) */
106#define OTG_GOTGINT_DBCDNE (1 << 19)
107#define OTG_GOTGINT_ADTOCHG (1 << 18)
108#define OTG_GOTGINT_HNGDET (1 << 17)
109#define OTG_GOTGINT_HNSSCHG (1 << 9)
110#define OTG_GOTGINT_SRSSCHG (1 << 8)
111#define OTG_GOTGINT_SEDET (1 << 2)
112
113/* OTG AHB configuration register (OTG_GAHBCFG) */
114#define OTG_GAHBCFG_GINT 0x0001
115#define OTG_GAHBCFG_TXFELVL 0x0080
116#define OTG_GAHBCFG_PTXFELVL 0x0100
117
118/* OTG USB configuration register (OTG_GUSBCFG) */
119#define OTG_GUSBCFG_TOCAL 0x00000003
120#define OTG_GUSBCFG_SRPCAP 0x00000100
121#define OTG_GUSBCFG_HNPCAP 0x00000200
122#define OTG_GUSBCFG_TRDT_MASK (0xf << 10)
123#define OTG_GUSBCFG_NPTXRWEN 0x00004000
124#define OTG_GUSBCFG_FHMOD 0x20000000
125#define OTG_GUSBCFG_FDMOD 0x40000000
126#define OTG_GUSBCFG_CTXPKT 0x80000000
127#define OTG_GUSBCFG_PHYSEL (1 << 6)
128
129/* OTG reset register (OTG_GRSTCTL) */
130#define OTG_GRSTCTL_AHBIDL (1 << 31)
131/* Bits 30:11 - Reserved */
132#define OTG_GRSTCTL_TXFNUM_MASK (0x1f << 6)
133#define OTG_GRSTCTL_TXFNUM_ALL (0x10 << 6)
134#define OTG_GRSTCTL_TXFFLSH (1 << 5)
135#define OTG_GRSTCTL_RXFFLSH (1 << 4)
136/* Bit 3 - Reserved */
137#define OTG_GRSTCTL_FCRST (1 << 2)
138#define OTG_GRSTCTL_HSRST (1 << 1)
139#define OTG_GRSTCTL_CSRST (1 << 0)
140
141/* OTG interrupt status register (OTG_GINTSTS) */
142#define OTG_GINTSTS_WKUPINT (1 << 31)
143#define OTG_GINTSTS_SRQINT (1 << 30)
144#define OTG_GINTSTS_DISCINT (1 << 29)
145#define OTG_GINTSTS_CIDSCHG (1 << 28)
146/* Bit 27 - Reserved */
147#define OTG_GINTSTS_PTXFE (1 << 26)
148#define OTG_GINTSTS_HCINT (1 << 25)
149#define OTG_GINTSTS_HPRTINT (1 << 24)
150/* Bits 23:22 - Reserved */
151#define OTG_GINTSTS_IPXFR (1 << 21)
152#define OTG_GINTSTS_INCOMPISOOUT (1 << 21)
153#define OTG_GINTSTS_IISOIXFR (1 << 20)
154#define OTG_GINTSTS_OEPINT (1 << 19)
155#define OTG_GINTSTS_IEPINT (1 << 18)
156/* Bits 17:16 - Reserved */
157#define OTG_GINTSTS_EOPF (1 << 15)
158#define OTG_GINTSTS_ISOODRP (1 << 14)
159#define OTG_GINTSTS_ENUMDNE (1 << 13)
160#define OTG_GINTSTS_USBRST (1 << 12)
161#define OTG_GINTSTS_USBSUSP (1 << 11)
162#define OTG_GINTSTS_ESUSP (1 << 10)
163/* Bits 9:8 - Reserved */
164#define OTG_GINTSTS_GONAKEFF (1 << 7)
165#define OTG_GINTSTS_GINAKEFF (1 << 6)
166#define OTG_GINTSTS_NPTXFE (1 << 5)
167#define OTG_GINTSTS_RXFLVL (1 << 4)
168#define OTG_GINTSTS_SOF (1 << 3)
169#define OTG_GINTSTS_OTGINT (1 << 2)
170#define OTG_GINTSTS_MMIS (1 << 1)
171#define OTG_GINTSTS_CMOD (1 << 0)
172
173/* OTG interrupt mask register (OTG_GINTMSK) */
174#define OTG_GINTMSK_MMISM 0x00000002
175#define OTG_GINTMSK_OTGINT 0x00000004
176#define OTG_GINTMSK_SOFM 0x00000008
177#define OTG_GINTMSK_RXFLVLM 0x00000010
178#define OTG_GINTMSK_NPTXFEM 0x00000020
179#define OTG_GINTMSK_GINAKEFFM 0x00000040
180#define OTG_GINTMSK_GONAKEFFM 0x00000080
181#define OTG_GINTMSK_ESUSPM 0x00000400
182#define OTG_GINTMSK_USBSUSPM 0x00000800
183#define OTG_GINTMSK_USBRST 0x00001000
184#define OTG_GINTMSK_ENUMDNEM 0x00002000
185#define OTG_GINTMSK_ISOODRPM 0x00004000
186#define OTG_GINTMSK_EOPFM 0x00008000
187#define OTG_GINTMSK_EPMISM 0x00020000
188#define OTG_GINTMSK_IEPINT 0x00040000
189#define OTG_GINTMSK_OEPINT 0x00080000
190#define OTG_GINTMSK_IISOIXFRM 0x00100000
191#define OTG_GINTMSK_IISOOXFRM 0x00200000
192#define OTG_GINTMSK_IPXFRM 0x00200000
193#define OTG_GINTMSK_PRTIM 0x01000000
194#define OTG_GINTMSK_HCIM 0x02000000
195#define OTG_GINTMSK_PTXFEM 0x04000000
196#define OTG_GINTMSK_CIDSCHGM 0x10000000
197#define OTG_GINTMSK_DISCINT 0x20000000
198#define OTG_GINTMSK_SRQIM 0x40000000
199#define OTG_GINTMSK_WUIM 0x80000000
200
201/* OTG Receive Status Pop Register (OTG_GRXSTSP) */
202/* Bits 31:25 - Reserved */
203#define OTG_GRXSTSP_FRMNUM_MASK (0xf << 21)
204#define OTG_GRXSTSP_PKTSTS_MASK (0xf << 17)
205#define OTG_GRXSTSP_PKTSTS_GOUTNAK (0x1 << 17)
206#define OTG_GRXSTSP_PKTSTS_OUT (0x2 << 17)
207#define OTG_GRXSTSP_PKTSTS_IN (0x2 << 17)
208#define OTG_GRXSTSP_PKTSTS_OUT_COMP (0x3 << 17)
209#define OTG_GRXSTSP_PKTSTS_IN_COMP (0x3 << 17)
210#define OTG_GRXSTSP_PKTSTS_SETUP_COMP (0x4 << 17)
211#define OTG_GRXSTSP_PKTSTS_DTERR (0x5 << 17)
212#define OTG_GRXSTSP_PKTSTS_SETUP (0x6 << 17)
213#define OTG_GRXSTSP_PKTSTS_CHH (0x7 << 17)
214#define OTG_GRXSTSP_DPID_MASK (0x3 << 15)
215#define OTG_GRXSTSP_DPID_DATA0 (0x0 << 15)
216#define OTG_GRXSTSP_DPID_DATA1 (0x2 << 15)
217#define OTG_GRXSTSP_DPID_DATA2 (0x1 << 15)
218#define OTG_GRXSTSP_DPID_MDATA (0x3 << 15)
219#define OTG_GRXSTSP_BCNT_MASK (0x7ff << 4)
220#define OTG_GRXSTSP_EPNUM_MASK (0xf << 0)
221
222/* Bits 31:22 - Reserved */
223/** Only on cores < 0x2000 */
224#define OTG_GCCFG_NOVBUSSENS (1 << 21)
225/** Only on cores >= 0x2000 */
226#define OTG_GCCFG_VBDEN (1 << 21)
227#define OTG_GCCFG_SOFOUTEN (1 << 20)
228#define OTG_GCCFG_VBUSBSEN (1 << 19)
229#define OTG_GCCFG_VBUSASEN (1 << 18)
230/* Bit 17 - Reserved */
231#define OTG_GCCFG_PWRDWN (1 << 16)
232/* Bits 15:0 - Reserved */
233
234/* OTG FS Product ID register (OTG_CID) */
235#define OTG_CID_HAS_VBDEN 0x00002000
236
237/* Device-mode CSRs */
238/* OTG device control register (OTG_DCTL) */
239/* Bits 31:12 - Reserved */
240#define OTG_DCTL_POPRGDNE (1 << 11)
241#define OTG_DCTL_CGONAK (1 << 10)
242#define OTG_DCTL_SGONAK (1 << 9)
243#define OTG_DCTL_SGINAK (1 << 8)
244#define OTG_DCTL_TCTL_MASK (7 << 4)
245#define OTG_DCTL_GONSTS (1 << 3)
246#define OTG_DCTL_GINSTS (1 << 2)
247#define OTG_DCTL_SDIS (1 << 1)
248#define OTG_DCTL_RWUSIG (1 << 0)
249
250/* OTG device configuration register (OTG_DCFG) */
251#define OTG_DCFG_DSPD 0x0003
252#define OTG_DCFG_NZLSOHSK 0x0004
253#define OTG_DCFG_DAD 0x07F0
254#define OTG_DCFG_PFIVL 0x1800
255
256/* OTG device status register (OTG_DSTS) */
257#define OTG_DSTS_SUSPSTS (1 << 0)
258
259/* OTG Device IN Endpoint Common Interrupt Mask Register (OTG_DIEPMSK) */
260/* Bits 31:10 - Reserved */
261#define OTG_DIEPMSK_BIM (1 << 9)
262#define OTG_DIEPMSK_TXFURM (1 << 8)
263/* Bit 7 - Reserved */
264#define OTG_DIEPMSK_INEPNEM (1 << 6)
265#define OTG_DIEPMSK_INEPNMM (1 << 5)
266#define OTG_DIEPMSK_ITTXFEMSK (1 << 4)
267#define OTG_DIEPMSK_TOM (1 << 3)
268/* Bit 2 - Reserved */
269#define OTG_DIEPMSK_EPDM (1 << 1)
270#define OTG_DIEPMSK_XFRCM (1 << 0)
271
272/* OTG Device OUT Endpoint Common Interrupt Mask Register (OTG_DOEPMSK) */
273/* Bits 31:10 - Reserved */
274#define OTG_DOEPMSK_BOIM (1 << 9)
275#define OTG_DOEPMSK_OPEM (1 << 8)
276/* Bit 7 - Reserved */
277#define OTG_DOEPMSK_B2BSTUP (1 << 6)
278/* Bit 5 - Reserved */
279#define OTG_DOEPMSK_OTEPDM (1 << 4)
280#define OTG_DOEPMSK_STUPM (1 << 3)
281/* Bit 2 - Reserved */
282#define OTG_DOEPMSK_EPDM (1 << 1)
283#define OTG_DOEPMSK_XFRCM (1 << 0)
284
285/* OTG Device Control IN Endpoint 0 Control Register (OTG_DIEPCTL0) */
286#define OTG_DIEPCTL0_EPENA (1 << 31)
287#define OTG_DIEPCTL0_EPDIS (1 << 30)
288/* Bits 29:28 - Reserved */
289#define OTG_DIEPCTLX_SD0PID (1 << 28)
290#define OTG_DIEPCTL0_SNAK (1 << 27)
291#define OTG_DIEPCTL0_CNAK (1 << 26)
292#define OTG_DIEPCTL0_TXFNUM_MASK (0xf << 22)
293#define OTG_DIEPCTL0_STALL (1 << 21)
294/* Bit 20 - Reserved */
295#define OTG_DIEPCTL0_EPTYP_MASK (0x3 << 18)
296#define OTG_DIEPCTL0_NAKSTS (1 << 17)
297/* Bit 16 - Reserved */
298#define OTG_DIEPCTL0_USBAEP (1 << 15)
299/* Bits 14:2 - Reserved */
300#define OTG_DIEPCTL0_MPSIZ_MASK (0x3 << 0)
301#define OTG_DIEPCTL0_MPSIZ_64 (0x0 << 0)
302#define OTG_DIEPCTL0_MPSIZ_32 (0x1 << 0)
303#define OTG_DIEPCTL0_MPSIZ_16 (0x2 << 0)
304#define OTG_DIEPCTL0_MPSIZ_8 (0x3 << 0)
305
306/* OTG Device Control OUT Endpoint 0 Control Register (OTG_DOEPCTL0) */
307#define OTG_DOEPCTL0_EPENA (1 << 31)
308#define OTG_DOEPCTL0_EPDIS (1 << 30)
309/* Bits 29:28 - Reserved */
310#define OTG_DOEPCTLX_SD0PID (1 << 28)
311#define OTG_DOEPCTL0_SNAK (1 << 27)
312#define OTG_DOEPCTL0_CNAK (1 << 26)
313/* Bits 25:22 - Reserved */
314#define OTG_DOEPCTL0_STALL (1 << 21)
315#define OTG_DOEPCTL0_SNPM (1 << 20)
316#define OTG_DOEPCTL0_EPTYP_MASK (0x3 << 18)
317#define OTG_DOEPCTL0_NAKSTS (1 << 17)
318/* Bit 16 - Reserved */
319#define OTG_DOEPCTL0_USBAEP (1 << 15)
320/* Bits 14:2 - Reserved */
321#define OTG_DOEPCTL0_MPSIZ_MASK (0x3 << 0)
322#define OTG_DOEPCTL0_MPSIZ_64 (0x0 << 0)
323#define OTG_DOEPCTL0_MPSIZ_32 (0x1 << 0)
324#define OTG_DOEPCTL0_MPSIZ_16 (0x2 << 0)
325#define OTG_DOEPCTL0_MPSIZ_8 (0x3 << 0)
326
327/* OTG Device IN Endpoint Interrupt Register (OTG_DIEPINTx) */
328/* Bits 31:8 - Reserved */
329#define OTG_DIEPINTX_TXFE (1 << 7)
330#define OTG_DIEPINTX_INEPNE (1 << 6)
331/* Bit 5 - Reserved */
332#define OTG_DIEPINTX_ITTXFE (1 << 4)
333#define OTG_DIEPINTX_TOC (1 << 3)
334/* Bit 2 - Reserved */
335#define OTG_DIEPINTX_EPDISD (1 << 1)
336#define OTG_DIEPINTX_XFRC (1 << 0)
337
338/* OTG Device IN Endpoint Interrupt Register (OTG_DOEPINTx) */
339/* Bits 31:7 - Reserved */
340#define OTG_DOEPINTX_B2BSTUP (1 << 6)
341/* Bit 5 - Reserved */
342#define OTG_DOEPINTX_OTEPDIS (1 << 4)
343#define OTG_DOEPINTX_STUP (1 << 3)
344/* Bit 2 - Reserved */
345#define OTG_DOEPINTX_EPDISD (1 << 1)
346#define OTG_DOEPINTX_XFRC (1 << 0)
347
348/* OTG Device OUT Endpoint 0 Transfer Size Register (OTG_DOEPTSIZ0) */
349/* Bit 31 - Reserved */
350#define OTG_DIEPSIZ0_STUPCNT_1 (0x1 << 29)
351#define OTG_DIEPSIZ0_STUPCNT_2 (0x2 << 29)
352#define OTG_DIEPSIZ0_STUPCNT_3 (0x3 << 29)
353#define OTG_DIEPSIZ0_STUPCNT_MASK (0x3 << 29)
354/* Bits 28:20 - Reserved */
355#define OTG_DIEPSIZ0_PKTCNT (1 << 19)
356/* Bits 18:7 - Reserved */
357#define OTG_DIEPSIZ0_XFRSIZ_MASK (0x7f << 0)
358
359
360
361/* Host-mode CSRs */
362/* OTG Host non-periodic transmit FIFO size register
363(OTG_HNPTXFSIZ)/Endpoint 0 Transmit FIFO size (OTG_DIEPTXF0) */
364#define OTG_HNPTXFSIZ_PTXFD_MASK (0xffff0000)
365#define OTG_HNPTXFSIZ_PTXSA_MASK (0x0000ffff)
366
367/* OTG Host periodic transmit FIFO size register (OTG_HPTXFSIZ) */
368#define OTG_HPTXFSIZ_PTXFD_MASK (0xffff0000)
369#define OTG_HPTXFSIZ_PTXSA_MASK (0x0000ffff)
370
371/* OTG Host Configuration Register (OTG_HCFG) */
372/* Bits 31:3 - Reserved */
373#define OTG_HCFG_FSLSS (1 << 2)
374#define OTG_HCFG_FSLSPCS_48MHz (0x1 << 0)
375#define OTG_HCFG_FSLSPCS_6MHz (0x2 << 0)
376#define OTG_HCFG_FSLSPCS_MASK (0x3 << 0)
377
378/* OTG Host Frame Interval Register (OTG_HFIR) */
379/* Bits 31:16 - Reserved */
380#define OTG_HFIR_FRIVL_MASK (0x0000ffff)
381
382/* OTG Host frame number/frame time remaining register (OTG_HFNUM) */
383#define OTG_HFNUM_FTREM_MASK (0xffff0000)
384#define OTG_HFNUM_FRNUM_MASK (0x0000ffff)
385
386/* OTG Host periodic transmit FIFO/queue status register (OTG_HPTXSTS) */
387#define OTG_HPTXSTS_PTXQTOP_MASK (0xff000000)
388#define OTG_HPTXSTS_PTXQTOP_ODDFRM (1<<31)
389#define OTG_HPTXSTS_PTXQTOP_EVENFRM (0<<31)
390#define OTG_HPTXSTS_PTXQTOP_CHANNEL_NUMBER_MASK (0xf<<27)
391#define OTG_HPTXSTS_PTXQTOP_ENDPOINT_NUMBER_MASK (0xf<<27)
392#define OTG_HPTXSTS_PTXQTOP_TYPE_INOUT (0x00<<25)
393#define OTG_HPTXSTS_PTXQTOP_TYPE_ZEROLENGTH (0x01<<25)
394#define OTG_HPTXSTS_PTXQTOP_TYPE_DISABLECMD (0x11<<25)
395#define OTG_HPTXSTS_PTXQTOP_TERMINATE (1<<24)
396#define OTG_HPTXSTS_PTXQSAV_MASK (0x00ff0000)
397#define OTG_HPTXSTS_PTXFSAVL_MASK (0x0000ffff)
398
399/* OTG Host all channels interrupt mask register (OTG_HAINT) */
400/* Bits 31:16 - Reserved */
401#define OTG_HAINTMSK_HAINT_MASK (0x0000ffff)
402
403/* OTG Host all channels interrupt mask register (OTG_HAINTMSK) */
404/* Bits 31:16 - Reserved */
405#define OTG_HAINTMSK_HAINTM_MASK (0x0000ffff)
406
407/* OTG Host port control and status register (OTG_HPRT) */
408/* Bits 31:19 - Reserved */
409#define OTG_HPRT_PSPD_HIGH (0x0 << 17)
410#define OTG_HPRT_PSPD_FULL (0x1 << 17)
411#define OTG_HPRT_PSPD_LOW (0x2 << 17)
412#define OTG_HPRT_PSPD_MASK (0x3 << 17)
413#define OTG_HPRT_PTCTL_DISABLED (0x0 << 13)
414#define OTG_HPRT_PTCTL_J (0x1 << 13)
415#define OTG_HPRT_PTCTL_K (0x2 << 13)
416#define OTG_HPRT_PTCTL_SE0_NAK (0x3 << 13)
417#define OTG_HPRT_PTCTL_PACKET (0x4 << 13)
418#define OTG_HPRT_PTCTL_FORCE_ENABLE (0x5 << 13)
419#define OTG_HPRT_PPWR (1 << 12)
420#define OTG_HPRT_PLSTS_DM (1 << 11)
421#define OTG_HPRT_PLSTS_DP (1 << 10)
422/* Bit 9 - Reserved */
423#define OTG_HPRT_PRST (1 << 8)
424#define OTG_HPRT_PSUSP (1 << 7)
425#define OTG_HPRT_PRES (1 << 6)
426#define OTG_HPRT_POCCHNG (1 << 5)
427#define OTG_HPRT_POCA (1 << 4)
428#define OTG_HPRT_PENCHNG (1 << 3)
429#define OTG_HPRT_PENA (1 << 2)
430#define OTG_HPRT_PCDET (1 << 1)
431#define OTG_HPRT_PCSTS (1 << 0)
432
433/* OTG Host channel-x characteristics register (OTG_HCCHARx) */
434#define OTG_HCCHAR_CHENA (1 << 31)
435#define OTG_HCCHAR_CHDIS (1 << 30)
436#define OTG_HCCHAR_ODDFRM (1 << 29)
437#define OTG_HCCHAR_DAD_MASK (0x7f << 22)
438#define OTG_HCCHAR_MCNT_1 (0x1 << 20)
439#define OTG_HCCHAR_MCNT_2 (0x2 << 20)
440#define OTG_HCCHAR_MCNT_3 (0x3 << 20)
441#define OTG_HCCHAR_MCNT_MASK (0x3 << 20)
442#define OTG_HCCHAR_EPTYP_CONTROL (0 << 18)
443#define OTG_HCCHAR_EPTYP_ISOCHRONOUS (1 << 18)
444#define OTG_HCCHAR_EPTYP_BULK (2 << 18)
445#define OTG_HCCHAR_EPTYP_INTERRUPT (3 << 18)
446#define OTG_HCCHAR_EPTYP_MASK (3 << 18)
447#define OTG_HCCHAR_LSDEV (1 << 17)
448/* Bit 16 - Reserved */
449#define OTG_HCCHAR_EPDIR_OUT (0 << 15)
450#define OTG_HCCHAR_EPDIR_IN (1 << 15)
451#define OTG_HCCHAR_EPDIR_MASK (1 << 15)
452#define OTG_HCCHAR_EPNUM_MASK (0xf << 11)
453#define OTG_HCCHAR_MPSIZ_MASK (0x7ff << 0)
454
455/* OTG Host channel-x interrupt register (OTG_HCINTx) */
456/* Bits 31:11 - Reserved */
457#define OTG_HCINT_DTERR (1 << 10)
458#define OTG_HCINT_FRMOR (1 << 9)
459#define OTG_HCINT_BBERR (1 << 8)
460#define OTG_HCINT_TXERR (1 << 7)
461/* Note: OTG_HCINT_NYET: Only in OTG_HS */
462#define OTG_HCINT_NYET (1 << 6)
463#define OTG_HCINT_ACK (1 << 5)
464#define OTG_HCINT_NAK (1 << 4)
465#define OTG_HCINT_STALL (1 << 3)
466/* Note: OTG_HCINT_AHBERR: Only in OTG_HS */
467#define OTG_HCINT_AHBERR (1 << 2)
468#define OTG_HCINT_CHH (1 << 1)
469#define OTG_HCINT_XFRC (1 << 0)
470
471/* OTG Host channel-x interrupt mask register (OTG_HCINTMSKx) */
472/* Bits 31:11 - Reserved */
473#define OTG_HCINTMSK_DTERRM (1 << 10)
474#define OTG_HCINTMSK_FRMORM (1 << 9)
475#define OTG_HCINTMSK_BBERRM (1 << 8)
476#define OTG_HCINTMSK_TXERRM (1 << 7)
477/* Note: OTG_HCINTMSK_NYET: Only in OTG_HS */
478#define OTG_HCINTMSK_NYET (1 << 6)
479#define OTG_HCINTMSK_ACKM (1 << 5)
480#define OTG_HCINTMSK_NAKM (1 << 4)
481#define OTG_HCINTMSK_STALLM (1 << 3)
482/* Note: OTG_HCINTMSK_AHBERR: Only in OTG_HS */
483#define OTG_HCINTMSK_AHBERR (1 << 2)
484#define OTG_HCINTMSK_CHHM (1 << 1)
485#define OTG_HCINTMSK_XFRCM (1 << 0)
486
487/* OTG Host channel-x transfer size register (OTG_HCTSIZx) */
488/* Note: OTG_HCTSIZ_DOPING: Only in OTG_HS */
489#define OTG_HCTSIZ_DOPING (1 << 31)
490#define OTG_HCTSIZ_DPID_DATA0 (0x0 << 29)
491#define OTG_HCTSIZ_DPID_DATA1 (0x2 << 29)
492#define OTG_HCTSIZ_DPID_DATA2 (0x1 << 29)
493#define OTG_HCTSIZ_DPID_MDATA (0x3 << 29)
494#define OTG_HCTSIZ_DPID_MASK (0x3 << 29)
495#define OTG_HCTSIZ_PKTCNT_MASK (0x3ff << 19)
496#define OTG_HCTSIZ_XFRSIZ_MASK (0x7ffff << 0)
497
498
499
500#endif