This source file includes following definitions.
- usb_pipe_to_qh_type
- whc_qset_set_link_ptr
1
2
3
4
5
6
7 #ifndef _WHCI_WHCI_HC_H
8 #define _WHCI_WHCI_HC_H
9
10 #include <linux/list.h>
11
12
13
14
15
16
17 #define WHCI_PAGE_SIZE 4096
18
19
20
21
22
23
24
25
26 #define QTD_MAX_XFER_SIZE 1048575
27
28
29
30
31
32
33
34
35
36 struct whc_qtd {
37 __le32 status;
38 __le32 options;
39 __le64 page_list_ptr;
40 __u8 setup[8];
41 } __attribute__((packed));
42
43 #define QTD_STS_ACTIVE (1 << 31)
44 #define QTD_STS_HALTED (1 << 30)
45 #define QTD_STS_DBE (1 << 29)
46 #define QTD_STS_BABBLE (1 << 28)
47 #define QTD_STS_RCE (1 << 27)
48 #define QTD_STS_LAST_PKT (1 << 26)
49 #define QTD_STS_INACTIVE (1 << 25)
50 #define QTD_STS_IALT_VALID (1 << 23)
51 #define QTD_STS_IALT(i) (QTD_STS_IALT_VALID | ((i) << 20))
52 #define QTD_STS_LEN(l) ((l) << 0)
53 #define QTD_STS_TO_LEN(s) ((s) & 0x000fffff)
54
55 #define QTD_OPT_IOC (1 << 1)
56 #define QTD_OPT_SMALL (1 << 0)
57
58
59
60
61
62
63
64
65
66 struct whc_itd {
67 __le16 presentation_time;
68 __u8 num_segments;
69 __u8 status;
70 __le32 options;
71 __le64 page_list_ptr;
72 __le64 seg_list_ptr;
73 } __attribute__((packed));
74
75 #define ITD_STS_ACTIVE (1 << 7)
76 #define ITD_STS_DBE (1 << 5)
77 #define ITD_STS_BABBLE (1 << 4)
78 #define ITD_STS_INACTIVE (1 << 1)
79
80 #define ITD_OPT_IOC (1 << 1)
81 #define ITD_OPT_SMALL (1 << 0)
82
83
84
85
86
87
88
89
90
91 struct whc_page_list_entry {
92 __le64 buf_ptr;
93 } __attribute__((packed));
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 struct whc_seg_list_entry {
109 __le16 len;
110 __u8 idx;
111 __u8 status;
112 __le16 offset;
113 } __attribute__((packed));
114
115
116
117
118
119
120 struct whc_qhead {
121 __le64 link;
122 __le32 info1;
123 __le32 info2;
124 __le32 info3;
125 __le16 status;
126 __le16 err_count;
127 __le32 cur_window;
128 __le32 scratch[3];
129 union {
130 struct whc_qtd qtd;
131 struct whc_itd itd;
132 } overlay;
133 } __attribute__((packed));
134
135 #define QH_LINK_PTR_MASK (~0x03Full)
136 #define QH_LINK_PTR(ptr) ((ptr) & QH_LINK_PTR_MASK)
137 #define QH_LINK_IQS (1 << 4)
138 #define QH_LINK_NTDS(n) (((n) - 1) << 1)
139 #define QH_LINK_T (1 << 0)
140
141 #define QH_INFO1_EP(e) ((e) << 0)
142 #define QH_INFO1_DIR_IN (1 << 4)
143 #define QH_INFO1_DIR_OUT (0 << 4)
144 #define QH_INFO1_TR_TYPE_CTRL (0x0 << 5)
145 #define QH_INFO1_TR_TYPE_ISOC (0x1 << 5)
146 #define QH_INFO1_TR_TYPE_BULK (0x2 << 5)
147 #define QH_INFO1_TR_TYPE_INT (0x3 << 5)
148 #define QH_INFO1_TR_TYPE_LP_INT (0x7 << 5)
149 #define QH_INFO1_DEV_INFO_IDX(i) ((i) << 8)
150 #define QH_INFO1_SET_INACTIVE (1 << 15)
151 #define QH_INFO1_MAX_PKT_LEN(l) ((l) << 16)
152
153 #define QH_INFO2_BURST(b) ((b) << 0)
154 #define QH_INFO2_DBP(p) ((p) << 5)
155 #define QH_INFO2_MAX_COUNT(c) ((c) << 8)
156 #define QH_INFO2_RQS (1 << 15)
157 #define QH_INFO2_MAX_RETRY(r) ((r) << 16)
158 #define QH_INFO2_MAX_SEQ(s) ((s) << 20)
159 #define QH_INFO3_MAX_DELAY(d) ((d) << 0)
160 #define QH_INFO3_INTERVAL(i) ((i) << 16)
161
162 #define QH_INFO3_TX_RATE(r) ((r) << 24)
163 #define QH_INFO3_TX_PWR(p) ((p) << 29)
164
165 #define QH_STATUS_FLOW_CTRL (1 << 15)
166 #define QH_STATUS_ICUR(i) ((i) << 5)
167 #define QH_STATUS_TO_ICUR(s) (((s) >> 5) & 0x7)
168 #define QH_STATUS_SEQ_MASK 0x1f
169
170
171
172
173
174
175 static inline unsigned usb_pipe_to_qh_type(unsigned pipe)
176 {
177 static const unsigned type[] = {
178 [PIPE_ISOCHRONOUS] = QH_INFO1_TR_TYPE_ISOC,
179 [PIPE_INTERRUPT] = QH_INFO1_TR_TYPE_INT,
180 [PIPE_CONTROL] = QH_INFO1_TR_TYPE_CTRL,
181 [PIPE_BULK] = QH_INFO1_TR_TYPE_BULK,
182 };
183 return type[usb_pipetype(pipe)];
184 }
185
186
187
188
189 #define WHCI_QSET_TD_MAX 8
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 struct whc_qset {
229 struct whc_qhead qh;
230 union {
231 struct whc_qtd qtd[WHCI_QSET_TD_MAX];
232 struct whc_itd itd[WHCI_QSET_TD_MAX];
233 };
234
235
236 dma_addr_t qset_dma;
237 struct whc *whc;
238 struct usb_host_endpoint *ep;
239 struct list_head stds;
240 int ntds;
241 int td_start;
242 int td_end;
243 struct list_head list_node;
244 unsigned in_sw_list:1;
245 unsigned in_hw_list:1;
246 unsigned remove:1;
247 unsigned reset:1;
248 struct urb *pause_after_urb;
249 struct completion remove_complete;
250 uint16_t max_packet;
251 uint8_t max_burst;
252 uint8_t max_seq;
253 };
254
255 static inline void whc_qset_set_link_ptr(u64 *ptr, u64 target)
256 {
257 if (target)
258 *ptr = (*ptr & ~(QH_LINK_PTR_MASK | QH_LINK_T)) | QH_LINK_PTR(target);
259 else
260 *ptr = QH_LINK_T;
261 }
262
263
264
265
266
267
268 struct di_buf_entry {
269 __le32 availability_info[8];
270 __le32 addr_sec_info;
271 __le32 reserved[7];
272 } __attribute__((packed));
273
274 #define WHC_DI_SECURE (1 << 31)
275 #define WHC_DI_DISABLE (1 << 30)
276 #define WHC_DI_KEY_IDX(k) ((k) << 8)
277 #define WHC_DI_KEY_IDX_MASK 0x0000ff00
278 #define WHC_DI_DEV_ADDR(a) ((a) << 0)
279 #define WHC_DI_DEV_ADDR_MASK 0x000000ff
280
281
282
283
284
285
286 struct dn_buf_entry {
287 __u8 msg_size;
288 __u8 reserved1;
289 __u8 src_addr;
290 __u8 status;
291 __le32 tkid;
292 __u8 dn_data[56];
293 } __attribute__((packed));
294
295 #define WHC_DN_STATUS_VALID (1 << 7)
296 #define WHC_DN_STATUS_SECURE (1 << 6)
297
298 #define WHC_N_DN_ENTRIES (4096 / sizeof(struct dn_buf_entry))
299
300
301
302 #define WHC_GEN_CMD_DATA_LEN 256
303
304
305
306
307
308
309
310 #define WHCIVERSION 0x00
311
312 #define WHCSPARAMS 0x04
313 # define WHCSPARAMS_TO_N_MMC_IES(p) (((p) >> 16) & 0xff)
314 # define WHCSPARAMS_TO_N_KEYS(p) (((p) >> 8) & 0xff)
315 # define WHCSPARAMS_TO_N_DEVICES(p) (((p) >> 0) & 0x7f)
316
317 #define WUSBCMD 0x08
318 # define WUSBCMD_BCID(b) ((b) << 16)
319 # define WUSBCMD_BCID_MASK (0xff << 16)
320 # define WUSBCMD_ASYNC_QSET_RM (1 << 12)
321 # define WUSBCMD_PERIODIC_QSET_RM (1 << 11)
322 # define WUSBCMD_WUSBSI(s) ((s) << 8)
323 # define WUSBCMD_WUSBSI_MASK (0x7 << 8)
324 # define WUSBCMD_ASYNC_SYNCED_DB (1 << 7)
325 # define WUSBCMD_PERIODIC_SYNCED_DB (1 << 6)
326 # define WUSBCMD_ASYNC_UPDATED (1 << 5)
327 # define WUSBCMD_PERIODIC_UPDATED (1 << 4)
328 # define WUSBCMD_ASYNC_EN (1 << 3)
329 # define WUSBCMD_PERIODIC_EN (1 << 2)
330 # define WUSBCMD_WHCRESET (1 << 1)
331 # define WUSBCMD_RUN (1 << 0)
332
333 #define WUSBSTS 0x0c
334 # define WUSBSTS_ASYNC_SCHED (1 << 15)
335 # define WUSBSTS_PERIODIC_SCHED (1 << 14)
336 # define WUSBSTS_DNTS_SCHED (1 << 13)
337 # define WUSBSTS_HCHALTED (1 << 12)
338 # define WUSBSTS_GEN_CMD_DONE (1 << 9)
339 # define WUSBSTS_CHAN_TIME_ROLLOVER (1 << 8)
340 # define WUSBSTS_DNTS_OVERFLOW (1 << 7)
341 # define WUSBSTS_BPST_ADJUSTMENT_CHANGED (1 << 6)
342 # define WUSBSTS_HOST_ERR (1 << 5)
343 # define WUSBSTS_ASYNC_SCHED_SYNCED (1 << 4)
344 # define WUSBSTS_PERIODIC_SCHED_SYNCED (1 << 3)
345 # define WUSBSTS_DNTS_INT (1 << 2)
346 # define WUSBSTS_ERR_INT (1 << 1)
347 # define WUSBSTS_INT (1 << 0)
348 # define WUSBSTS_INT_MASK 0x3ff
349
350 #define WUSBINTR 0x10
351 # define WUSBINTR_GEN_CMD_DONE (1 << 9)
352 # define WUSBINTR_CHAN_TIME_ROLLOVER (1 << 8)
353 # define WUSBINTR_DNTS_OVERFLOW (1 << 7)
354 # define WUSBINTR_BPST_ADJUSTMENT_CHANGED (1 << 6)
355 # define WUSBINTR_HOST_ERR (1 << 5)
356 # define WUSBINTR_ASYNC_SCHED_SYNCED (1 << 4)
357 # define WUSBINTR_PERIODIC_SCHED_SYNCED (1 << 3)
358 # define WUSBINTR_DNTS_INT (1 << 2)
359 # define WUSBINTR_ERR_INT (1 << 1)
360 # define WUSBINTR_INT (1 << 0)
361 # define WUSBINTR_ALL 0x3ff
362
363 #define WUSBGENCMDSTS 0x14
364 # define WUSBGENCMDSTS_ACTIVE (1 << 31)
365 # define WUSBGENCMDSTS_ERROR (1 << 24)
366 # define WUSBGENCMDSTS_IOC (1 << 23)
367 # define WUSBGENCMDSTS_MMCIE_ADD 0x01
368 # define WUSBGENCMDSTS_MMCIE_RM 0x02
369 # define WUSBGENCMDSTS_SET_MAS 0x03
370 # define WUSBGENCMDSTS_CHAN_STOP 0x04
371 # define WUSBGENCMDSTS_RWP_EN 0x05
372
373 #define WUSBGENCMDPARAMS 0x18
374 #define WUSBGENADDR 0x20
375 #define WUSBASYNCLISTADDR 0x28
376 #define WUSBDNTSBUFADDR 0x30
377 #define WUSBDEVICEINFOADDR 0x38
378
379 #define WUSBSETSECKEYCMD 0x40
380 # define WUSBSETSECKEYCMD_SET (1 << 31)
381 # define WUSBSETSECKEYCMD_ERASE (1 << 30)
382 # define WUSBSETSECKEYCMD_GTK (1 << 8)
383 # define WUSBSETSECKEYCMD_IDX(i) ((i) << 0)
384
385 #define WUSBTKID 0x44
386 #define WUSBSECKEY 0x48
387 #define WUSBPERIODICLISTBASE 0x58
388 #define WUSBMASINDEX 0x60
389
390 #define WUSBDNTSCTRL 0x64
391 # define WUSBDNTSCTRL_ACTIVE (1 << 31)
392 # define WUSBDNTSCTRL_INTERVAL(i) ((i) << 8)
393 # define WUSBDNTSCTRL_SLOTS(s) ((s) << 0)
394
395 #define WUSBTIME 0x68
396 # define WUSBTIME_CHANNEL_TIME_MASK 0x00ffffff
397
398 #define WUSBBPST 0x6c
399 #define WUSBDIBUPDATED 0x70
400
401 #endif