diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/usb.h | 79 | ||||
-rw-r--r-- | include/linux/usb/gadget.h (renamed from include/linux/usb_gadget.h) | 97 | ||||
-rw-r--r-- | include/linux/usb/quirks.h | 7 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 20 | ||||
-rw-r--r-- | include/linux/usb_sl811.h | 26 |
5 files changed, 152 insertions, 77 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 4f33a58fa9d1..c5c8f169d3cf 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -52,6 +52,7 @@ struct ep_device; | |||
52 | * @ep_dev: ep_device for sysfs info | 52 | * @ep_dev: ep_device for sysfs info |
53 | * @extra: descriptors following this endpoint in the configuration | 53 | * @extra: descriptors following this endpoint in the configuration |
54 | * @extralen: how many bytes of "extra" are valid | 54 | * @extralen: how many bytes of "extra" are valid |
55 | * @enabled: URBs may be submitted to this endpoint | ||
55 | * | 56 | * |
56 | * USB requests are always queued to a given endpoint, identified by a | 57 | * USB requests are always queued to a given endpoint, identified by a |
57 | * descriptor within an active interface in a given USB configuration. | 58 | * descriptor within an active interface in a given USB configuration. |
@@ -64,6 +65,7 @@ struct usb_host_endpoint { | |||
64 | 65 | ||
65 | unsigned char *extra; /* Extra descriptors */ | 66 | unsigned char *extra; /* Extra descriptors */ |
66 | int extralen; | 67 | int extralen; |
68 | int enabled; | ||
67 | }; | 69 | }; |
68 | 70 | ||
69 | /* host-side wrapper for one interface setting's parsed descriptors */ | 71 | /* host-side wrapper for one interface setting's parsed descriptors */ |
@@ -344,6 +346,11 @@ struct usb_tt; | |||
344 | * | 346 | * |
345 | * Usbcore drivers should not set usbdev->state directly. Instead use | 347 | * Usbcore drivers should not set usbdev->state directly. Instead use |
346 | * usb_set_device_state(). | 348 | * usb_set_device_state(). |
349 | * | ||
350 | * @authorized: (user space) policy determines if we authorize this | ||
351 | * device to be used or not. By default, wired USB | ||
352 | * devices are authorized. WUSB devices are not, until we | ||
353 | * authorize them from user space. FIXME -- complete doc | ||
347 | */ | 354 | */ |
348 | struct usb_device { | 355 | struct usb_device { |
349 | int devnum; /* Address on USB bus */ | 356 | int devnum; /* Address on USB bus */ |
@@ -376,8 +383,11 @@ struct usb_device { | |||
376 | u8 portnum; /* Parent port number (origin 1) */ | 383 | u8 portnum; /* Parent port number (origin 1) */ |
377 | u8 level; /* Number of USB hub ancestors */ | 384 | u8 level; /* Number of USB hub ancestors */ |
378 | 385 | ||
386 | unsigned can_submit:1; /* URBs may be submitted */ | ||
379 | unsigned discon_suspended:1; /* Disconnected while suspended */ | 387 | unsigned discon_suspended:1; /* Disconnected while suspended */ |
380 | unsigned have_langid:1; /* whether string_langid is valid */ | 388 | unsigned have_langid:1; /* whether string_langid is valid */ |
389 | unsigned authorized:1; /* Policy has determined we can use it */ | ||
390 | unsigned wusb:1; /* Device is Wireless USB */ | ||
381 | int string_langid; /* language ID for strings */ | 391 | int string_langid; /* language ID for strings */ |
382 | 392 | ||
383 | /* static strings from the device */ | 393 | /* static strings from the device */ |
@@ -405,6 +415,7 @@ struct usb_device { | |||
405 | 415 | ||
406 | int pm_usage_cnt; /* usage counter for autosuspend */ | 416 | int pm_usage_cnt; /* usage counter for autosuspend */ |
407 | u32 quirks; /* quirks of the whole device */ | 417 | u32 quirks; /* quirks of the whole device */ |
418 | atomic_t urbnum; /* number of URBs submitted for the whole device */ | ||
408 | 419 | ||
409 | #ifdef CONFIG_PM | 420 | #ifdef CONFIG_PM |
410 | struct delayed_work autosuspend; /* for delayed autosuspends */ | 421 | struct delayed_work autosuspend; /* for delayed autosuspends */ |
@@ -419,6 +430,7 @@ struct usb_device { | |||
419 | unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ | 430 | unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ |
420 | unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ | 431 | unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ |
421 | unsigned autoresume_disabled:1; /* disabled by the user */ | 432 | unsigned autoresume_disabled:1; /* disabled by the user */ |
433 | unsigned skip_sys_resume:1; /* skip the next system resume */ | ||
422 | #endif | 434 | #endif |
423 | }; | 435 | }; |
424 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 436 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
@@ -555,6 +567,29 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, | |||
555 | /*-------------------------------------------------------------------------*/ | 567 | /*-------------------------------------------------------------------------*/ |
556 | 568 | ||
557 | /** | 569 | /** |
570 | * usb_endpoint_num - get the endpoint's number | ||
571 | * @epd: endpoint to be checked | ||
572 | * | ||
573 | * Returns @epd's number: 0 to 15. | ||
574 | */ | ||
575 | static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) | ||
576 | { | ||
577 | return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | ||
578 | } | ||
579 | |||
580 | /** | ||
581 | * usb_endpoint_type - get the endpoint's transfer type | ||
582 | * @epd: endpoint to be checked | ||
583 | * | ||
584 | * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according | ||
585 | * to @epd's transfer type. | ||
586 | */ | ||
587 | static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) | ||
588 | { | ||
589 | return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
590 | } | ||
591 | |||
592 | /** | ||
558 | * usb_endpoint_dir_in - check if the endpoint has IN direction | 593 | * usb_endpoint_dir_in - check if the endpoint has IN direction |
559 | * @epd: endpoint to be checked | 594 | * @epd: endpoint to be checked |
560 | * | 595 | * |
@@ -996,6 +1031,8 @@ extern int usb_disabled(void); | |||
996 | 1031 | ||
997 | /* | 1032 | /* |
998 | * urb->transfer_flags: | 1033 | * urb->transfer_flags: |
1034 | * | ||
1035 | * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb(). | ||
999 | */ | 1036 | */ |
1000 | #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ | 1037 | #define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ |
1001 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame | 1038 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame |
@@ -1008,6 +1045,10 @@ extern int usb_disabled(void); | |||
1008 | * needed */ | 1045 | * needed */ |
1009 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ | 1046 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ |
1010 | 1047 | ||
1048 | #define URB_DIR_IN 0x0200 /* Transfer from device to host */ | ||
1049 | #define URB_DIR_OUT 0 | ||
1050 | #define URB_DIR_MASK URB_DIR_IN | ||
1051 | |||
1011 | struct usb_iso_packet_descriptor { | 1052 | struct usb_iso_packet_descriptor { |
1012 | unsigned int offset; | 1053 | unsigned int offset; |
1013 | unsigned int length; /* expected length */ | 1054 | unsigned int length; /* expected length */ |
@@ -1037,6 +1078,8 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1037 | * @urb_list: For use by current owner of the URB. | 1078 | * @urb_list: For use by current owner of the URB. |
1038 | * @anchor_list: membership in the list of an anchor | 1079 | * @anchor_list: membership in the list of an anchor |
1039 | * @anchor: to anchor URBs to a common mooring | 1080 | * @anchor: to anchor URBs to a common mooring |
1081 | * @ep: Points to the endpoint's data structure. Will eventually | ||
1082 | * replace @pipe. | ||
1040 | * @pipe: Holds endpoint number, direction, type, and more. | 1083 | * @pipe: Holds endpoint number, direction, type, and more. |
1041 | * Create these values with the eight macros available; | 1084 | * Create these values with the eight macros available; |
1042 | * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" | 1085 | * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" |
@@ -1201,10 +1244,10 @@ struct urb | |||
1201 | { | 1244 | { |
1202 | /* private: usb core and host controller only fields in the urb */ | 1245 | /* private: usb core and host controller only fields in the urb */ |
1203 | struct kref kref; /* reference count of the URB */ | 1246 | struct kref kref; /* reference count of the URB */ |
1204 | spinlock_t lock; /* lock for the URB */ | ||
1205 | void *hcpriv; /* private data for host controller */ | 1247 | void *hcpriv; /* private data for host controller */ |
1206 | atomic_t use_count; /* concurrent submissions counter */ | 1248 | atomic_t use_count; /* concurrent submissions counter */ |
1207 | u8 reject; /* submissions will fail */ | 1249 | u8 reject; /* submissions will fail */ |
1250 | int unlinked; /* unlink error code */ | ||
1208 | 1251 | ||
1209 | /* public: documented fields in the urb that can be used by drivers */ | 1252 | /* public: documented fields in the urb that can be used by drivers */ |
1210 | struct list_head urb_list; /* list head for use by the urb's | 1253 | struct list_head urb_list; /* list head for use by the urb's |
@@ -1212,6 +1255,7 @@ struct urb | |||
1212 | struct list_head anchor_list; /* the URB may be anchored by the driver */ | 1255 | struct list_head anchor_list; /* the URB may be anchored by the driver */ |
1213 | struct usb_anchor *anchor; | 1256 | struct usb_anchor *anchor; |
1214 | struct usb_device *dev; /* (in) pointer to associated device */ | 1257 | struct usb_device *dev; /* (in) pointer to associated device */ |
1258 | struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ | ||
1215 | unsigned int pipe; /* (in) pipe information */ | 1259 | unsigned int pipe; /* (in) pipe information */ |
1216 | int status; /* (return) non-ISO status */ | 1260 | int status; /* (return) non-ISO status */ |
1217 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ | 1261 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ |
@@ -1257,7 +1301,6 @@ static inline void usb_fill_control_urb (struct urb *urb, | |||
1257 | usb_complete_t complete_fn, | 1301 | usb_complete_t complete_fn, |
1258 | void *context) | 1302 | void *context) |
1259 | { | 1303 | { |
1260 | spin_lock_init(&urb->lock); | ||
1261 | urb->dev = dev; | 1304 | urb->dev = dev; |
1262 | urb->pipe = pipe; | 1305 | urb->pipe = pipe; |
1263 | urb->setup_packet = setup_packet; | 1306 | urb->setup_packet = setup_packet; |
@@ -1288,7 +1331,6 @@ static inline void usb_fill_bulk_urb (struct urb *urb, | |||
1288 | usb_complete_t complete_fn, | 1331 | usb_complete_t complete_fn, |
1289 | void *context) | 1332 | void *context) |
1290 | { | 1333 | { |
1291 | spin_lock_init(&urb->lock); | ||
1292 | urb->dev = dev; | 1334 | urb->dev = dev; |
1293 | urb->pipe = pipe; | 1335 | urb->pipe = pipe; |
1294 | urb->transfer_buffer = transfer_buffer; | 1336 | urb->transfer_buffer = transfer_buffer; |
@@ -1324,7 +1366,6 @@ static inline void usb_fill_int_urb (struct urb *urb, | |||
1324 | void *context, | 1366 | void *context, |
1325 | int interval) | 1367 | int interval) |
1326 | { | 1368 | { |
1327 | spin_lock_init(&urb->lock); | ||
1328 | urb->dev = dev; | 1369 | urb->dev = dev; |
1329 | urb->pipe = pipe; | 1370 | urb->pipe = pipe; |
1330 | urb->transfer_buffer = transfer_buffer; | 1371 | urb->transfer_buffer = transfer_buffer; |
@@ -1352,6 +1393,30 @@ extern void usb_unanchor_urb(struct urb *urb); | |||
1352 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, | 1393 | extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, |
1353 | unsigned int timeout); | 1394 | unsigned int timeout); |
1354 | 1395 | ||
1396 | /** | ||
1397 | * usb_urb_dir_in - check if an URB describes an IN transfer | ||
1398 | * @urb: URB to be checked | ||
1399 | * | ||
1400 | * Returns 1 if @urb describes an IN transfer (device-to-host), | ||
1401 | * otherwise 0. | ||
1402 | */ | ||
1403 | static inline int usb_urb_dir_in(struct urb *urb) | ||
1404 | { | ||
1405 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN; | ||
1406 | } | ||
1407 | |||
1408 | /** | ||
1409 | * usb_urb_dir_out - check if an URB describes an OUT transfer | ||
1410 | * @urb: URB to be checked | ||
1411 | * | ||
1412 | * Returns 1 if @urb describes an OUT transfer (host-to-device), | ||
1413 | * otherwise 0. | ||
1414 | */ | ||
1415 | static inline int usb_urb_dir_out(struct urb *urb) | ||
1416 | { | ||
1417 | return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; | ||
1418 | } | ||
1419 | |||
1355 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, | 1420 | void *usb_buffer_alloc (struct usb_device *dev, size_t size, |
1356 | gfp_t mem_flags, dma_addr_t *dma); | 1421 | gfp_t mem_flags, dma_addr_t *dma); |
1357 | void usb_buffer_free (struct usb_device *dev, size_t size, | 1422 | void usb_buffer_free (struct usb_device *dev, size_t size, |
@@ -1364,13 +1429,13 @@ void usb_buffer_unmap (struct urb *urb); | |||
1364 | #endif | 1429 | #endif |
1365 | 1430 | ||
1366 | struct scatterlist; | 1431 | struct scatterlist; |
1367 | int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, | 1432 | int usb_buffer_map_sg(const struct usb_device *dev, int is_in, |
1368 | struct scatterlist *sg, int nents); | 1433 | struct scatterlist *sg, int nents); |
1369 | #if 0 | 1434 | #if 0 |
1370 | void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, | 1435 | void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in, |
1371 | struct scatterlist *sg, int n_hw_ents); | 1436 | struct scatterlist *sg, int n_hw_ents); |
1372 | #endif | 1437 | #endif |
1373 | void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, | 1438 | void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in, |
1374 | struct scatterlist *sg, int n_hw_ents); | 1439 | struct scatterlist *sg, int n_hw_ents); |
1375 | 1440 | ||
1376 | /*-------------------------------------------------------------------* | 1441 | /*-------------------------------------------------------------------* |
diff --git a/include/linux/usb_gadget.h b/include/linux/usb/gadget.h index 4f59b2aa8a9e..46705e91573d 100644 --- a/include/linux/usb_gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * <linux/usb_gadget.h> | 2 | * <linux/usb/gadget.h> |
3 | * | 3 | * |
4 | * We call the USB code inside a Linux-based peripheral device a "gadget" | 4 | * We call the USB code inside a Linux-based peripheral device a "gadget" |
5 | * driver, except for the hardware-specific bus glue. One USB host can | 5 | * driver, except for the hardware-specific bus glue. One USB host can |
@@ -22,10 +22,10 @@ struct usb_ep; | |||
22 | /** | 22 | /** |
23 | * struct usb_request - describes one i/o request | 23 | * struct usb_request - describes one i/o request |
24 | * @buf: Buffer used for data. Always provide this; some controllers | 24 | * @buf: Buffer used for data. Always provide this; some controllers |
25 | * only use PIO, or don't use DMA for some endpoints. | 25 | * only use PIO, or don't use DMA for some endpoints. |
26 | * @dma: DMA address corresponding to 'buf'. If you don't set this | 26 | * @dma: DMA address corresponding to 'buf'. If you don't set this |
27 | * field, and the usb controller needs one, it is responsible | 27 | * field, and the usb controller needs one, it is responsible |
28 | * for mapping and unmapping the buffer. | 28 | * for mapping and unmapping the buffer. |
29 | * @length: Length of that data | 29 | * @length: Length of that data |
30 | * @no_interrupt: If true, hints that no completion irq is needed. | 30 | * @no_interrupt: If true, hints that no completion irq is needed. |
31 | * Helpful sometimes with deep request queues that are handled | 31 | * Helpful sometimes with deep request queues that are handled |
@@ -45,16 +45,16 @@ struct usb_ep; | |||
45 | * @context: For use by the completion callback | 45 | * @context: For use by the completion callback |
46 | * @list: For use by the gadget driver. | 46 | * @list: For use by the gadget driver. |
47 | * @status: Reports completion code, zero or a negative errno. | 47 | * @status: Reports completion code, zero or a negative errno. |
48 | * Normally, faults block the transfer queue from advancing until | 48 | * Normally, faults block the transfer queue from advancing until |
49 | * the completion callback returns. | 49 | * the completion callback returns. |
50 | * Code "-ESHUTDOWN" indicates completion caused by device disconnect, | 50 | * Code "-ESHUTDOWN" indicates completion caused by device disconnect, |
51 | * or when the driver disabled the endpoint. | 51 | * or when the driver disabled the endpoint. |
52 | * @actual: Reports bytes transferred to/from the buffer. For reads (OUT | 52 | * @actual: Reports bytes transferred to/from the buffer. For reads (OUT |
53 | * transfers) this may be less than the requested length. If the | 53 | * transfers) this may be less than the requested length. If the |
54 | * short_not_ok flag is set, short reads are treated as errors | 54 | * short_not_ok flag is set, short reads are treated as errors |
55 | * even when status otherwise indicates successful completion. | 55 | * even when status otherwise indicates successful completion. |
56 | * Note that for writes (IN transfers) some data bytes may still | 56 | * Note that for writes (IN transfers) some data bytes may still |
57 | * reside in a device-side FIFO when the request is reported as | 57 | * reside in a device-side FIFO when the request is reported as |
58 | * complete. | 58 | * complete. |
59 | * | 59 | * |
60 | * These are allocated/freed through the endpoint they're used with. The | 60 | * These are allocated/freed through the endpoint they're used with. The |
@@ -128,7 +128,7 @@ struct usb_ep_ops { | |||
128 | * value can sometimes be reduced (hardware allowing), according to | 128 | * value can sometimes be reduced (hardware allowing), according to |
129 | * the endpoint descriptor used to configure the endpoint. | 129 | * the endpoint descriptor used to configure the endpoint. |
130 | * @driver_data:for use by the gadget driver. all other fields are | 130 | * @driver_data:for use by the gadget driver. all other fields are |
131 | * read-only to gadget drivers. | 131 | * read-only to gadget drivers. |
132 | * | 132 | * |
133 | * the bus controller driver lists all the general purpose endpoints in | 133 | * the bus controller driver lists all the general purpose endpoints in |
134 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, | 134 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, |
@@ -148,10 +148,10 @@ struct usb_ep { | |||
148 | /** | 148 | /** |
149 | * usb_ep_enable - configure endpoint, making it usable | 149 | * usb_ep_enable - configure endpoint, making it usable |
150 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". | 150 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". |
151 | * drivers discover endpoints through the ep_list of a usb_gadget. | 151 | * drivers discover endpoints through the ep_list of a usb_gadget. |
152 | * @desc:descriptor for desired behavior. caller guarantees this pointer | 152 | * @desc:descriptor for desired behavior. caller guarantees this pointer |
153 | * remains valid until the endpoint is disabled; the data byte order | 153 | * remains valid until the endpoint is disabled; the data byte order |
154 | * is little-endian (usb-standard). | 154 | * is little-endian (usb-standard). |
155 | * | 155 | * |
156 | * when configurations are set, or when interface settings change, the driver | 156 | * when configurations are set, or when interface settings change, the driver |
157 | * will enable or disable the relevant endpoints. while it is enabled, an | 157 | * will enable or disable the relevant endpoints. while it is enabled, an |
@@ -232,7 +232,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) | |||
232 | * @ep:the endpoint associated with the request | 232 | * @ep:the endpoint associated with the request |
233 | * @req:the request being submitted | 233 | * @req:the request being submitted |
234 | * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't | 234 | * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't |
235 | * pre-allocate all necessary memory with the request. | 235 | * pre-allocate all necessary memory with the request. |
236 | * | 236 | * |
237 | * This tells the device controller to perform the specified request through | 237 | * This tells the device controller to perform the specified request through |
238 | * that endpoint (reading or writing a buffer). When the request completes, | 238 | * that endpoint (reading or writing a buffer). When the request completes, |
@@ -415,7 +415,7 @@ struct usb_gadget_ops { | |||
415 | * struct usb_gadget - represents a usb slave device | 415 | * struct usb_gadget - represents a usb slave device |
416 | * @ops: Function pointers used to access hardware-specific operations. | 416 | * @ops: Function pointers used to access hardware-specific operations. |
417 | * @ep0: Endpoint zero, used when reading or writing responses to | 417 | * @ep0: Endpoint zero, used when reading or writing responses to |
418 | * driver setup() requests | 418 | * driver setup() requests |
419 | * @ep_list: List of other endpoints supported by the device. | 419 | * @ep_list: List of other endpoints supported by the device. |
420 | * @speed: Speed of current connection to USB host. | 420 | * @speed: Speed of current connection to USB host. |
421 | * @is_dualspeed: True if the controller supports both high and full speed | 421 | * @is_dualspeed: True if the controller supports both high and full speed |
@@ -432,7 +432,7 @@ struct usb_gadget_ops { | |||
432 | * @b_hnp_enable: OTG device feature flag, indicating that the A-Host | 432 | * @b_hnp_enable: OTG device feature flag, indicating that the A-Host |
433 | * enabled HNP support. | 433 | * enabled HNP support. |
434 | * @name: Identifies the controller hardware type. Used in diagnostics | 434 | * @name: Identifies the controller hardware type. Used in diagnostics |
435 | * and sometimes configuration. | 435 | * and sometimes configuration. |
436 | * @dev: Driver model state for this abstract device. | 436 | * @dev: Driver model state for this abstract device. |
437 | * | 437 | * |
438 | * Gadgets have a mostly-portable "gadget driver" implementing device | 438 | * Gadgets have a mostly-portable "gadget driver" implementing device |
@@ -480,6 +480,39 @@ static inline void *get_gadget_data (struct usb_gadget *gadget) | |||
480 | 480 | ||
481 | 481 | ||
482 | /** | 482 | /** |
483 | * gadget_is_dualspeed - return true iff the hardware handles high speed | ||
484 | * @gadget: controller that might support both high and full speeds | ||
485 | */ | ||
486 | static inline int gadget_is_dualspeed(struct usb_gadget *g) | ||
487 | { | ||
488 | #ifdef CONFIG_USB_GADGET_DUALSPEED | ||
489 | /* runtime test would check "g->is_dualspeed" ... that might be | ||
490 | * useful to work around hardware bugs, but is mostly pointless | ||
491 | */ | ||
492 | return 1; | ||
493 | #else | ||
494 | return 0; | ||
495 | #endif | ||
496 | } | ||
497 | |||
498 | /** | ||
499 | * gadget_is_otg - return true iff the hardware is OTG-ready | ||
500 | * @gadget: controller that might have a Mini-AB connector | ||
501 | * | ||
502 | * This is a runtime test, since kernels with a USB-OTG stack sometimes | ||
503 | * run on boards which only have a Mini-B (or Mini-A) connector. | ||
504 | */ | ||
505 | static inline int gadget_is_otg(struct usb_gadget *g) | ||
506 | { | ||
507 | #ifdef CONFIG_USB_OTG | ||
508 | return g->is_otg; | ||
509 | #else | ||
510 | return 0; | ||
511 | #endif | ||
512 | } | ||
513 | |||
514 | |||
515 | /** | ||
483 | * usb_gadget_frame_number - returns the current frame number | 516 | * usb_gadget_frame_number - returns the current frame number |
484 | * @gadget: controller that reports the frame number | 517 | * @gadget: controller that reports the frame number |
485 | * | 518 | * |
@@ -655,23 +688,23 @@ usb_gadget_disconnect (struct usb_gadget *gadget) | |||
655 | * @function: String describing the gadget's function | 688 | * @function: String describing the gadget's function |
656 | * @speed: Highest speed the driver handles. | 689 | * @speed: Highest speed the driver handles. |
657 | * @bind: Invoked when the driver is bound to a gadget, usually | 690 | * @bind: Invoked when the driver is bound to a gadget, usually |
658 | * after registering the driver. | 691 | * after registering the driver. |
659 | * At that point, ep0 is fully initialized, and ep_list holds | 692 | * At that point, ep0 is fully initialized, and ep_list holds |
660 | * the currently-available endpoints. | 693 | * the currently-available endpoints. |
661 | * Called in a context that permits sleeping. | 694 | * Called in a context that permits sleeping. |
662 | * @setup: Invoked for ep0 control requests that aren't handled by | 695 | * @setup: Invoked for ep0 control requests that aren't handled by |
663 | * the hardware level driver. Most calls must be handled by | 696 | * the hardware level driver. Most calls must be handled by |
664 | * the gadget driver, including descriptor and configuration | 697 | * the gadget driver, including descriptor and configuration |
665 | * management. The 16 bit members of the setup data are in | 698 | * management. The 16 bit members of the setup data are in |
666 | * USB byte order. Called in_interrupt; this may not sleep. Driver | 699 | * USB byte order. Called in_interrupt; this may not sleep. Driver |
667 | * queues a response to ep0, or returns negative to stall. | 700 | * queues a response to ep0, or returns negative to stall. |
668 | * @disconnect: Invoked after all transfers have been stopped, | 701 | * @disconnect: Invoked after all transfers have been stopped, |
669 | * when the host is disconnected. May be called in_interrupt; this | 702 | * when the host is disconnected. May be called in_interrupt; this |
670 | * may not sleep. Some devices can't detect disconnect, so this might | 703 | * may not sleep. Some devices can't detect disconnect, so this might |
671 | * not be called except as part of controller shutdown. | 704 | * not be called except as part of controller shutdown. |
672 | * @unbind: Invoked when the driver is unbound from a gadget, | 705 | * @unbind: Invoked when the driver is unbound from a gadget, |
673 | * usually from rmmod (after a disconnect is reported). | 706 | * usually from rmmod (after a disconnect is reported). |
674 | * Called in a context that permits sleeping. | 707 | * Called in a context that permits sleeping. |
675 | * @suspend: Invoked on USB suspend. May be called in_interrupt. | 708 | * @suspend: Invoked on USB suspend. May be called in_interrupt. |
676 | * @resume: Invoked on USB resume. May be called in_interrupt. | 709 | * @resume: Invoked on USB resume. May be called in_interrupt. |
677 | * @driver: Driver model state for this driver. | 710 | * @driver: Driver model state for this driver. |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 8da374caf582..2692ec9389ca 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
@@ -4,11 +4,8 @@ | |||
4 | * belong here. | 4 | * belong here. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | /* device must not be autosuspended */ | ||
8 | #define USB_QUIRK_NO_AUTOSUSPEND 0x00000001 | ||
9 | |||
10 | /* string descriptors must not be fetched using a 255-byte read */ | 7 | /* string descriptors must not be fetched using a 255-byte read */ |
11 | #define USB_QUIRK_STRING_FETCH_255 0x00000002 | 8 | #define USB_QUIRK_STRING_FETCH_255 0x00000001 |
12 | 9 | ||
13 | /* device can't resume correctly so reset it instead */ | 10 | /* device can't resume correctly so reset it instead */ |
14 | #define USB_QUIRK_RESET_RESUME 0x00000004 | 11 | #define USB_QUIRK_RESET_RESUME 0x00000002 |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index e8b8928232c8..488ce128885c 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -141,7 +141,7 @@ struct usb_serial { | |||
141 | }; | 141 | }; |
142 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) | 142 | #define to_usb_serial(d) container_of(d, struct usb_serial, kref) |
143 | 143 | ||
144 | #define NUM_DONT_CARE (-1) | 144 | #define NUM_DONT_CARE 99 |
145 | 145 | ||
146 | /* get and set the serial private data pointer helper functions */ | 146 | /* get and set the serial private data pointer helper functions */ |
147 | static inline void *usb_get_serial_data (struct usb_serial *serial) | 147 | static inline void *usb_get_serial_data (struct usb_serial *serial) |
@@ -160,12 +160,18 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data) | |||
160 | * in the syslog messages when a device is inserted or removed. | 160 | * in the syslog messages when a device is inserted or removed. |
161 | * @id_table: pointer to a list of usb_device_id structures that define all | 161 | * @id_table: pointer to a list of usb_device_id structures that define all |
162 | * of the devices this structure can support. | 162 | * of the devices this structure can support. |
163 | * @num_interrupt_in: the number of interrupt in endpoints this device will | 163 | * @num_interrupt_in: If a device doesn't have this many interrupt-in |
164 | * have. | 164 | * endpoints, it won't be sent to the driver's attach() method. |
165 | * @num_interrupt_out: the number of interrupt out endpoints this device will | 165 | * (But it might still be sent to the probe() method.) |
166 | * have. | 166 | * @num_interrupt_out: If a device doesn't have this many interrupt-out |
167 | * @num_bulk_in: the number of bulk in endpoints this device will have. | 167 | * endpoints, it won't be sent to the driver's attach() method. |
168 | * @num_bulk_out: the number of bulk out endpoints this device will have. | 168 | * (But it might still be sent to the probe() method.) |
169 | * @num_bulk_in: If a device doesn't have this many bulk-in | ||
170 | * endpoints, it won't be sent to the driver's attach() method. | ||
171 | * (But it might still be sent to the probe() method.) | ||
172 | * @num_bulk_out: If a device doesn't have this many bulk-out | ||
173 | * endpoints, it won't be sent to the driver's attach() method. | ||
174 | * (But it might still be sent to the probe() method.) | ||
169 | * @num_ports: the number of different ports this device will have. | 175 | * @num_ports: the number of different ports this device will have. |
170 | * @calc_num_ports: pointer to a function to determine how many ports this | 176 | * @calc_num_ports: pointer to a function to determine how many ports this |
171 | * device has dynamically. It will be called after the probe() | 177 | * device has dynamically. It will be called after the probe() |
diff --git a/include/linux/usb_sl811.h b/include/linux/usb_sl811.h deleted file mode 100644 index 4f2d012d7309..000000000000 --- a/include/linux/usb_sl811.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | |||
2 | /* | ||
3 | * board initialization should put one of these into dev->platform_data | ||
4 | * and place the sl811hs onto platform_bus named "sl811-hcd". | ||
5 | */ | ||
6 | |||
7 | struct sl811_platform_data { | ||
8 | unsigned can_wakeup:1; | ||
9 | |||
10 | /* given port_power, msec/2 after power on till power good */ | ||
11 | u8 potpg; | ||
12 | |||
13 | /* mA/2 power supplied on this port (max = default = 250) */ | ||
14 | u8 power; | ||
15 | |||
16 | /* sl811 relies on an external source of VBUS current */ | ||
17 | void (*port_power)(struct device *dev, int is_on); | ||
18 | |||
19 | /* pulse sl811 nRST (probably with a GPIO) */ | ||
20 | void (*reset)(struct device *dev); | ||
21 | |||
22 | // some boards need something like these: | ||
23 | // int (*check_overcurrent)(struct device *dev); | ||
24 | // void (*clock_enable)(struct device *dev, int is_on); | ||
25 | }; | ||
26 | |||