diff options
Diffstat (limited to 'drivers/usb/host/uhci-hcd.h')
-rw-r--r-- | drivers/usb/host/uhci-hcd.h | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h index 74469b5bcb61..1b3d23406ac4 100644 --- a/drivers/usb/host/uhci-hcd.h +++ b/drivers/usb/host/uhci-hcd.h | |||
@@ -129,11 +129,12 @@ struct uhci_qh { | |||
129 | __le32 element; /* Queue element (TD) pointer */ | 129 | __le32 element; /* Queue element (TD) pointer */ |
130 | 130 | ||
131 | /* Software fields */ | 131 | /* Software fields */ |
132 | dma_addr_t dma_handle; | ||
133 | |||
132 | struct list_head node; /* Node in the list of QHs */ | 134 | struct list_head node; /* Node in the list of QHs */ |
133 | struct usb_host_endpoint *hep; /* Endpoint information */ | 135 | struct usb_host_endpoint *hep; /* Endpoint information */ |
134 | struct usb_device *udev; | 136 | struct usb_device *udev; |
135 | struct list_head queue; /* Queue of urbps for this QH */ | 137 | struct list_head queue; /* Queue of urbps for this QH */ |
136 | struct uhci_qh *skel; /* Skeleton for this QH */ | ||
137 | struct uhci_td *dummy_td; /* Dummy TD to end the queue */ | 138 | struct uhci_td *dummy_td; /* Dummy TD to end the queue */ |
138 | struct uhci_td *post_td; /* Last TD completed */ | 139 | struct uhci_td *post_td; /* Last TD completed */ |
139 | 140 | ||
@@ -149,8 +150,7 @@ struct uhci_qh { | |||
149 | 150 | ||
150 | int state; /* QH_STATE_xxx; see above */ | 151 | int state; /* QH_STATE_xxx; see above */ |
151 | int type; /* Queue type (control, bulk, etc) */ | 152 | int type; /* Queue type (control, bulk, etc) */ |
152 | 153 | int skel; /* Skeleton queue number */ | |
153 | dma_addr_t dma_handle; | ||
154 | 154 | ||
155 | unsigned int initial_toggle:1; /* Endpoint's current toggle value */ | 155 | unsigned int initial_toggle:1; /* Endpoint's current toggle value */ |
156 | unsigned int needs_fixup:1; /* Must fix the TD toggle values */ | 156 | unsigned int needs_fixup:1; /* Must fix the TD toggle values */ |
@@ -171,6 +171,8 @@ static inline __le32 qh_element(struct uhci_qh *qh) { | |||
171 | return element; | 171 | return element; |
172 | } | 172 | } |
173 | 173 | ||
174 | #define LINK_TO_QH(qh) (UHCI_PTR_QH | cpu_to_le32((qh)->dma_handle)) | ||
175 | |||
174 | 176 | ||
175 | /* | 177 | /* |
176 | * Transfer Descriptors | 178 | * Transfer Descriptors |
@@ -264,6 +266,8 @@ static inline u32 td_status(struct uhci_td *td) { | |||
264 | return le32_to_cpu(status); | 266 | return le32_to_cpu(status); |
265 | } | 267 | } |
266 | 268 | ||
269 | #define LINK_TO_TD(td) (cpu_to_le32((td)->dma_handle)) | ||
270 | |||
267 | 271 | ||
268 | /* | 272 | /* |
269 | * Skeleton Queue Headers | 273 | * Skeleton Queue Headers |
@@ -272,12 +276,13 @@ static inline u32 td_status(struct uhci_td *td) { | |||
272 | /* | 276 | /* |
273 | * The UHCI driver uses QHs with Interrupt, Control and Bulk URBs for | 277 | * The UHCI driver uses QHs with Interrupt, Control and Bulk URBs for |
274 | * automatic queuing. To make it easy to insert entries into the schedule, | 278 | * automatic queuing. To make it easy to insert entries into the schedule, |
275 | * we have a skeleton of QHs for each predefined Interrupt latency, | 279 | * we have a skeleton of QHs for each predefined Interrupt latency. |
276 | * low-speed control, full-speed control, bulk, and terminating QH | 280 | * Asynchronous QHs (low-speed control, full-speed control, and bulk) |
277 | * (see explanation for the terminating QH below). | 281 | * go onto the period-1 interrupt list, since they all get accessed on |
282 | * every frame. | ||
278 | * | 283 | * |
279 | * When we want to add a new QH, we add it to the end of the list for the | 284 | * When we want to add a new QH, we add it to the list starting from the |
280 | * skeleton QH. For instance, the schedule list can look like this: | 285 | * appropriate skeleton QH. For instance, the schedule can look like this: |
281 | * | 286 | * |
282 | * skel int128 QH | 287 | * skel int128 QH |
283 | * dev 1 interrupt QH | 288 | * dev 1 interrupt QH |
@@ -285,50 +290,47 @@ static inline u32 td_status(struct uhci_td *td) { | |||
285 | * skel int64 QH | 290 | * skel int64 QH |
286 | * skel int32 QH | 291 | * skel int32 QH |
287 | * ... | 292 | * ... |
288 | * skel int1 QH | 293 | * skel int1 + async QH |
289 | * skel low-speed control QH | 294 | * dev 5 low-speed control QH |
290 | * dev 5 control QH | ||
291 | * skel full-speed control QH | ||
292 | * skel bulk QH | ||
293 | * dev 1 bulk QH | 295 | * dev 1 bulk QH |
294 | * dev 2 bulk QH | 296 | * dev 2 bulk QH |
295 | * skel terminating QH | ||
296 | * | 297 | * |
297 | * The terminating QH is used for 2 reasons: | 298 | * There is a special terminating QH used to keep full-speed bandwidth |
298 | * - To place a terminating TD which is used to workaround a PIIX bug | 299 | * reclamation active when no full-speed control or bulk QHs are linked |
299 | * (see Intel errata for explanation), and | 300 | * into the schedule. It has an inactive TD (to work around a PIIX bug, |
300 | * - To loop back to the full-speed control queue for full-speed bandwidth | 301 | * see the Intel errata) and it points back to itself. |
301 | * reclamation. | ||
302 | * | 302 | * |
303 | * There's a special skeleton QH for Isochronous QHs. It never appears | 303 | * There's a special skeleton QH for Isochronous QHs which never appears |
304 | * on the schedule, and Isochronous TDs go on the schedule before the | 304 | * on the schedule. Isochronous TDs go on the schedule before the |
305 | * the skeleton QHs. The hardware accesses them directly rather than | 305 | * the skeleton QHs. The hardware accesses them directly rather than |
306 | * through their QH, which is used only for bookkeeping purposes. | 306 | * through their QH, which is used only for bookkeeping purposes. |
307 | * While the UHCI spec doesn't forbid the use of QHs for Isochronous, | 307 | * While the UHCI spec doesn't forbid the use of QHs for Isochronous, |
308 | * it doesn't use them either. And the spec says that queues never | 308 | * it doesn't use them either. And the spec says that queues never |
309 | * advance on an error completion status, which makes them totally | 309 | * advance on an error completion status, which makes them totally |
310 | * unsuitable for Isochronous transfers. | 310 | * unsuitable for Isochronous transfers. |
311 | * | ||
312 | * There's also a special skeleton QH used for QHs which are in the process | ||
313 | * of unlinking and so may still be in use by the hardware. It too never | ||
314 | * appears on the schedule. | ||
311 | */ | 315 | */ |
312 | 316 | ||
313 | #define UHCI_NUM_SKELQH 14 | 317 | #define UHCI_NUM_SKELQH 11 |
314 | #define skel_unlink_qh skelqh[0] | 318 | #define SKEL_UNLINK 0 |
315 | #define skel_iso_qh skelqh[1] | 319 | #define skel_unlink_qh skelqh[SKEL_UNLINK] |
316 | #define skel_int128_qh skelqh[2] | 320 | #define SKEL_ISO 1 |
317 | #define skel_int64_qh skelqh[3] | 321 | #define skel_iso_qh skelqh[SKEL_ISO] |
318 | #define skel_int32_qh skelqh[4] | 322 | /* int128, int64, ..., int1 = 2, 3, ..., 9 */ |
319 | #define skel_int16_qh skelqh[5] | 323 | #define SKEL_INDEX(exponent) (9 - exponent) |
320 | #define skel_int8_qh skelqh[6] | 324 | #define SKEL_ASYNC 9 |
321 | #define skel_int4_qh skelqh[7] | 325 | #define skel_async_qh skelqh[SKEL_ASYNC] |
322 | #define skel_int2_qh skelqh[8] | 326 | #define SKEL_TERM 10 |
323 | #define skel_int1_qh skelqh[9] | 327 | #define skel_term_qh skelqh[SKEL_TERM] |
324 | #define skel_ls_control_qh skelqh[10] | 328 | |
325 | #define skel_fs_control_qh skelqh[11] | 329 | /* The following entries refer to sublists of skel_async_qh */ |
326 | #define skel_bulk_qh skelqh[12] | 330 | #define SKEL_LS_CONTROL 20 |
327 | #define skel_term_qh skelqh[13] | 331 | #define SKEL_FS_CONTROL 21 |
328 | 332 | #define SKEL_FSBR SKEL_FS_CONTROL | |
329 | /* Find the skelqh entry corresponding to an interval exponent */ | 333 | #define SKEL_BULK 22 |
330 | #define UHCI_SKEL_INDEX(exponent) (9 - exponent) | ||
331 | |||
332 | 334 | ||
333 | /* | 335 | /* |
334 | * The UHCI controller and root hub | 336 | * The UHCI controller and root hub |