diff options
Diffstat (limited to 'include/linux/usb/hcd.h')
-rw-r--r-- | include/linux/usb/hcd.h | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index a854fe89484e..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,6 +114,8 @@ 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? */ |
@@ -138,7 +146,9 @@ struct usb_hcd { | |||
138 | * bandwidth_mutex should be dropped after a successful control message | 146 | * bandwidth_mutex should be dropped after a successful control message |
139 | * to the device, or resetting the bandwidth after a failed attempt. | 147 | * to the device, or resetting the bandwidth after a failed attempt. |
140 | */ | 148 | */ |
141 | struct mutex bandwidth_mutex; | 149 | struct mutex *bandwidth_mutex; |
150 | struct usb_hcd *shared_hcd; | ||
151 | struct usb_hcd *primary_hcd; | ||
142 | 152 | ||
143 | 153 | ||
144 | #define HCD_BUFFER_POOLS 4 | 154 | #define HCD_BUFFER_POOLS 4 |
@@ -201,6 +211,7 @@ struct hc_driver { | |||
201 | int flags; | 211 | int flags; |
202 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ | 212 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ |
203 | #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 */ | ||
204 | #define HCD_USB11 0x0010 /* USB 1.1 */ | 215 | #define HCD_USB11 0x0010 /* USB 1.1 */ |
205 | #define HCD_USB2 0x0020 /* USB 2.0 */ | 216 | #define HCD_USB2 0x0020 /* USB 2.0 */ |
206 | #define HCD_USB3 0x0040 /* USB 3.0 */ | 217 | #define HCD_USB3 0x0040 /* USB 3.0 */ |
@@ -234,6 +245,19 @@ struct hc_driver { | |||
234 | int (*urb_dequeue)(struct usb_hcd *hcd, | 245 | int (*urb_dequeue)(struct usb_hcd *hcd, |
235 | struct urb *urb, int status); | 246 | struct urb *urb, int status); |
236 | 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 | |||
237 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | 261 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ |
238 | void (*endpoint_disable)(struct usb_hcd *hcd, | 262 | void (*endpoint_disable)(struct usb_hcd *hcd, |
239 | struct usb_host_endpoint *ep); | 263 | struct usb_host_endpoint *ep); |
@@ -330,8 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
330 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); | 354 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); |
331 | 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, |
332 | int status); | 356 | int status); |
333 | extern void unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); | 357 | extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, |
334 | extern void unmap_urb_for_dma(struct usb_hcd *, struct 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 *); | ||
335 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, | 361 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, |
336 | struct usb_host_endpoint *ep); | 362 | struct usb_host_endpoint *ep); |
337 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | 363 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, |
@@ -347,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev); | |||
347 | 373 | ||
348 | 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, |
349 | 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); | ||
350 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); | 379 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); |
351 | 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); | ||
352 | extern int usb_add_hcd(struct usb_hcd *hcd, | 382 | extern int usb_add_hcd(struct usb_hcd *hcd, |
353 | unsigned int irqnum, unsigned long irqflags); | 383 | unsigned int irqnum, unsigned long irqflags); |
354 | extern void usb_remove_hcd(struct usb_hcd *hcd); | 384 | extern void usb_remove_hcd(struct usb_hcd *hcd); |
@@ -622,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | |||
622 | 652 | ||
623 | /*-------------------------------------------------------------------------*/ | 653 | /*-------------------------------------------------------------------------*/ |
624 | 654 | ||
625 | /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ | ||
626 | /* bleech -- resurfaced in 2.4.11 or 2.4.12 */ | ||
627 | #define bitmap DeviceRemovable | ||
628 | |||
629 | |||
630 | /*-------------------------------------------------------------------------*/ | ||
631 | |||
632 | /* random stuff */ | 655 | /* random stuff */ |
633 | 656 | ||
634 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ | 657 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ |