diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-09-26 16:31:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 19:47:41 -0400 |
commit | 8b262bd25580e165710e8a27df19cd60c2ef58a3 (patch) | |
tree | 60cd292d40e4073308ce3189a1217314df0e3a8b /drivers/usb/host/uhci-hcd.h | |
parent | d09d36a91c70cb3cc609d693bf6a7e7a266ff9e6 (diff) |
[PATCH] USB: UHCI: Spruce up some comments
This patch (as570) changes some comments in the uhci-hcd header file and
removes an unused declaration (something I forgot to erase in an earlier
patch).
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/host/uhci-hcd.h | 91 +++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 42 deletions(-)
Diffstat (limited to 'drivers/usb/host/uhci-hcd.h')
-rw-r--r-- | drivers/usb/host/uhci-hcd.h | 91 |
1 files changed, 49 insertions, 42 deletions
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h index b04d99df0a0e..e576db57a926 100644 --- a/drivers/usb/host/uhci-hcd.h +++ b/drivers/usb/host/uhci-hcd.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #define usb_packetid(pipe) (usb_pipein(pipe) ? USB_PID_IN : USB_PID_OUT) | 7 | #define usb_packetid(pipe) (usb_pipein(pipe) ? USB_PID_IN : USB_PID_OUT) |
8 | #define PIPE_DEVEP_MASK 0x0007ff00 | 8 | #define PIPE_DEVEP_MASK 0x0007ff00 |
9 | 9 | ||
10 | |||
10 | /* | 11 | /* |
11 | * Universal Host Controller Interface data structures and defines | 12 | * Universal Host Controller Interface data structures and defines |
12 | */ | 13 | */ |
@@ -82,15 +83,10 @@ | |||
82 | #define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */ | 83 | #define UHCI_MAX_SOF_NUMBER 2047 /* in an SOF packet */ |
83 | #define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */ | 84 | #define CAN_SCHEDULE_FRAMES 1000 /* how far future frames can be scheduled */ |
84 | 85 | ||
85 | struct uhci_frame_list { | ||
86 | __le32 frame[UHCI_NUMFRAMES]; | ||
87 | |||
88 | void *frame_cpu[UHCI_NUMFRAMES]; | ||
89 | 86 | ||
90 | dma_addr_t dma_handle; | 87 | /* |
91 | }; | 88 | * Queue Headers |
92 | 89 | */ | |
93 | struct urb_priv; | ||
94 | 90 | ||
95 | /* | 91 | /* |
96 | * One role of a QH is to hold a queue of TDs for some endpoint. Each QH is | 92 | * One role of a QH is to hold a queue of TDs for some endpoint. Each QH is |
@@ -116,13 +112,13 @@ struct uhci_qh { | |||
116 | 112 | ||
117 | struct urb_priv *urbp; | 113 | struct urb_priv *urbp; |
118 | 114 | ||
119 | struct list_head list; /* P: uhci->frame_list_lock */ | 115 | struct list_head list; |
120 | struct list_head remove_list; /* P: uhci->remove_list_lock */ | 116 | struct list_head remove_list; |
121 | } __attribute__((aligned(16))); | 117 | } __attribute__((aligned(16))); |
122 | 118 | ||
123 | /* | 119 | /* |
124 | * We need a special accessor for the element pointer because it is | 120 | * We need a special accessor for the element pointer because it is |
125 | * subject to asynchronous updates by the controller | 121 | * subject to asynchronous updates by the controller. |
126 | */ | 122 | */ |
127 | static __le32 inline qh_element(struct uhci_qh *qh) { | 123 | static __le32 inline qh_element(struct uhci_qh *qh) { |
128 | __le32 element = qh->element; | 124 | __le32 element = qh->element; |
@@ -131,6 +127,11 @@ static __le32 inline qh_element(struct uhci_qh *qh) { | |||
131 | return element; | 127 | return element; |
132 | } | 128 | } |
133 | 129 | ||
130 | |||
131 | /* | ||
132 | * Transfer Descriptors | ||
133 | */ | ||
134 | |||
134 | /* | 135 | /* |
135 | * for TD <status>: | 136 | * for TD <status>: |
136 | */ | 137 | */ |
@@ -183,17 +184,10 @@ static __le32 inline qh_element(struct uhci_qh *qh) { | |||
183 | * | 184 | * |
184 | * That's silly, the hardware doesn't care. The hardware only cares that | 185 | * That's silly, the hardware doesn't care. The hardware only cares that |
185 | * the hardware words are 16-byte aligned, and we can have any amount of | 186 | * the hardware words are 16-byte aligned, and we can have any amount of |
186 | * sw space after the TD entry as far as I can tell. | 187 | * sw space after the TD entry. |
187 | * | ||
188 | * But let's just go with the documentation, at least for 32-bit machines. | ||
189 | * On 64-bit machines we probably want to take advantage of the fact that | ||
190 | * hw doesn't really care about the size of the sw-only area. | ||
191 | * | ||
192 | * Alas, not anymore, we have more than 4 words for software, woops. | ||
193 | * Everything still works tho, surprise! -jerdfelt | ||
194 | * | 188 | * |
195 | * td->link points to either another TD (not necessarily for the same urb or | 189 | * td->link points to either another TD (not necessarily for the same urb or |
196 | * even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs) | 190 | * even the same endpoint), or nothing (PTR_TERM), or a QH (for queued urbs). |
197 | */ | 191 | */ |
198 | struct uhci_td { | 192 | struct uhci_td { |
199 | /* Hardware fields */ | 193 | /* Hardware fields */ |
@@ -205,16 +199,16 @@ struct uhci_td { | |||
205 | /* Software fields */ | 199 | /* Software fields */ |
206 | dma_addr_t dma_handle; | 200 | dma_addr_t dma_handle; |
207 | 201 | ||
208 | struct list_head list; /* P: urb->lock */ | 202 | struct list_head list; |
209 | struct list_head remove_list; /* P: uhci->td_remove_list_lock */ | 203 | struct list_head remove_list; |
210 | 204 | ||
211 | int frame; /* for iso: what frame? */ | 205 | int frame; /* for iso: what frame? */ |
212 | struct list_head fl_list; /* P: uhci->frame_list_lock */ | 206 | struct list_head fl_list; |
213 | } __attribute__((aligned(16))); | 207 | } __attribute__((aligned(16))); |
214 | 208 | ||
215 | /* | 209 | /* |
216 | * We need a special accessor for the control/status word because it is | 210 | * We need a special accessor for the control/status word because it is |
217 | * subject to asynchronous updates by the controller | 211 | * subject to asynchronous updates by the controller. |
218 | */ | 212 | */ |
219 | static u32 inline td_status(struct uhci_td *td) { | 213 | static u32 inline td_status(struct uhci_td *td) { |
220 | __le32 status = td->status; | 214 | __le32 status = td->status; |
@@ -225,6 +219,10 @@ static u32 inline td_status(struct uhci_td *td) { | |||
225 | 219 | ||
226 | 220 | ||
227 | /* | 221 | /* |
222 | * Skeleton Queue Headers | ||
223 | */ | ||
224 | |||
225 | /* | ||
228 | * The UHCI driver places Interrupt, Control and Bulk into QH's both | 226 | * The UHCI driver places Interrupt, Control and Bulk into QH's both |
229 | * to group together TD's for one transfer, and also to faciliate queuing | 227 | * to group together TD's for one transfer, and also to faciliate queuing |
230 | * of URB's. To make it easy to insert entries into the schedule, we have | 228 | * of URB's. To make it easy to insert entries into the schedule, we have |
@@ -254,15 +252,15 @@ static u32 inline td_status(struct uhci_td *td) { | |||
254 | * | 252 | * |
255 | * The terminating QH is used for 2 reasons: | 253 | * The terminating QH is used for 2 reasons: |
256 | * - To place a terminating TD which is used to workaround a PIIX bug | 254 | * - To place a terminating TD which is used to workaround a PIIX bug |
257 | * (see Intel errata for explanation) | 255 | * (see Intel errata for explanation), and |
258 | * - To loop back to the full-speed control queue for full-speed bandwidth | 256 | * - To loop back to the full-speed control queue for full-speed bandwidth |
259 | * reclamation | 257 | * reclamation. |
260 | * | 258 | * |
261 | * Isochronous transfers are stored before the start of the skeleton | 259 | * Isochronous transfers are stored before the start of the skeleton |
262 | * schedule and don't use QH's. While the UHCI spec doesn't forbid the | 260 | * schedule and don't use QH's. While the UHCI spec doesn't forbid the |
263 | * use of QH's for Isochronous, it doesn't use them either. Since we don't | 261 | * use of QH's for Isochronous, it doesn't use them either. And the spec |
264 | * need to use them either, we follow the spec diagrams in hope that it'll | 262 | * says that queues never advance on an error completion status, which |
265 | * be more compatible with future UHCI implementations. | 263 | * makes them totally unsuitable for Isochronous transfers. |
266 | */ | 264 | */ |
267 | 265 | ||
268 | #define UHCI_NUM_SKELQH 12 | 266 | #define UHCI_NUM_SKELQH 12 |
@@ -312,8 +310,13 @@ static inline int __interval_to_skel(int interval) | |||
312 | return 0; /* int128 for 128-255 ms (Max.) */ | 310 | return 0; /* int128 for 128-255 ms (Max.) */ |
313 | } | 311 | } |
314 | 312 | ||
313 | |||
314 | /* | ||
315 | * The UHCI controller and root hub | ||
316 | */ | ||
317 | |||
315 | /* | 318 | /* |
316 | * States for the root hub. | 319 | * States for the root hub: |
317 | * | 320 | * |
318 | * To prevent "bouncing" in the presence of electrical noise, | 321 | * To prevent "bouncing" in the presence of electrical noise, |
319 | * when there are no devices attached we delay for 1 second in the | 322 | * when there are no devices attached we delay for 1 second in the |
@@ -324,7 +327,7 @@ static inline int __interval_to_skel(int interval) | |||
324 | */ | 327 | */ |
325 | enum uhci_rh_state { | 328 | enum uhci_rh_state { |
326 | /* In the following states the HC must be halted. | 329 | /* In the following states the HC must be halted. |
327 | * These two must come first */ | 330 | * These two must come first. */ |
328 | UHCI_RH_RESET, | 331 | UHCI_RH_RESET, |
329 | UHCI_RH_SUSPENDED, | 332 | UHCI_RH_SUSPENDED, |
330 | 333 | ||
@@ -336,13 +339,13 @@ enum uhci_rh_state { | |||
336 | UHCI_RH_SUSPENDING, | 339 | UHCI_RH_SUSPENDING, |
337 | 340 | ||
338 | /* In the following states it's an error if the HC is halted. | 341 | /* In the following states it's an error if the HC is halted. |
339 | * These two must come last */ | 342 | * These two must come last. */ |
340 | UHCI_RH_RUNNING, /* The normal state */ | 343 | UHCI_RH_RUNNING, /* The normal state */ |
341 | UHCI_RH_RUNNING_NODEVS, /* Running with no devices attached */ | 344 | UHCI_RH_RUNNING_NODEVS, /* Running with no devices attached */ |
342 | }; | 345 | }; |
343 | 346 | ||
344 | /* | 347 | /* |
345 | * This describes the full uhci information. | 348 | * The full UHCI controller information: |
346 | */ | 349 | */ |
347 | struct uhci_hcd { | 350 | struct uhci_hcd { |
348 | 351 | ||
@@ -361,7 +364,7 @@ struct uhci_hcd { | |||
361 | spinlock_t lock; | 364 | spinlock_t lock; |
362 | 365 | ||
363 | dma_addr_t frame_dma_handle; /* Hardware frame list */ | 366 | dma_addr_t frame_dma_handle; /* Hardware frame list */ |
364 | __le32 *frame; /* P: uhci->lock */ | 367 | __le32 *frame; |
365 | void **frame_cpu; /* CPU's frame list */ | 368 | void **frame_cpu; /* CPU's frame list */ |
366 | 369 | ||
367 | int fsbr; /* Full-speed bandwidth reclamation */ | 370 | int fsbr; /* Full-speed bandwidth reclamation */ |
@@ -387,22 +390,22 @@ struct uhci_hcd { | |||
387 | unsigned long ports_timeout; /* Time to stop signalling */ | 390 | unsigned long ports_timeout; /* Time to stop signalling */ |
388 | 391 | ||
389 | /* Main list of URB's currently controlled by this HC */ | 392 | /* Main list of URB's currently controlled by this HC */ |
390 | struct list_head urb_list; /* P: uhci->lock */ | 393 | struct list_head urb_list; |
391 | 394 | ||
392 | /* List of QH's that are done, but waiting to be unlinked (race) */ | 395 | /* List of QH's that are done, but waiting to be unlinked (race) */ |
393 | struct list_head qh_remove_list; /* P: uhci->lock */ | 396 | struct list_head qh_remove_list; |
394 | unsigned int qh_remove_age; /* Age in frames */ | 397 | unsigned int qh_remove_age; /* Age in frames */ |
395 | 398 | ||
396 | /* List of TD's that are done, but waiting to be freed (race) */ | 399 | /* List of TD's that are done, but waiting to be freed (race) */ |
397 | struct list_head td_remove_list; /* P: uhci->lock */ | 400 | struct list_head td_remove_list; |
398 | unsigned int td_remove_age; /* Age in frames */ | 401 | unsigned int td_remove_age; /* Age in frames */ |
399 | 402 | ||
400 | /* List of asynchronously unlinked URB's */ | 403 | /* List of asynchronously unlinked URB's */ |
401 | struct list_head urb_remove_list; /* P: uhci->lock */ | 404 | struct list_head urb_remove_list; |
402 | unsigned int urb_remove_age; /* Age in frames */ | 405 | unsigned int urb_remove_age; /* Age in frames */ |
403 | 406 | ||
404 | /* List of URB's awaiting completion callback */ | 407 | /* List of URB's awaiting completion callback */ |
405 | struct list_head complete_list; /* P: uhci->lock */ | 408 | struct list_head complete_list; |
406 | 409 | ||
407 | int rh_numports; /* Number of root-hub ports */ | 410 | int rh_numports; /* Number of root-hub ports */ |
408 | 411 | ||
@@ -421,13 +424,17 @@ static inline struct usb_hcd *uhci_to_hcd(struct uhci_hcd *uhci) | |||
421 | 424 | ||
422 | #define uhci_dev(u) (uhci_to_hcd(u)->self.controller) | 425 | #define uhci_dev(u) (uhci_to_hcd(u)->self.controller) |
423 | 426 | ||
427 | |||
428 | /* | ||
429 | * Private per-URB data | ||
430 | */ | ||
424 | struct urb_priv { | 431 | struct urb_priv { |
425 | struct list_head urb_list; | 432 | struct list_head urb_list; |
426 | 433 | ||
427 | struct urb *urb; | 434 | struct urb *urb; |
428 | 435 | ||
429 | struct uhci_qh *qh; /* QH for this URB */ | 436 | struct uhci_qh *qh; /* QH for this URB */ |
430 | struct list_head td_list; /* P: urb->lock */ | 437 | struct list_head td_list; |
431 | 438 | ||
432 | unsigned fsbr : 1; /* URB turned on FSBR */ | 439 | unsigned fsbr : 1; /* URB turned on FSBR */ |
433 | unsigned fsbr_timeout : 1; /* URB timed out on FSBR */ | 440 | unsigned fsbr_timeout : 1; /* URB timed out on FSBR */ |
@@ -438,9 +445,10 @@ struct urb_priv { | |||
438 | 445 | ||
439 | unsigned long fsbrtime; /* In jiffies */ | 446 | unsigned long fsbrtime; /* In jiffies */ |
440 | 447 | ||
441 | struct list_head queue_list; /* P: uhci->frame_list_lock */ | 448 | struct list_head queue_list; |
442 | }; | 449 | }; |
443 | 450 | ||
451 | |||
444 | /* | 452 | /* |
445 | * Locking in uhci.c | 453 | * Locking in uhci.c |
446 | * | 454 | * |
@@ -460,6 +468,5 @@ struct urb_priv { | |||
460 | 468 | ||
461 | #define PCI_VENDOR_ID_GENESYS 0x17a0 | 469 | #define PCI_VENDOR_ID_GENESYS 0x17a0 |
462 | #define PCI_DEVICE_ID_GL880S_UHCI 0x8083 | 470 | #define PCI_DEVICE_ID_GL880S_UHCI 0x8083 |
463 | #define PCI_DEVICE_ID_GL880S_EHCI 0x8084 | ||
464 | 471 | ||
465 | #endif | 472 | #endif |