diff options
Diffstat (limited to 'include/linux/usb/hcd.h')
-rw-r--r-- | include/linux/usb/hcd.h | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 3b571f1ffbb3..0097136ba45d 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -76,6 +76,10 @@ struct usb_hcd { | |||
76 | struct kref kref; /* reference counter */ | 76 | struct kref kref; /* reference counter */ |
77 | 77 | ||
78 | const char *product_desc; /* product/vendor string */ | 78 | const char *product_desc; /* product/vendor string */ |
79 | int speed; /* Speed for this roothub. | ||
80 | * May be different from | ||
81 | * hcd->driver->flags & HCD_MASK | ||
82 | */ | ||
79 | char irq_descr[24]; /* driver + bus # */ | 83 | char irq_descr[24]; /* driver + bus # */ |
80 | 84 | ||
81 | struct timer_list rh_timer; /* drives root-hub polling */ | 85 | struct timer_list rh_timer; /* drives root-hub polling */ |
@@ -99,6 +103,8 @@ struct usb_hcd { | |||
99 | #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ | 103 | #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ |
100 | #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ | 104 | #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ |
101 | #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ | 105 | #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ |
106 | #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ | ||
107 | #define HCD_FLAG_DEAD 6 /* controller has died? */ | ||
102 | 108 | ||
103 | /* The flags can be tested using these macros; they are likely to | 109 | /* The flags can be tested using these macros; they are likely to |
104 | * be slightly faster than test_bit(). | 110 | * be slightly faster than test_bit(). |
@@ -108,10 +114,13 @@ struct usb_hcd { | |||
108 | #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) | 114 | #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) |
109 | #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) | 115 | #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) |
110 | #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) | 116 | #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) |
117 | #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) | ||
118 | #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) | ||
111 | 119 | ||
112 | /* Flags that get set only during HCD registration or removal. */ | 120 | /* Flags that get set only during HCD registration or removal. */ |
113 | unsigned rh_registered:1;/* is root hub registered? */ | 121 | unsigned rh_registered:1;/* is root hub registered? */ |
114 | unsigned rh_pollable:1; /* may we poll the root hub? */ | 122 | unsigned rh_pollable:1; /* may we poll the root hub? */ |
123 | unsigned msix_enabled:1; /* driver has MSI-X enabled? */ | ||
115 | 124 | ||
116 | /* The next flag is a stopgap, to be removed when all the HCDs | 125 | /* The next flag is a stopgap, to be removed when all the HCDs |
117 | * support the new root-hub polling mechanism. */ | 126 | * support the new root-hub polling mechanism. */ |
@@ -137,7 +146,9 @@ struct usb_hcd { | |||
137 | * bandwidth_mutex should be dropped after a successful control message | 146 | * bandwidth_mutex should be dropped after a successful control message |
138 | * to the device, or resetting the bandwidth after a failed attempt. | 147 | * to the device, or resetting the bandwidth after a failed attempt. |
139 | */ | 148 | */ |
140 | struct mutex bandwidth_mutex; | 149 | struct mutex *bandwidth_mutex; |
150 | struct usb_hcd *shared_hcd; | ||
151 | struct usb_hcd *primary_hcd; | ||
141 | 152 | ||
142 | 153 | ||
143 | #define HCD_BUFFER_POOLS 4 | 154 | #define HCD_BUFFER_POOLS 4 |
@@ -200,6 +211,7 @@ struct hc_driver { | |||
200 | int flags; | 211 | int flags; |
201 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ | 212 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ |
202 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ | 213 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ |
214 | #define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */ | ||
203 | #define HCD_USB11 0x0010 /* USB 1.1 */ | 215 | #define HCD_USB11 0x0010 /* USB 1.1 */ |
204 | #define HCD_USB2 0x0020 /* USB 2.0 */ | 216 | #define HCD_USB2 0x0020 /* USB 2.0 */ |
205 | #define HCD_USB3 0x0040 /* USB 3.0 */ | 217 | #define HCD_USB3 0x0040 /* USB 3.0 */ |
@@ -233,6 +245,19 @@ struct hc_driver { | |||
233 | int (*urb_dequeue)(struct usb_hcd *hcd, | 245 | int (*urb_dequeue)(struct usb_hcd *hcd, |
234 | struct urb *urb, int status); | 246 | struct urb *urb, int status); |
235 | 247 | ||
248 | /* | ||
249 | * (optional) these hooks allow an HCD to override the default DMA | ||
250 | * mapping and unmapping routines. In general, they shouldn't be | ||
251 | * necessary unless the host controller has special DMA requirements, | ||
252 | * such as alignment contraints. If these are not specified, the | ||
253 | * general usb_hcd_(un)?map_urb_for_dma functions will be used instead | ||
254 | * (and it may be a good idea to call these functions in your HCD | ||
255 | * implementation) | ||
256 | */ | ||
257 | int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb, | ||
258 | gfp_t mem_flags); | ||
259 | void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb); | ||
260 | |||
236 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | 261 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ |
237 | void (*endpoint_disable)(struct usb_hcd *hcd, | 262 | void (*endpoint_disable)(struct usb_hcd *hcd, |
238 | struct usb_host_endpoint *ep); | 263 | struct usb_host_endpoint *ep); |
@@ -329,6 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
329 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); | 354 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); |
330 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, | 355 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, |
331 | int status); | 356 | int status); |
357 | extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, | ||
358 | gfp_t mem_flags); | ||
359 | extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); | ||
360 | extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *); | ||
332 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, | 361 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, |
333 | struct usb_host_endpoint *ep); | 362 | struct usb_host_endpoint *ep); |
334 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | 363 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, |
@@ -344,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev); | |||
344 | 373 | ||
345 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, | 374 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, |
346 | struct device *dev, const char *bus_name); | 375 | struct device *dev, const char *bus_name); |
376 | extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver, | ||
377 | struct device *dev, const char *bus_name, | ||
378 | struct usb_hcd *shared_hcd); | ||
347 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); | 379 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); |
348 | extern void usb_put_hcd(struct usb_hcd *hcd); | 380 | extern void usb_put_hcd(struct usb_hcd *hcd); |
381 | extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd); | ||
349 | extern int usb_add_hcd(struct usb_hcd *hcd, | 382 | extern int usb_add_hcd(struct usb_hcd *hcd, |
350 | unsigned int irqnum, unsigned long irqflags); | 383 | unsigned int irqnum, unsigned long irqflags); |
351 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 384 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
@@ -469,6 +502,10 @@ extern void usb_ep0_reinit(struct usb_device *); | |||
469 | 502 | ||
470 | /*-------------------------------------------------------------------------*/ | 503 | /*-------------------------------------------------------------------------*/ |
471 | 504 | ||
505 | /* class requests from USB 3.0 hub spec, table 10-5 */ | ||
506 | #define SetHubDepth (0x3000 | HUB_SET_DEPTH) | ||
507 | #define GetPortErrorCount (0x8000 | HUB_GET_PORT_ERR_COUNT) | ||
508 | |||
472 | /* | 509 | /* |
473 | * Generic bandwidth allocation constants/support | 510 | * Generic bandwidth allocation constants/support |
474 | */ | 511 | */ |
@@ -615,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | |||
615 | 652 | ||
616 | /*-------------------------------------------------------------------------*/ | 653 | /*-------------------------------------------------------------------------*/ |
617 | 654 | ||
618 | /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ | ||
619 | /* bleech -- resurfaced in 2.4.11 or 2.4.12 */ | ||
620 | #define bitmap DeviceRemovable | ||
621 | |||
622 | |||
623 | /*-------------------------------------------------------------------------*/ | ||
624 | |||
625 | /* random stuff */ | 655 | /* random stuff */ |
626 | 656 | ||
627 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ | 657 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ |