SyterKit
0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
include
drivers
usb
reg
reg-usb.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0+ */
2
3
#ifndef __REG_USB_H__
4
#define __REG_USB_H__
5
6
#include <stdarg.h>
7
#include <stdbool.h>
8
#include <stddef.h>
9
#include <stdint.h>
10
#include <types.h>
11
12
#include <reg-ncat.h>
13
14
#include <io.h>
15
16
/* USB PHY Define */
17
#define USB_PHY_SEL 0x0420
18
#define USB_PHY_CTL 0x0410
19
20
/* reg offset */
21
#define USBC_REG_o_FADDR 0x0098
22
#define USBC_REG_o_PCTL 0x0040
23
#define USBC_REG_o_INTTx 0x0044
24
#define USBC_REG_o_INTRx 0x0046
25
#define USBC_REG_o_INTTxE 0x0048
26
#define USBC_REG_o_INTRxE 0x004A
27
#define USBC_REG_o_INTUSB 0x004C
28
#define USBC_REG_o_INTUSBE 0x0050
29
#define USBC_REG_o_FRNUM 0x0054
30
#define USBC_REG_o_EPIND 0x0042
31
#define USBC_REG_o_TMCTL 0x007C
32
33
#define USBC_REG_o_TXMAXP 0x0080
34
#define USBC_REG_o_CSR0 0x0082
35
#define USBC_REG_o_TXCSR 0x0082
36
#define USBC_REG_o_RXMAXP 0x0084
37
#define USBC_REG_o_RXCSR 0x0086
38
#define USBC_REG_o_COUNT0 0x0088
39
#define USBC_REG_o_RXCOUNT 0x0088
40
#define USBC_REG_o_EP0TYPE 0x008C
41
#define USBC_REG_o_TXTYPE 0x008C
42
#define USBC_REG_o_NAKLIMIT0 0x008D
43
#define USBC_REG_o_TXINTERVAL 0x008D
44
#define USBC_REG_o_RXTYPE 0x008E
45
#define USBC_REG_o_RXINTERVAL 0x008F
46
47
#define USBC_REG_o_CONFIGDATA 0x00c0
48
49
#define USBC_REG_o_EPFIFO0 0x0000
50
#define USBC_REG_o_EPFIFO1 0x0004
51
#define USBC_REG_o_EPFIFO2 0x0008
52
#define USBC_REG_o_EPFIFO3 0x000C
53
#define USBC_REG_o_EPFIFO4 0x0010
54
#define USBC_REG_o_EPFIFO5 0x0014
55
#define USBC_REG_o_EPFIFOx(n) (0x0000 + (n << 2))
56
57
#define USBC_REG_o_DEVCTL 0x0041
58
59
#define USBC_REG_o_TXFIFOSZ 0x0090
60
#define USBC_REG_o_RXFIFOSZ 0x0094
61
#define USBC_REG_o_TXFIFOAD 0x0092
62
#define USBC_REG_o_RXFIFOAD 0x0096
63
64
#define USBC_REG_o_VEND0 0x0043
65
#define USBC_REG_o_VEND1 0x007D
66
#define USBC_REG_o_VEND3 0x007E
67
68
/*#define USBC_REG_o_PHYCTL 0x006C*/
69
#define USBC_REG_o_EPINFO 0x0078
70
#define USBC_REG_o_RAMINFO 0x0079
71
#define USBC_REG_o_LINKINFO 0x007A
72
#define USBC_REG_o_VPLEN 0x007B
73
#define USBC_REG_o_HSEOF 0x007C
74
#define USBC_REG_o_FSEOF 0x007D
75
#define USBC_REG_o_LSEOF 0x007E
76
77
/*new*/
78
#define USBC_REG_o_FADDR0 0x0098
79
#define USBC_REG_o_HADDR0 0x009A
80
#define USBC_REG_o_HPORT0 0x009B
81
#define USBC_REG_o_TXFADDRx 0x0098
82
#define USBC_REG_o_TXHADDRx 0x009A
83
#define USBC_REG_o_TXHPORTx 0x009B
84
#define USBC_REG_o_RXFADDRx 0x009C
85
#define USBC_REG_o_RXHADDRx 0x009E
86
#define USBC_REG_o_RXHPORTx 0x009F
87
88
#define USBC_REG_o_RPCOUNT 0x008A
89
90
/*new*/
91
#define USBC_REG_o_ISCR 0x0400
92
/*#define USBC_REG_o_PHYCTL 0x0404*/
93
#define USBC_REG_o_PHYBIST 0x0408
94
#define USBC_REG_o_PHYTUNE 0x040c
95
#define USBC_REG_o_PHYCTL 0x0410
96
#define USBC_REG_o_SEL 0x420
97
98
#define USBC_REG_o_DMA_ENABLE 0x0500
99
#define USBC_REG_o_DMA_STATUS 0x0504
100
#define USBC_REG_o_DMA_CONFIG 0x0540
101
#define USBC_REG_o_DMA_ADDR 0x0544
102
#define USBC_REG_o_DMA_SIZE 0x0548
103
#define USBC_REG_o_DMA_RESU 0x0548
104
/*-----------------------------------------------------------------------*/
105
/* registers*/
106
/*-----------------------------------------------------------------------*/
107
108
#define USBC_REG_FADDR(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_FADDR)
109
#define USBC_REG_PCTL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_PCTL)
110
#define USBC_REG_INTTx(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTTx)
111
#define USBC_REG_INTRx(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTRx)
112
#define USBC_REG_INTTxE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTTxE)
113
#define USBC_REG_INTRxE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTRxE)
114
#define USBC_REG_INTUSB(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTUSB)
115
#define USBC_REG_INTUSBE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_INTUSBE)
116
#define USBC_REG_FRNUM(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_FRNUM)
117
#define USBC_REG_EPIND(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPIND)
118
#define USBC_REG_TMCTL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TMCTL)
119
#define USBC_REG_TXMAXP(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXMAXP)
120
121
#define USBC_REG_CSR0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_CSR0)
122
#define USBC_REG_TXCSR(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXCSR)
123
124
#define USBC_REG_RXMAXP(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXMAXP)
125
#define USBC_REG_RXCSR(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXCSR)
126
127
#define USBC_REG_COUNT0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_COUNT0)
128
#define USBC_REG_RXCOUNT(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXCOUNT)
129
130
#define USBC_REG_EP0TYPE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EP0TYPE)
131
#define USBC_REG_TXTYPE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXTYPE)
132
133
#define USBC_REG_NAKLIMIT0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_NAKLIMIT0)
134
#define USBC_REG_TXINTERVAL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXINTERVAL)
135
136
#define USBC_REG_RXTYPE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXTYPE)
137
#define USBC_REG_RXINTERVAL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXINTERVAL)
138
#define USBC_REG_CONFIGDATA(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_CONFIGDATA)
139
#define USBC_REG_EPFIFO0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO0)
140
#define USBC_REG_EPFIFO1(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO1)
141
#define USBC_REG_EPFIFO2(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO2)
142
#define USBC_REG_EPFIFO3(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO3)
143
#define USBC_REG_EPFIFO4(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO4)
144
#define USBC_REG_EPFIFO5(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPFIFO5)
145
#define USBC_REG_EPFIFOx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_EPFIFOx(n))
146
#define USBC_REG_DEVCTL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_DEVCTL)
147
#define USBC_REG_TXFIFOSZ(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXFIFOSZ)
148
#define USBC_REG_RXFIFOSZ(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXFIFOSZ)
149
#define USBC_REG_TXFIFOAD(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_TXFIFOAD)
150
#define USBC_REG_RXFIFOAD(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXFIFOAD)
151
#define USBC_REG_VEND0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_VEND0)
152
#define USBC_REG_VEND1(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_VEND1)
153
#define USBC_REG_EPINFO(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_EPINFO)
154
#define USBC_REG_RAMINFO(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RAMINFO)
155
#define USBC_REG_LINKINFO(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_LINKINFO)
156
#define USBC_REG_VPLEN(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_VPLEN)
157
#define USBC_REG_HSEOF(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_HSEOF)
158
#define USBC_REG_FSEOF(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_FSEOF)
159
#define USBC_REG_LSEOF(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_LSEOF)
160
161
#define USBC_REG_FADDR0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_FADDR0)
162
#define USBC_REG_HADDR0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_HADDR0)
163
#define USBC_REG_HPORT0(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_HPORT0)
164
165
#define USBC_REG_TXFADDRx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_TXFADDRx)
166
#define USBC_REG_TXHADDRx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_TXHADDRx)
167
#define USBC_REG_TXHPORTx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_TXHPORTx)
168
#define USBC_REG_RXFADDRx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_RXFADDRx)
169
#define USBC_REG_RXHADDRx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_RXHADDRx)
170
#define USBC_REG_RXHPORTx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_RXHPORTx)
171
172
#define USBC_REG_RPCOUNTx(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_RPCOUNT)
173
174
#define USBC_REG_ISCR(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_ISCR)
175
#define USBC_REG_PHYCTL(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_PHYCTL)
176
#define USBC_REG_PHYBIST(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_PHYBIST)
177
#define USBC_REG_PHYTUNE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_PHYTUNE)
178
179
#define USBC_REG_RXFADDRx_Ex(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_RXFADDRx)
180
181
/*DMA*/
182
#define USBC_REG_o_DMA_INTE 0x0500
183
#define USBC_REG_o_DMA_INTS 0x0504
184
#define USBC_REG_o_DMA_CHAN_CFN(n) (0x0540 + (0x10 * n))
185
#define USBC_REG_o_DMA_SDRAM_ADD(n) (0x0544 + (0x10 * n))
186
#define USBC_REG_o_DMA_BC(n) (0x0548 + (0x10 * n))
187
#define USBC_REG_o_DMA_RESIDUAL_BC(n) (0x0548 + (0x10 * n))
188
189
#define USBC_REG_DMA_INTE(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_DMA_INTE)
190
#define USBC_REG_DMA_INTS(usbc_base_addr) ((usbc_base_addr) + USBC_REG_o_DMA_INTS)
191
#define USBC_REG_DMA_CHAN_CFN(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_DMA_CHAN_CFN(n))
192
#define USBC_REG_DMA_SDRAM_ADD(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_DMA_SDRAM_ADD(n))
193
#define USBC_REG_DMA_BC(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_DMA_BC(n))
194
#define USBC_REG_DMA_RESIDUAL_BC(usbc_base_addr, n) ((usbc_base_addr) + USBC_REG_o_DMA_RESIDUAL_BC(n))
195
196
/*-----------------------------------------------------------------------*/
197
/* registers extern*/
198
/*-----------------------------------------------------------------------*/
199
#define USBC_REG_EX_USB_EPFIFOn(usbc_base_addr) ((usbc_base_addr) + (0x00 + (n << 2)))
200
#define USBC_REG_EX_USB_GCS(usbc_base_addr) ((usbc_base_addr) + 0x0040)
201
#define USBC_REG_EX_USB_EPINTF(usbc_base_addr) ((usbc_base_addr) + 0x0044)
202
#define USBC_REG_EX_USB_EPINTE(usbc_base_addr) ((usbc_base_addr) + 0x0048)
203
#define USBC_REG_EX_USB_BUSINTF(usbc_base_addr) ((usbc_base_addr) + 0x004C)
204
#define USBC_REG_EX_USB_BUSINTE(usbc_base_addr) ((usbc_base_addr) + 0x0050)
205
#define USBC_REG_EX_USB_FNUM(usbc_base_addr) ((usbc_base_addr) + 0x0054)
206
#define USBC_REG_EX_USB_TESTC(usbc_base_addr) ((usbc_base_addr) + 0x007C)
207
208
#define USBC_REG_EX_USB_CSR0(usbc_base_addr) ((usbc_base_addr) + 0x0080)
209
#define USBC_REG_EX_USB_TXCSR(usbc_base_addr) ((usbc_base_addr) + 0x0080)
210
#define USBC_REG_EX_USB_RXCSR(usbc_base_addr) ((usbc_base_addr) + 0x0084)
211
#define USBC_REG_EX_USB_COUNT0(usbc_base_addr) ((usbc_base_addr) + 0x0088)
212
#define USBC_REG_EX_USB_RXCOUNT(usbc_base_addr) ((usbc_base_addr) + 0x0088)
213
#define USBC_REG_EX_USB_ATTR0(usbc_base_addr) ((usbc_base_addr) + 0x008C)
214
#define USBC_REG_EX_USB_EPATTR(usbc_base_addr) ((usbc_base_addr) + 0x008C)
215
#define USBC_REG_EX_USB_TXFIFO(usbc_base_addr) ((usbc_base_addr) + 0x0090)
216
#define USBC_REG_EX_USB_RXFIFO(usbc_base_addr) ((usbc_base_addr) + 0x0094)
217
#define USBC_REG_EX_USB_FADDR(usbc_base_addr) ((usbc_base_addr) + 0x0098)
218
#define USBC_REG_EX_USB_TXFADDR(usbc_base_addr) ((usbc_base_addr) + 0x0098)
219
#define USBC_REG_EX_USB_RXFADDR(usbc_base_addr) ((usbc_base_addr) + 0x009C)
220
221
#define USBC_REG_EX_USB_CONFIGINFO(usbc_base_addr) ((usbc_base_addr) + 0x00C0)
222
#define USBC_REG_EX_USB_LINKTIM(usbc_base_addr) ((usbc_base_addr) + 0x00C4)
223
#define USBC_REG_EX_USB_OTGTIM(usbc_base_addr) ((usbc_base_addr) + 0x00C8)
224
225
#define USBC_REG_EX_USB_ISCR(usbc_base_addr) ((usbc_base_addr) + 0x0400)
226
#define USBC_REG_EX_USB_PHYCTL(usbc_base_addr) ((usbc_base_addr) + 0x0404)
227
#define USBC_REG_EX_USB_PHYBIST(usbc_base_addr) ((usbc_base_addr) + 0x0408)
228
229
/*-----------------------------------------------------------------------*/
230
/* bit position*/
231
/*-----------------------------------------------------------------------*/
232
233
/* USB Power Control for Host only */
234
#define USBC_BP_POWER_H_HIGH_SPEED_EN 5
235
#define USBC_BP_POWER_H_HIGH_SPEED_FLAG 4
236
#define USBC_BP_POWER_H_RESET 3
237
#define USBC_BP_POWER_H_RESUME 2
238
#define USBC_BP_POWER_H_SUSPEND 1
239
#define USBC_BP_POWER_H_SUEPEND_EN 0
240
241
/* USB Power Control for device only */
242
#define USBC_BP_POWER_D_ISO_UPDATE_EN 7
243
#define USBC_BP_POWER_D_SOFT_CONNECT 6
244
#define USBC_BP_POWER_D_HIGH_SPEED_EN 5
245
#define USBC_BP_POWER_D_HIGH_SPEED_FLAG 4
246
#define USBC_BP_POWER_D_RESET_FLAG 3
247
#define USBC_BP_POWER_D_RESUME 2
248
#define USBC_BP_POWER_D_SUSPEND 1
249
#define USBC_BP_POWER_D_ENABLE_SUSPENDM 0
250
251
/* interrupt flags for ep0 and the Tx ep1~4 */
252
#define USBC_BP_INTTx_FLAG_EP5 5
253
#define USBC_BP_INTTx_FLAG_EP4 4
254
#define USBC_BP_INTTx_FLAG_EP3 3
255
#define USBC_BP_INTTx_FLAG_EP2 2
256
#define USBC_BP_INTTx_FLAG_EP1 1
257
#define USBC_BP_INTTx_FLAG_EP0 0
258
259
/* interrupt flags for Rx ep1~4 */
260
#define USBC_BP_INTRx_FLAG_EP5 5
261
#define USBC_BP_INTRx_FLAG_EP4 4
262
#define USBC_BP_INTRx_FLAG_EP3 3
263
#define USBC_BP_INTRx_FLAG_EP2 2
264
#define USBC_BP_INTRx_FLAG_EP1 1
265
266
/* interrupt enable for Tx ep0~4 */
267
#define USBC_BP_INTTxE_EN_EP5 5
268
#define USBC_BP_INTTxE_EN_EP4 4
269
#define USBC_BP_INTTxE_EN_EP3 3
270
#define USBC_BP_INTTxE_EN_EP2 2
271
#define USBC_BP_INTTxE_EN_EP1 1
272
#define USBC_BP_INTTxE_EN_EP0 0
273
274
/* interrupt enable for Rx ep1~4 */
275
#define USBC_BP_INTRxE_EN_EP5 5
276
#define USBC_BP_INTRxE_EN_EP4 4
277
#define USBC_BP_INTRxE_EN_EP3 3
278
#define USBC_BP_INTRxE_EN_EP2 2
279
#define USBC_BP_INTRxE_EN_EP1 1
280
281
/* USB interrupt */
282
#define USBC_BP_INTUSB_VBUS_ERROR 7
283
#define USBC_BP_INTUSB_SESSION_REQ 6
284
#define USBC_BP_INTUSB_DISCONNECT 5
285
#define USBC_BP_INTUSB_CONNECT 4
286
#define USBC_BP_INTUSB_SOF 3
287
#define USBC_BP_INTUSB_RESET 2
288
#define USBC_BP_INTUSB_RESUME 1
289
#define USBC_BP_INTUSB_SUSPEND 0
290
291
/* USB interrupt enable */
292
#define USBC_BP_INTUSBE_EN_VBUS_ERROR 7
293
#define USBC_BP_INTUSBE_EN_SESSION_REQ 6
294
#define USBC_BP_INTUSBE_EN_DISCONNECT 5
295
#define USBC_BP_INTUSBE_EN_CONNECT 4
296
#define USBC_BP_INTUSBE_EN_SOF 3
297
#define USBC_BP_INTUSBE_EN_RESET 2
298
#define USBC_BP_INTUSBE_EN_RESUME 1
299
#define USBC_BP_INTUSBE_EN_SUSPEND 0
300
301
/* Test Mode Control */
302
#define USBC_BP_TMCTL_FORCE_HOST 7
303
#define USBC_BP_TMCTL_FIFO_ACCESS 6
304
#define USBC_BP_TMCTL_FORCE_FS 5
305
#define USBC_BP_TMCTL_FORCE_HS 4
306
#define USBC_BP_TMCTL_TEST_PACKET 3
307
#define USBC_BP_TMCTL_TEST_K 2
308
#define USBC_BP_TMCTL_TEST_J 1
309
#define USBC_BP_TMCTL_TEST_SE0_NAK 0
310
311
/* Tx Max packet */
312
#define USBC_BP_TXMAXP_PACKET_COUNT 11
313
#define USBC_BP_TXMAXP_MAXIMUM_PAYLOAD 0
314
315
/* Control and Status Register for ep0 for Host only */
316
#define USBC_BP_CSR0_H_DisPing 11
317
#define USBC_BP_CSR0_H_FlushFIFO 8
318
#define USBC_BP_CSR0_H_NAK_Timeout 7
319
#define USBC_BP_CSR0_H_StatusPkt 6
320
#define USBC_BP_CSR0_H_ReqPkt 5
321
#define USBC_BP_CSR0_H_Error 4
322
#define USBC_BP_CSR0_H_SetupPkt 3
323
#define USBC_BP_CSR0_H_RxStall 2
324
#define USBC_BP_CSR0_H_TxPkRdy 1
325
#define USBC_BP_CSR0_H_RxPkRdy 0
326
327
/* Control and Status Register for ep0 for device only */
328
#define USBC_BP_CSR0_D_FLUSH_FIFO 8
329
#define USBC_BP_CSR0_D_SERVICED_SETUP_END 7
330
#define USBC_BP_CSR0_D_SERVICED_RX_PKT_READY 6
331
#define USBC_BP_CSR0_D_SEND_STALL 5
332
#define USBC_BP_CSR0_D_SETUP_END 4
333
#define USBC_BP_CSR0_D_DATA_END 3
334
#define USBC_BP_CSR0_D_SENT_STALL 2
335
#define USBC_BP_CSR0_D_TX_PKT_READY 1
336
#define USBC_BP_CSR0_D_RX_PKT_READY 0
337
338
/* Tx ep Control and Status Register for Host only */
339
#define USBC_BP_TXCSR_H_AUTOSET 15
340
#define USBC_BP_TXCSR_H_RESERVED 14
341
#define USBC_BP_TXCSR_H_MODE 13
342
#define USBC_BP_TXCSR_H_DMA_REQ_EN 12
343
#define USBC_BP_TXCSR_H_FORCE_DATA_TOGGLE 11
344
#define USBC_BP_TXCSR_H_DMA_REQ_MODE 10
345
#define USBC_BP_TXCSR_H_DATA_TOGGLE_WR_EN 9
346
#define USBC_BP_TXCSR_H_DATA_TOGGLE 8
347
#define USBC_BP_TXCSR_H_NAK_TIMEOUT 7
348
#define USBC_BP_TXCSR_H_CLEAR_DATA_TOGGLE 6
349
#define USBC_BP_TXCSR_H_TX_STALL 5
350
#define USBC_BP_TXCSR_H_FLUSH_FIFO 3
351
#define USBC_BP_TXCSR_H_ERROR 2
352
#define USBC_BP_TXCSR_H_FIFO_NOT_EMPTY 1
353
#define USBC_BP_TXCSR_H_TX_READY 0
354
355
#define USBC_TXCSR_H_WZC_BITS ((1 << USBC_BP_TXCSR_H_NAK_TIMEOUT) | (1 << USBC_BP_TXCSR_H_TX_STALL) | (1 << USBC_BP_TXCSR_H_ERROR) | (1 << USBC_BP_TXCSR_H_FIFO_NOT_EMPTY))
356
357
/* Tx ep Control and Status Register for Device only */
358
#define USBC_BP_TXCSR_D_AUTOSET 15
359
#define USBC_BP_TXCSR_D_ISO 14
360
#define USBC_BP_TXCSR_D_MODE 13
361
#define USBC_BP_TXCSR_D_DMA_REQ_EN 12
362
#define USBC_BP_TXCSR_D_FORCE_DATA_TOGGLE 11
363
#define USBC_BP_TXCSR_D_DMA_REQ_MODE 10
364
#define USBC_BP_TXCSR_D_INCOMPLETE 7
365
#define USBC_BP_TXCSR_D_CLEAR_DATA_TOGGLE 6
366
#define USBC_BP_TXCSR_D_SENT_STALL 5
367
#define USBC_BP_TXCSR_D_SEND_STALL 4
368
#define USBC_BP_TXCSR_D_FLUSH_FIFO 3
369
#define USBC_BP_TXCSR_D_UNDER_RUN 2
370
#define USBC_BP_TXCSR_D_FIFO_NOT_EMPTY 1
371
#define USBC_BP_TXCSR_D_TX_READY 0
372
373
/* Rx Max Packet */
374
#define USBC_BP_RXMAXP_PACKET_COUNT 11
375
#define USBC_BP_RXMAXP_MAXIMUM_PAYLOAD 0
376
377
/* Rx ep Control and Status Register for Host only */
378
#define USBC_BP_RXCSR_H_AUTO_CLEAR 15
379
#define USBC_BP_RXCSR_H_AUTO_REQ 14
380
#define USBC_BP_RXCSR_H_DMA_REQ_EN 13
381
#define USBC_BP_RXCSR_H_DISNYET 12
/* dis nyet */
382
#define USBC_BP_RXCSR_H_PID_ERROR 12
/* pid error */
383
#define USBC_BP_RXCSR_H_DMA_REQ_MODE 11
384
#define USBC_BP_RXCSR_H_DATA_TOGGLE_WR_EN 10
385
#define USBC_BP_RXCSR_H_DATA_TOGGLE 9
386
#define USBC_BP_RXCSR_H_INCOMPLETE 8
387
#define USBC_BP_RXCSR_H_CLEAR_DATA_TOGGLE 7
388
#define USBC_BP_RXCSR_H_RX_STALL 6
389
#define USBC_BP_RXCSR_H_REQ_PACKET 5
390
#define USBC_BP_RXCSR_H_FLUSH_FIFO 4
391
#define USBC_BP_RXCSR_H_DATA_ERR 3
/* iso */
392
#define USBC_BP_RXCSR_H_NAK_TIMEOUT 3
/* bulk */
393
#define USBC_BP_RXCSR_H_ERROR 2
394
#define USBC_BP_RXCSR_H_FIFO_FULL 1
395
#define USBC_BP_RXCSR_H_RX_PKT_READY 0
396
397
#define USBC_RXCSR_H_WZC_BITS ((1 << USBC_BP_RXCSR_H_RX_STALL) | (1 << USBC_BP_RXCSR_H_ERROR) | (1 << USBC_BP_RXCSR_H_DATA_ERR) | (1 << USBC_BP_RXCSR_H_RX_PKT_READY))
398
399
/* Rx ep Control and Status Register for Device only */
400
#define USBC_BP_RXCSR_D_AUTO_CLEAR 15
401
#define USBC_BP_RXCSR_D_ISO 14
402
#define USBC_BP_RXCSR_D_DMA_REQ_EN 13
403
#define USBC_BP_RXCSR_D_DISABLE_NYET 12
404
#define USBC_BP_RXCSR_D_DMA_REQ_MODE 11
405
406
#define USBC_BP_RXCSR_D_INCOMPLETE 8
407
#define USBC_BP_RXCSR_D_CLEAR_DATA_TOGGLE 7
408
#define USBC_BP_RXCSR_D_SENT_STALL 6
409
#define USBC_BP_RXCSR_D_SEND_STALL 5
410
#define USBC_BP_RXCSR_D_FLUSH_FIFO 4
411
#define USBC_BP_RXCSR_D_DATA_ERROR 3
412
#define USBC_BP_RXCSR_D_OVERRUN 2
413
#define USBC_BP_RXCSR_D_FIFO_FULL 1
414
#define USBC_BP_RXCSR_D_RX_PKT_READY 0
415
416
/* Tx Type Register for host only */
417
#define USBC_BP_TXTYPE_SPEED 6
/*new*/
418
#define USBC_BP_TXTYPE_PROROCOL 4
419
#define USBC_BP_TXTYPE_TARGET_EP_NUM 0
420
421
/* Rx Type Register for host only */
422
#define USBC_BP_RXTYPE_SPEED 6
/*new*/
423
#define USBC_BP_RXTYPE_PROROCOL 4
424
#define USBC_BP_RXTYPE_TARGET_EP_NUM 0
425
426
/* Core Configueation */
427
#define USBC_BP_CONFIGDATA_MPRXE 7
428
#define USBC_BP_CONFIGDATA_MPTXE 6
429
#define USBC_BP_CONFIGDATA_BIGENDIAN 5
430
#define USBC_BP_CONFIGDATA_HBRXE 4
431
#define USBC_BP_CONFIGDATA_HBTXE 3
432
#define USBC_BP_CONFIGDATA_DYNFIFO_SIZING 2
433
#define USBC_BP_CONFIGDATA_SOFTCONE 1
434
#define USBC_BP_CONFIGDATA_UTMI_DATAWIDTH 0
435
436
/* OTG Device Control */
437
#define USBC_BP_DEVCTL_B_DEVICE 7
438
#define USBC_BP_DEVCTL_FS_DEV 6
439
#define USBC_BP_DEVCTL_LS_DEV 5
440
441
#define USBC_BP_DEVCTL_VBUS 3
442
#define USBC_BP_DEVCTL_HOST_MODE 2
443
#define USBC_BP_DEVCTL_HOST_REQ 1
444
#define USBC_BP_DEVCTL_SESSION 0
445
446
/* Tx EP FIFO size control */
447
#define USBC_BP_TXFIFOSZ_DPB 4
448
#define USBC_BP_TXFIFOSZ_SZ 0
449
450
/* Rx EP FIFO size control */
451
#define USBC_BP_RXFIFOSZ_DPB 4
452
#define USBC_BP_RXFIFOSZ_SZ 0
453
454
/* vendor0 */
455
#define USBC_BP_VEND0_DRQ_SEL 1
456
#define USBC_BP_VEND0_BUS_SEL 0
457
458
/* hub address */
459
#define USBC_BP_HADDR_MULTI_TT 7
460
461
/* Interface Status and Control */
462
#define USBC_BP_ISCR_VBUS_VALID_FROM_DATA 30
463
#define USBC_BP_ISCR_VBUS_VALID_FROM_VBUS 29
464
#define USBC_BP_ISCR_EXT_ID_STATUS 28
465
#define USBC_BP_ISCR_EXT_DM_STATUS 27
466
#define USBC_BP_ISCR_EXT_DP_STATUS 26
467
#define USBC_BP_ISCR_MERGED_VBUS_STATUS 25
468
#define USBC_BP_ISCR_MERGED_ID_STATUS 24
469
470
#define USBC_BP_ISCR_ID_PULLUP_EN 17
471
#define USBC_BP_ISCR_DPDM_PULLUP_EN 16
472
#define USBC_BP_ISCR_FORCE_ID 14
473
#define USBC_BP_ISCR_FORCE_VBUS_VALID 12
474
#define USBC_BP_ISCR_VBUS_VALID_SRC 10
475
476
#define USBC_BP_ISCR_HOSC_EN 7
477
#define USBC_BP_ISCR_VBUS_CHANGE_DETECT 6
478
#define USBC_BP_ISCR_ID_CHANGE_DETECT 5
479
#define USBC_BP_ISCR_DPDM_CHANGE_DETECT 4
480
#define USBC_BP_ISCR_IRQ_ENABLE 3
481
#define USBC_BP_ISCR_VBUS_CHANGE_DETECT_EN 2
482
#define USBC_BP_ISCR_ID_CHANGE_DETECT_EN 1
483
#define USBC_BP_ISCR_DPDM_CHANGE_DETECT_EN 0
484
485
/*-----------------------------------------------------------------------*/
486
/* 自定义*/
487
/*-----------------------------------------------------------------------*/
488
489
/* usb资源描述 */
490
#define USBC_MAX_CTL_NUM 3
491
#define USBC_MAX_EP_NUM 6
/* 能够支持的最大ep号, ep0~5 */
492
#define USBC0_MAX_FIFO_SIZE (8 * 1024)
493
#define USBC_EP0_FIFOSIZE 64
/* This is non-configurable */
494
495
/* usb OTG mode */
496
#define USBC_OTG_HOST 0
497
#define USBC_OTG_DEVICE 1
498
499
/* usb device type */
500
#define USBC_DEVICE_HSDEV 0
501
#define USBC_DEVICE_FSDEV 1
502
#define USBC_DEVICE_LSDEV 2
503
504
/* usb transfer type */
505
#define USBC_TS_TYPE_IDLE 0
506
#define USBC_TS_TYPE_CTRL 1
507
#define USBC_TS_TYPE_ISO 2
508
#define USBC_TS_TYPE_INT 3
509
#define USBC_TS_TYPE_BULK 4
510
511
/* usb transfer mode */
512
#define USBC_TS_MODE_UNKOWN 0
513
#define USBC_TS_MODE_LS 1
514
#define USBC_TS_MODE_FS 2
515
#define USBC_TS_MODE_HS 3
516
517
/* usb Vbus status */
518
#define USBC_VBUS_STATUS_BELOW_SESSIONEND 0
519
#define USBC_VBUS_STATUS_ABOVE_SESSIONEND_BELOW_AVALID 1
520
#define USBC_VBUS_STATUS_ABOVE_AVALID_BELOW_VBUSVALID 2
521
#define USBC_VBUS_STATUS_ABOVE_VBUSVALID 3
522
523
/* usb io type */
524
#define USBC_IO_TYPE_PIO 0
525
#define USBC_IO_TYPE_DMA 1
526
527
/* usb ep type */
528
#define USBC_EP_TYPE_IDLE 0
529
#define USBC_EP_TYPE_EP0 1
530
#define USBC_EP_TYPE_TX 2
531
#define USBC_EP_TYPE_RX 3
532
533
/* usb id type */
534
#define USBC_ID_TYPE_DISABLE 0
535
#define USBC_ID_TYPE_HOST 1
536
#define USBC_ID_TYPE_DEVICE 2
537
538
/* usb vbus valid type */
539
#define USBC_VBUS_TYPE_DISABLE 0
540
#define USBC_VBUS_TYPE_LOW 1
541
#define USBC_VBUS_TYPE_HIGH 2
542
543
/* usb a valid source */
544
#define USBC_A_VALID_SOURCE_UTMI_AVALID 0
545
#define USBC_A_VALID_SOURCE_UTMI_VBUS 1
546
547
/* usb device switch */
548
#define USBC_DEVICE_SWITCH_OFF 0
549
#define USBC_DEVICE_SWITCH_ON 1
550
551
/* usb fifo config mode */
552
#define USBC_FIFO_MODE_4K 0
553
#define USBC_FIFO_MODE_8K 1
554
555
/* usb dma transfer direction */
556
#define USB_DMA_FROM_DRAM_TO_HOST 0
557
#define USB_DMA_FROM_HOST_TO_DRAM 1
558
559
/*
560
**************************************************
561
* usb interrupt mask
562
*
563
**************************************************
564
*/
565
566
/* interrupt flags for ep0 and the Tx ep1~4 */
567
#define USBC_INTTx_FLAG_EP5 (1 << USBC_BP_INTTx_FLAG_EP5)
568
#define USBC_INTTx_FLAG_EP4 (1 << USBC_BP_INTTx_FLAG_EP4)
569
#define USBC_INTTx_FLAG_EP3 (1 << USBC_BP_INTTx_FLAG_EP3)
570
#define USBC_INTTx_FLAG_EP2 (1 << USBC_BP_INTTx_FLAG_EP2)
571
#define USBC_INTTx_FLAG_EP1 (1 << USBC_BP_INTTx_FLAG_EP1)
572
#define USBC_INTTx_FLAG_EP0 (1 << USBC_BP_INTTx_FLAG_EP0)
573
574
/* interrupt flags for Rx ep1~4 */
575
#define USBC_INTRx_FLAG_EP5 (1 << USBC_BP_INTRx_FLAG_EP5)
576
#define USBC_INTRx_FLAG_EP4 (1 << USBC_BP_INTRx_FLAG_EP4)
577
#define USBC_INTRx_FLAG_EP3 (1 << USBC_BP_INTRx_FLAG_EP3)
578
#define USBC_INTRx_FLAG_EP2 (1 << USBC_BP_INTRx_FLAG_EP2)
579
#define USBC_INTRx_FLAG_EP1 (1 << USBC_BP_INTRx_FLAG_EP1)
580
581
/* USB interrupt */
582
#define USBC_INTUSB_VBUS_ERROR (1 << USBC_BP_INTUSB_VBUS_ERROR)
583
#define USBC_INTUSB_SESSION_REQ (1 << USBC_BP_INTUSB_SESSION_REQ)
584
#define USBC_INTUSB_DISCONNECT (1 << USBC_BP_INTUSB_DISCONNECT)
585
#define USBC_INTUSB_CONNECT (1 << USBC_BP_INTUSB_CONNECT)
586
#define USBC_INTUSB_SOF (1 << USBC_BP_INTUSB_SOF)
587
#define USBC_INTUSB_RESET (1 << USBC_BP_INTUSB_RESET)
588
#define USBC_INTUSB_RESUME (1 << USBC_BP_INTUSB_RESUME)
589
#define USBC_INTUSB_SUSPEND (1 << USBC_BP_INTUSB_SUSPEND)
590
591
#define USBC_PHY_CTL_VBUSVLDEXT 5
592
#define USBC_PHY_CTL_SIDDQ 3
593
594
#endif
// __REG_USB_H__
Generated by
1.9.8