diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 00:26:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 00:26:12 -0400 |
commit | 7a9b149212f3716c598afe973b6261fd58453b7a (patch) | |
tree | 477716d84c71da124448b72278e98da28aadbd3d /include | |
parent | 3d62e3fdce8ef265a3706c52ae1ca6ab84e30f0e (diff) | |
parent | e26bcf37234c67624f62d9fc95f922b8dbda1363 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (229 commits)
USB: remove unused usb_buffer_alloc and usb_buffer_free macros
usb: musb: update gfp/slab.h includes
USB: ftdi_sio: fix legacy SIO-device header
USB: kl5usb105: reimplement using generic framework
USB: kl5usb105: minor clean ups
USB: kl5usb105: fix memory leak
USB: io_ti: use kfifo to implement write buffering
USB: io_ti: remove unsused private counter
USB: ti_usb: use kfifo to implement write buffering
USB: ir-usb: fix incorrect write-buffer length
USB: aircable: fix incorrect write-buffer length
USB: safe_serial: straighten out read processing
USB: safe_serial: reimplement read using generic framework
USB: safe_serial: reimplement write using generic framework
usb-storage: always print quirks
USB: usb-storage: trivial debug improvements
USB: oti6858: use port write fifo
USB: oti6858: use kfifo to implement write buffering
USB: cypress_m8: use kfifo to implement write buffering
USB: cypress_m8: remove unused drain define
...
Fix up conflicts (due to usb_buffer_alloc/free renaming) in
drivers/input/tablet/acecad.c
drivers/input/tablet/kbtab.c
drivers/input/tablet/wacom_sys.c
drivers/media/video/gspca/gspca.c
sound/usb/usbaudio.c
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb.h | 137 | ||||
-rw-r--r-- | include/linux/usb/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/usb/atmel_usba_udc.h | 2 | ||||
-rw-r--r-- | include/linux/usb/audio.h | 6 | ||||
-rw-r--r-- | include/linux/usb/cdc.h | 94 | ||||
-rw-r--r-- | include/linux/usb/ch11.h | 167 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 16 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 1 | ||||
-rw-r--r-- | include/linux/usb/ehci_def.h | 6 | ||||
-rw-r--r-- | include/linux/usb/functionfs.h | 199 | ||||
-rw-r--r-- | include/linux/usb/g_hid.h | 32 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 6 | ||||
-rw-r--r-- | include/linux/usb/gadgetfs.h | 2 | ||||
-rw-r--r-- | include/linux/usb/hcd.h | 625 | ||||
-rw-r--r-- | include/linux/usb/langwell_udc.h | 2 | ||||
-rw-r--r-- | include/linux/usb/musb.h | 40 | ||||
-rw-r--r-- | include/linux/usb/ncm.h | 114 | ||||
-rw-r--r-- | include/linux/usb/net2280.h | 6 | ||||
-rw-r--r-- | include/linux/usb/quirks.h | 4 | ||||
-rw-r--r-- | include/linux/usb/rndis_host.h | 66 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 36 | ||||
-rw-r--r-- | include/linux/usb/ulpi.h | 140 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 40 | ||||
-rw-r--r-- | include/linux/usb/wusb-wa.h | 2 | ||||
-rw-r--r-- | include/linux/wait.h | 149 |
25 files changed, 1741 insertions, 152 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index 739f1fd1cc15..d5922a877994 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -45,27 +45,14 @@ struct wusb_dev; | |||
45 | 45 | ||
46 | struct ep_device; | 46 | struct ep_device; |
47 | 47 | ||
48 | /* For SS devices */ | ||
49 | /** | ||
50 | * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only | ||
51 | * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder | ||
52 | * @extra: descriptors following this endpoint companion descriptor | ||
53 | * @extralen: how many bytes of "extra" are valid | ||
54 | */ | ||
55 | struct usb_host_ss_ep_comp { | ||
56 | struct usb_ss_ep_comp_descriptor desc; | ||
57 | unsigned char *extra; /* Extra descriptors */ | ||
58 | int extralen; | ||
59 | }; | ||
60 | |||
61 | /** | 48 | /** |
62 | * struct usb_host_endpoint - host-side endpoint descriptor and queue | 49 | * struct usb_host_endpoint - host-side endpoint descriptor and queue |
63 | * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder | 50 | * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder |
51 | * @ss_ep_comp: SuperSpeed companion descriptor for this endpoint | ||
64 | * @urb_list: urbs queued to this endpoint; maintained by usbcore | 52 | * @urb_list: urbs queued to this endpoint; maintained by usbcore |
65 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) | 53 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) |
66 | * with one or more transfer descriptors (TDs) per urb | 54 | * with one or more transfer descriptors (TDs) per urb |
67 | * @ep_dev: ep_device for sysfs info | 55 | * @ep_dev: ep_device for sysfs info |
68 | * @ss_ep_comp: companion descriptor information for this endpoint | ||
69 | * @extra: descriptors following this endpoint in the configuration | 56 | * @extra: descriptors following this endpoint in the configuration |
70 | * @extralen: how many bytes of "extra" are valid | 57 | * @extralen: how many bytes of "extra" are valid |
71 | * @enabled: URBs may be submitted to this endpoint | 58 | * @enabled: URBs may be submitted to this endpoint |
@@ -74,11 +61,11 @@ struct usb_host_ss_ep_comp { | |||
74 | * descriptor within an active interface in a given USB configuration. | 61 | * descriptor within an active interface in a given USB configuration. |
75 | */ | 62 | */ |
76 | struct usb_host_endpoint { | 63 | struct usb_host_endpoint { |
77 | struct usb_endpoint_descriptor desc; | 64 | struct usb_endpoint_descriptor desc; |
65 | struct usb_ss_ep_comp_descriptor ss_ep_comp; | ||
78 | struct list_head urb_list; | 66 | struct list_head urb_list; |
79 | void *hcpriv; | 67 | void *hcpriv; |
80 | struct ep_device *ep_dev; /* For sysfs info */ | 68 | struct ep_device *ep_dev; /* For sysfs info */ |
81 | struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */ | ||
82 | 69 | ||
83 | unsigned char *extra; /* Extra descriptors */ | 70 | unsigned char *extra; /* Extra descriptors */ |
84 | int extralen; | 71 | int extralen; |
@@ -109,8 +96,8 @@ enum usb_interface_condition { | |||
109 | /** | 96 | /** |
110 | * struct usb_interface - what usb device drivers talk to | 97 | * struct usb_interface - what usb device drivers talk to |
111 | * @altsetting: array of interface structures, one for each alternate | 98 | * @altsetting: array of interface structures, one for each alternate |
112 | * setting that may be selected. Each one includes a set of | 99 | * setting that may be selected. Each one includes a set of |
113 | * endpoint configurations. They will be in no particular order. | 100 | * endpoint configurations. They will be in no particular order. |
114 | * @cur_altsetting: the current altsetting. | 101 | * @cur_altsetting: the current altsetting. |
115 | * @num_altsetting: number of altsettings defined. | 102 | * @num_altsetting: number of altsettings defined. |
116 | * @intf_assoc: interface association descriptor | 103 | * @intf_assoc: interface association descriptor |
@@ -197,8 +184,6 @@ struct usb_interface { | |||
197 | struct work_struct reset_ws; /* for resets in atomic context */ | 184 | struct work_struct reset_ws; /* for resets in atomic context */ |
198 | }; | 185 | }; |
199 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) | 186 | #define to_usb_interface(d) container_of(d, struct usb_interface, dev) |
200 | #define interface_to_usbdev(intf) \ | ||
201 | container_of(intf->dev.parent, struct usb_device, dev) | ||
202 | 187 | ||
203 | static inline void *usb_get_intfdata(struct usb_interface *intf) | 188 | static inline void *usb_get_intfdata(struct usb_interface *intf) |
204 | { | 189 | { |
@@ -215,7 +200,7 @@ void usb_put_intf(struct usb_interface *intf); | |||
215 | 200 | ||
216 | /* this maximum is arbitrary */ | 201 | /* this maximum is arbitrary */ |
217 | #define USB_MAXINTERFACES 32 | 202 | #define USB_MAXINTERFACES 32 |
218 | #define USB_MAXIADS USB_MAXINTERFACES/2 | 203 | #define USB_MAXIADS (USB_MAXINTERFACES/2) |
219 | 204 | ||
220 | /** | 205 | /** |
221 | * struct usb_interface_cache - long-term representation of a device interface | 206 | * struct usb_interface_cache - long-term representation of a device interface |
@@ -425,7 +410,6 @@ struct usb_tt; | |||
425 | * @connect_time: time device was first connected | 410 | * @connect_time: time device was first connected |
426 | * @do_remote_wakeup: remote wakeup should be enabled | 411 | * @do_remote_wakeup: remote wakeup should be enabled |
427 | * @reset_resume: needs reset instead of resume | 412 | * @reset_resume: needs reset instead of resume |
428 | * @autosuspend_disabled: autosuspend disabled by the user | ||
429 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 413 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
430 | * specific data for the device. | 414 | * specific data for the device. |
431 | * @slot_id: Slot ID assigned by xHCI | 415 | * @slot_id: Slot ID assigned by xHCI |
@@ -436,7 +420,7 @@ struct usb_tt; | |||
436 | */ | 420 | */ |
437 | struct usb_device { | 421 | struct usb_device { |
438 | int devnum; | 422 | int devnum; |
439 | char devpath [16]; | 423 | char devpath[16]; |
440 | u32 route; | 424 | u32 route; |
441 | enum usb_device_state state; | 425 | enum usb_device_state state; |
442 | enum usb_device_speed speed; | 426 | enum usb_device_speed speed; |
@@ -469,7 +453,7 @@ struct usb_device { | |||
469 | unsigned persist_enabled:1; | 453 | unsigned persist_enabled:1; |
470 | unsigned have_langid:1; | 454 | unsigned have_langid:1; |
471 | unsigned authorized:1; | 455 | unsigned authorized:1; |
472 | unsigned authenticated:1; | 456 | unsigned authenticated:1; |
473 | unsigned wusb:1; | 457 | unsigned wusb:1; |
474 | int string_langid; | 458 | int string_langid; |
475 | 459 | ||
@@ -501,13 +485,17 @@ struct usb_device { | |||
501 | 485 | ||
502 | unsigned do_remote_wakeup:1; | 486 | unsigned do_remote_wakeup:1; |
503 | unsigned reset_resume:1; | 487 | unsigned reset_resume:1; |
504 | unsigned autosuspend_disabled:1; | ||
505 | #endif | 488 | #endif |
506 | struct wusb_dev *wusb_dev; | 489 | struct wusb_dev *wusb_dev; |
507 | int slot_id; | 490 | int slot_id; |
508 | }; | 491 | }; |
509 | #define to_usb_device(d) container_of(d, struct usb_device, dev) | 492 | #define to_usb_device(d) container_of(d, struct usb_device, dev) |
510 | 493 | ||
494 | static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf) | ||
495 | { | ||
496 | return to_usb_device(intf->dev.parent); | ||
497 | } | ||
498 | |||
511 | extern struct usb_device *usb_get_dev(struct usb_device *dev); | 499 | extern struct usb_device *usb_get_dev(struct usb_device *dev); |
512 | extern void usb_put_dev(struct usb_device *dev); | 500 | extern void usb_put_dev(struct usb_device *dev); |
513 | 501 | ||
@@ -522,12 +510,11 @@ extern int usb_lock_device_for_reset(struct usb_device *udev, | |||
522 | extern int usb_reset_device(struct usb_device *dev); | 510 | extern int usb_reset_device(struct usb_device *dev); |
523 | extern void usb_queue_reset_device(struct usb_interface *dev); | 511 | extern void usb_queue_reset_device(struct usb_interface *dev); |
524 | 512 | ||
525 | extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | ||
526 | 513 | ||
527 | /* USB autosuspend and autoresume */ | 514 | /* USB autosuspend and autoresume */ |
528 | #ifdef CONFIG_USB_SUSPEND | 515 | #ifdef CONFIG_USB_SUSPEND |
529 | extern int usb_enable_autosuspend(struct usb_device *udev); | 516 | extern void usb_enable_autosuspend(struct usb_device *udev); |
530 | extern int usb_disable_autosuspend(struct usb_device *udev); | 517 | extern void usb_disable_autosuspend(struct usb_device *udev); |
531 | 518 | ||
532 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 519 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
533 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 520 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
@@ -572,6 +559,16 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
572 | /* for drivers using iso endpoints */ | 559 | /* for drivers using iso endpoints */ |
573 | extern int usb_get_current_frame_number(struct usb_device *usb_dev); | 560 | extern int usb_get_current_frame_number(struct usb_device *usb_dev); |
574 | 561 | ||
562 | /* Sets up a group of bulk endpoints to support multiple stream IDs. */ | ||
563 | extern int usb_alloc_streams(struct usb_interface *interface, | ||
564 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
565 | unsigned int num_streams, gfp_t mem_flags); | ||
566 | |||
567 | /* Reverts a group of bulk endpoints back to not using stream IDs. */ | ||
568 | extern void usb_free_streams(struct usb_interface *interface, | ||
569 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
570 | gfp_t mem_flags); | ||
571 | |||
575 | /* used these for multi-interface device registration */ | 572 | /* used these for multi-interface device registration */ |
576 | extern int usb_driver_claim_interface(struct usb_driver *driver, | 573 | extern int usb_driver_claim_interface(struct usb_driver *driver, |
577 | struct usb_interface *iface, void *priv); | 574 | struct usb_interface *iface, void *priv); |
@@ -667,7 +664,7 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size) | |||
667 | * This macro is used to create a struct usb_device_id that matches a | 664 | * This macro is used to create a struct usb_device_id that matches a |
668 | * specific device. | 665 | * specific device. |
669 | */ | 666 | */ |
670 | #define USB_DEVICE(vend,prod) \ | 667 | #define USB_DEVICE(vend, prod) \ |
671 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ | 668 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \ |
672 | .idVendor = (vend), \ | 669 | .idVendor = (vend), \ |
673 | .idProduct = (prod) | 670 | .idProduct = (prod) |
@@ -958,17 +955,25 @@ extern int usb_disabled(void); | |||
958 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame | 955 | #define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame |
959 | * ignored */ | 956 | * ignored */ |
960 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ | 957 | #define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ |
961 | #define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ | ||
962 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ | 958 | #define URB_NO_FSBR 0x0020 /* UHCI-specific */ |
963 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ | 959 | #define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */ |
964 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt | 960 | #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt |
965 | * needed */ | 961 | * needed */ |
966 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ | 962 | #define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ |
967 | 963 | ||
964 | /* The following flags are used internally by usbcore and HCDs */ | ||
968 | #define URB_DIR_IN 0x0200 /* Transfer from device to host */ | 965 | #define URB_DIR_IN 0x0200 /* Transfer from device to host */ |
969 | #define URB_DIR_OUT 0 | 966 | #define URB_DIR_OUT 0 |
970 | #define URB_DIR_MASK URB_DIR_IN | 967 | #define URB_DIR_MASK URB_DIR_IN |
971 | 968 | ||
969 | #define URB_DMA_MAP_SINGLE 0x00010000 /* Non-scatter-gather mapping */ | ||
970 | #define URB_DMA_MAP_PAGE 0x00020000 /* HCD-unsupported S-G */ | ||
971 | #define URB_DMA_MAP_SG 0x00040000 /* HCD-supported S-G */ | ||
972 | #define URB_MAP_LOCAL 0x00080000 /* HCD-local-memory mapping */ | ||
973 | #define URB_SETUP_MAP_SINGLE 0x00100000 /* Setup packet DMA mapped */ | ||
974 | #define URB_SETUP_MAP_LOCAL 0x00200000 /* HCD-local setup packet */ | ||
975 | #define URB_DMA_SG_COMBINED 0x00400000 /* S-G entries were combined */ | ||
976 | |||
972 | struct usb_iso_packet_descriptor { | 977 | struct usb_iso_packet_descriptor { |
973 | unsigned int offset; | 978 | unsigned int offset; |
974 | unsigned int length; /* expected length */ | 979 | unsigned int length; /* expected length */ |
@@ -1045,12 +1050,8 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1045 | * @setup_packet: Only used for control transfers, this points to eight bytes | 1050 | * @setup_packet: Only used for control transfers, this points to eight bytes |
1046 | * of setup data. Control transfers always start by sending this data | 1051 | * of setup data. Control transfers always start by sending this data |
1047 | * to the device. Then transfer_buffer is read or written, if needed. | 1052 | * to the device. Then transfer_buffer is read or written, if needed. |
1048 | * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the | 1053 | * @setup_dma: DMA pointer for the setup packet. The caller must not use |
1049 | * device driver has provided this DMA address for the setup packet. | 1054 | * this field; setup_packet must point to a valid buffer. |
1050 | * The host controller driver should use this in preference to | ||
1051 | * setup_packet, but the HCD may chose to ignore the address if it must | ||
1052 | * copy the setup packet into internal structures. Therefore, setup_packet | ||
1053 | * must always point to a valid buffer. | ||
1054 | * @start_frame: Returns the initial frame for isochronous transfers. | 1055 | * @start_frame: Returns the initial frame for isochronous transfers. |
1055 | * @number_of_packets: Lists the number of ISO transfer buffers. | 1056 | * @number_of_packets: Lists the number of ISO transfer buffers. |
1056 | * @interval: Specifies the polling interval for interrupt or isochronous | 1057 | * @interval: Specifies the polling interval for interrupt or isochronous |
@@ -1082,13 +1083,14 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1082 | * bounce buffer or talking to an IOMMU), | 1083 | * bounce buffer or talking to an IOMMU), |
1083 | * although they're cheap on commodity x86 and ppc hardware. | 1084 | * although they're cheap on commodity x86 and ppc hardware. |
1084 | * | 1085 | * |
1085 | * Alternatively, drivers may pass the URB_NO_xxx_DMA_MAP transfer flags, | 1086 | * Alternatively, drivers may pass the URB_NO_TRANSFER_DMA_MAP transfer flag, |
1086 | * which tell the host controller driver that no such mapping is needed since | 1087 | * which tells the host controller driver that no such mapping is needed for |
1088 | * the transfer_buffer since | ||
1087 | * the device driver is DMA-aware. For example, a device driver might | 1089 | * the device driver is DMA-aware. For example, a device driver might |
1088 | * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map(). | 1090 | * allocate a DMA buffer with usb_alloc_coherent() or call usb_buffer_map(). |
1089 | * When these transfer flags are provided, host controller drivers will | 1091 | * When this transfer flag is provided, host controller drivers will |
1090 | * attempt to use the dma addresses found in the transfer_dma and/or | 1092 | * attempt to use the dma address found in the transfer_dma |
1091 | * setup_dma fields rather than determining a dma address themselves. | 1093 | * field rather than determining a dma address themselves. |
1092 | * | 1094 | * |
1093 | * Note that transfer_buffer must still be set if the controller | 1095 | * Note that transfer_buffer must still be set if the controller |
1094 | * does not support DMA (as indicated by bus.uses_dma) and when talking | 1096 | * does not support DMA (as indicated by bus.uses_dma) and when talking |
@@ -1111,11 +1113,9 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1111 | * should always terminate with a short packet, even if it means adding an | 1113 | * should always terminate with a short packet, even if it means adding an |
1112 | * extra zero length packet. | 1114 | * extra zero length packet. |
1113 | * | 1115 | * |
1114 | * Control URBs must provide a setup_packet. The setup_packet and | 1116 | * Control URBs must provide a valid pointer in the setup_packet field. |
1115 | * transfer_buffer may each be mapped for DMA or not, independently of | 1117 | * Unlike the transfer_buffer, the setup_packet may not be mapped for DMA |
1116 | * the other. The transfer_flags bits URB_NO_TRANSFER_DMA_MAP and | 1118 | * beforehand. |
1117 | * URB_NO_SETUP_DMA_MAP indicate which buffers have already been mapped. | ||
1118 | * URB_NO_SETUP_DMA_MAP is ignored for non-control URBs. | ||
1119 | * | 1119 | * |
1120 | * Interrupt URBs must provide an interval, saying how often (in milliseconds | 1120 | * Interrupt URBs must provide an interval, saying how often (in milliseconds |
1121 | * or, for highspeed devices, 125 microsecond units) | 1121 | * or, for highspeed devices, 125 microsecond units) |
@@ -1186,14 +1186,15 @@ struct urb { | |||
1186 | * current owner */ | 1186 | * current owner */ |
1187 | struct list_head anchor_list; /* the URB may be anchored */ | 1187 | struct list_head anchor_list; /* the URB may be anchored */ |
1188 | struct usb_anchor *anchor; | 1188 | struct usb_anchor *anchor; |
1189 | struct usb_device *dev; /* (in) pointer to associated device */ | 1189 | struct usb_device *dev; /* (in) pointer to associated device */ |
1190 | struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ | 1190 | struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */ |
1191 | unsigned int pipe; /* (in) pipe information */ | 1191 | unsigned int pipe; /* (in) pipe information */ |
1192 | unsigned int stream_id; /* (in) stream ID */ | ||
1192 | int status; /* (return) non-ISO status */ | 1193 | int status; /* (return) non-ISO status */ |
1193 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ | 1194 | unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ |
1194 | void *transfer_buffer; /* (in) associated data buffer */ | 1195 | void *transfer_buffer; /* (in) associated data buffer */ |
1195 | dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ | 1196 | dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ |
1196 | struct usb_sg_request *sg; /* (in) scatter gather buffer list */ | 1197 | struct scatterlist *sg; /* (in) scatter gather buffer list */ |
1197 | int num_sgs; /* (in) number of entries in the sg list */ | 1198 | int num_sgs; /* (in) number of entries in the sg list */ |
1198 | u32 transfer_buffer_length; /* (in) data buffer length */ | 1199 | u32 transfer_buffer_length; /* (in) data buffer length */ |
1199 | u32 actual_length; /* (return) actual transfer length */ | 1200 | u32 actual_length; /* (return) actual transfer length */ |
@@ -1371,18 +1372,6 @@ void *usb_alloc_coherent(struct usb_device *dev, size_t size, | |||
1371 | void usb_free_coherent(struct usb_device *dev, size_t size, | 1372 | void usb_free_coherent(struct usb_device *dev, size_t size, |
1372 | void *addr, dma_addr_t dma); | 1373 | void *addr, dma_addr_t dma); |
1373 | 1374 | ||
1374 | /* Compatible macros while we switch over */ | ||
1375 | static inline void *usb_buffer_alloc(struct usb_device *dev, size_t size, | ||
1376 | gfp_t mem_flags, dma_addr_t *dma) | ||
1377 | { | ||
1378 | return usb_alloc_coherent(dev, size, mem_flags, dma); | ||
1379 | } | ||
1380 | static inline void usb_buffer_free(struct usb_device *dev, size_t size, | ||
1381 | void *addr, dma_addr_t dma) | ||
1382 | { | ||
1383 | return usb_free_coherent(dev, size, addr, dma); | ||
1384 | } | ||
1385 | |||
1386 | #if 0 | 1375 | #if 0 |
1387 | struct urb *usb_buffer_map(struct urb *urb); | 1376 | struct urb *usb_buffer_map(struct urb *urb); |
1388 | void usb_buffer_dmasync(struct urb *urb); | 1377 | void usb_buffer_dmasync(struct urb *urb); |
@@ -1467,8 +1456,6 @@ struct usb_sg_request { | |||
1467 | 1456 | ||
1468 | struct usb_device *dev; | 1457 | struct usb_device *dev; |
1469 | int pipe; | 1458 | int pipe; |
1470 | struct scatterlist *sg; | ||
1471 | int nents; | ||
1472 | 1459 | ||
1473 | int entries; | 1460 | int entries; |
1474 | struct urb **urbs; | 1461 | struct urb **urbs; |
@@ -1536,23 +1523,31 @@ static inline unsigned int __create_pipe(struct usb_device *dev, | |||
1536 | } | 1523 | } |
1537 | 1524 | ||
1538 | /* Create various pipes... */ | 1525 | /* Create various pipes... */ |
1539 | #define usb_sndctrlpipe(dev,endpoint) \ | 1526 | #define usb_sndctrlpipe(dev, endpoint) \ |
1540 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) | 1527 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint)) |
1541 | #define usb_rcvctrlpipe(dev,endpoint) \ | 1528 | #define usb_rcvctrlpipe(dev, endpoint) \ |
1542 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) | 1529 | ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1543 | #define usb_sndisocpipe(dev,endpoint) \ | 1530 | #define usb_sndisocpipe(dev, endpoint) \ |
1544 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) | 1531 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint)) |
1545 | #define usb_rcvisocpipe(dev,endpoint) \ | 1532 | #define usb_rcvisocpipe(dev, endpoint) \ |
1546 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) | 1533 | ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1547 | #define usb_sndbulkpipe(dev,endpoint) \ | 1534 | #define usb_sndbulkpipe(dev, endpoint) \ |
1548 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) | 1535 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint)) |
1549 | #define usb_rcvbulkpipe(dev,endpoint) \ | 1536 | #define usb_rcvbulkpipe(dev, endpoint) \ |
1550 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) | 1537 | ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1551 | #define usb_sndintpipe(dev,endpoint) \ | 1538 | #define usb_sndintpipe(dev, endpoint) \ |
1552 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) | 1539 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint)) |
1553 | #define usb_rcvintpipe(dev,endpoint) \ | 1540 | #define usb_rcvintpipe(dev, endpoint) \ |
1554 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) | 1541 | ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN) |
1555 | 1542 | ||
1543 | static inline struct usb_host_endpoint * | ||
1544 | usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) | ||
1545 | { | ||
1546 | struct usb_host_endpoint **eps; | ||
1547 | eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; | ||
1548 | return eps[usb_pipeendpoint(pipe)]; | ||
1549 | } | ||
1550 | |||
1556 | /*-------------------------------------------------------------------------*/ | 1551 | /*-------------------------------------------------------------------------*/ |
1557 | 1552 | ||
1558 | static inline __u16 | 1553 | static inline __u16 |
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 29fd73b0bffc..51410e0200cf 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
@@ -1,6 +1,7 @@ | |||
1 | header-y += audio.h | 1 | header-y += audio.h |
2 | header-y += cdc.h | 2 | header-y += cdc.h |
3 | header-y += ch9.h | 3 | header-y += ch9.h |
4 | header-y += ch11.h | ||
4 | header-y += gadgetfs.h | 5 | header-y += gadgetfs.h |
5 | header-y += midi.h | 6 | header-y += midi.h |
6 | header-y += g_printer.h | 7 | header-y += g_printer.h |
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h index baf41c8616e9..ba99af275a31 100644 --- a/include/linux/usb/atmel_usba_udc.h +++ b/include/linux/usb/atmel_usba_udc.h | |||
@@ -15,7 +15,7 @@ struct usba_ep_data { | |||
15 | 15 | ||
16 | struct usba_platform_data { | 16 | struct usba_platform_data { |
17 | int vbus_pin; | 17 | int vbus_pin; |
18 | int vbus_pin_inverted; | 18 | int vbus_pin_inverted; |
19 | int num_ep; | 19 | int num_ep; |
20 | struct usba_ep_data ep[0]; | 20 | struct usba_ep_data ep[0]; |
21 | }; | 21 | }; |
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index c0ef18dc2da7..5d646c388752 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -101,7 +101,7 @@ struct uac_ac_header_descriptor_v1 { | |||
101 | #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) | 101 | #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) |
102 | 102 | ||
103 | /* As above, but more useful for defining your own descriptors: */ | 103 | /* As above, but more useful for defining your own descriptors: */ |
104 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ | 104 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ |
105 | struct uac_ac_header_descriptor_v1_##n { \ | 105 | struct uac_ac_header_descriptor_v1_##n { \ |
106 | __u8 bLength; \ | 106 | __u8 bLength; \ |
107 | __u8 bDescriptorType; \ | 107 | __u8 bDescriptorType; \ |
@@ -169,7 +169,7 @@ struct uac_output_terminal_descriptor_v1 { | |||
169 | #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) | 169 | #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) |
170 | 170 | ||
171 | /* As above, but more useful for defining your own descriptors: */ | 171 | /* As above, but more useful for defining your own descriptors: */ |
172 | #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ | 172 | #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ |
173 | struct uac_feature_unit_descriptor_##ch { \ | 173 | struct uac_feature_unit_descriptor_##ch { \ |
174 | __u8 bLength; \ | 174 | __u8 bLength; \ |
175 | __u8 bDescriptorType; \ | 175 | __u8 bDescriptorType; \ |
@@ -378,7 +378,7 @@ struct uac_format_type_i_discrete_descriptor { | |||
378 | __u8 tSamFreq[][3]; | 378 | __u8 tSamFreq[][3]; |
379 | } __attribute__ ((packed)); | 379 | } __attribute__ ((packed)); |
380 | 380 | ||
381 | #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ | 381 | #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ |
382 | struct uac_format_type_i_discrete_descriptor_##n { \ | 382 | struct uac_format_type_i_discrete_descriptor_##n { \ |
383 | __u8 bLength; \ | 383 | __u8 bLength; \ |
384 | __u8 bDescriptorType; \ | 384 | __u8 bDescriptorType; \ |
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index c24124a42ce5..c117a68d04a7 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #define USB_CDC_SUBCLASS_MDLM 0x0a | 18 | #define USB_CDC_SUBCLASS_MDLM 0x0a |
19 | #define USB_CDC_SUBCLASS_OBEX 0x0b | 19 | #define USB_CDC_SUBCLASS_OBEX 0x0b |
20 | #define USB_CDC_SUBCLASS_EEM 0x0c | 20 | #define USB_CDC_SUBCLASS_EEM 0x0c |
21 | #define USB_CDC_SUBCLASS_NCM 0x0d | ||
21 | 22 | ||
22 | #define USB_CDC_PROTO_NONE 0 | 23 | #define USB_CDC_PROTO_NONE 0 |
23 | 24 | ||
@@ -49,6 +50,7 @@ | |||
49 | #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ | 50 | #define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ |
50 | #define USB_CDC_DMM_TYPE 0x14 | 51 | #define USB_CDC_DMM_TYPE 0x14 |
51 | #define USB_CDC_OBEX_TYPE 0x15 | 52 | #define USB_CDC_OBEX_TYPE 0x15 |
53 | #define USB_CDC_NCM_TYPE 0x1a | ||
52 | 54 | ||
53 | /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ | 55 | /* "Header Functional Descriptor" from CDC spec 5.2.3.1 */ |
54 | struct usb_cdc_header_desc { | 56 | struct usb_cdc_header_desc { |
@@ -174,6 +176,15 @@ struct usb_cdc_obex_desc { | |||
174 | __le16 bcdVersion; | 176 | __le16 bcdVersion; |
175 | } __attribute__ ((packed)); | 177 | } __attribute__ ((packed)); |
176 | 178 | ||
179 | /* "NCM Control Model Functional Descriptor" */ | ||
180 | struct usb_cdc_ncm_desc { | ||
181 | __u8 bLength; | ||
182 | __u8 bDescriptorType; | ||
183 | __u8 bDescriptorSubType; | ||
184 | |||
185 | __le16 bcdNcmVersion; | ||
186 | __u8 bmNetworkCapabilities; | ||
187 | } __attribute__ ((packed)); | ||
177 | /*-------------------------------------------------------------------------*/ | 188 | /*-------------------------------------------------------------------------*/ |
178 | 189 | ||
179 | /* | 190 | /* |
@@ -197,6 +208,17 @@ struct usb_cdc_obex_desc { | |||
197 | #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 | 208 | #define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 |
198 | #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 | 209 | #define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 |
199 | #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 | 210 | #define USB_CDC_GET_ETHERNET_STATISTIC 0x44 |
211 | #define USB_CDC_GET_NTB_PARAMETERS 0x80 | ||
212 | #define USB_CDC_GET_NET_ADDRESS 0x81 | ||
213 | #define USB_CDC_SET_NET_ADDRESS 0x82 | ||
214 | #define USB_CDC_GET_NTB_FORMAT 0x83 | ||
215 | #define USB_CDC_SET_NTB_FORMAT 0x84 | ||
216 | #define USB_CDC_GET_NTB_INPUT_SIZE 0x85 | ||
217 | #define USB_CDC_SET_NTB_INPUT_SIZE 0x86 | ||
218 | #define USB_CDC_GET_MAX_DATAGRAM_SIZE 0x87 | ||
219 | #define USB_CDC_SET_MAX_DATAGRAM_SIZE 0x88 | ||
220 | #define USB_CDC_GET_CRC_MODE 0x89 | ||
221 | #define USB_CDC_SET_CRC_MODE 0x8a | ||
200 | 222 | ||
201 | /* Line Coding Structure from CDC spec 6.2.13 */ | 223 | /* Line Coding Structure from CDC spec 6.2.13 */ |
202 | struct usb_cdc_line_coding { | 224 | struct usb_cdc_line_coding { |
@@ -247,4 +269,76 @@ struct usb_cdc_notification { | |||
247 | __le16 wLength; | 269 | __le16 wLength; |
248 | } __attribute__ ((packed)); | 270 | } __attribute__ ((packed)); |
249 | 271 | ||
272 | /*-------------------------------------------------------------------------*/ | ||
273 | |||
274 | /* | ||
275 | * Class Specific structures and constants | ||
276 | * | ||
277 | * CDC NCM parameter structure, CDC NCM subclass 6.2.1 | ||
278 | * | ||
279 | */ | ||
280 | |||
281 | struct usb_cdc_ncm_ntb_parameter { | ||
282 | __le16 wLength; | ||
283 | __le16 bmNtbFormatSupported; | ||
284 | __le32 dwNtbInMaxSize; | ||
285 | __le16 wNdpInDivisor; | ||
286 | __le16 wNdpInPayloadRemainder; | ||
287 | __le16 wNdpInAlignment; | ||
288 | __le16 wPadding1; | ||
289 | __le32 dwNtbOutMaxSize; | ||
290 | __le16 wNdpOutDivisor; | ||
291 | __le16 wNdpOutPayloadRemainder; | ||
292 | __le16 wNdpOutAlignment; | ||
293 | __le16 wPadding2; | ||
294 | } __attribute__ ((packed)); | ||
295 | |||
296 | /* | ||
297 | * CDC NCM transfer headers, CDC NCM subclass 3.2 | ||
298 | */ | ||
299 | |||
300 | #define NCM_NTH16_SIGN 0x484D434E /* NCMH */ | ||
301 | #define NCM_NTH32_SIGN 0x686D636E /* ncmh */ | ||
302 | |||
303 | struct usb_cdc_ncm_nth16 { | ||
304 | __le32 dwSignature; | ||
305 | __le16 wHeaderLength; | ||
306 | __le16 wSequence; | ||
307 | __le16 wBlockLength; | ||
308 | __le16 wFpIndex; | ||
309 | } __attribute__ ((packed)); | ||
310 | |||
311 | struct usb_cdc_ncm_nth32 { | ||
312 | __le32 dwSignature; | ||
313 | __le16 wHeaderLength; | ||
314 | __le16 wSequence; | ||
315 | __le32 dwBlockLength; | ||
316 | __le32 dwFpIndex; | ||
317 | } __attribute__ ((packed)); | ||
318 | |||
319 | /* | ||
320 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 | ||
321 | */ | ||
322 | |||
323 | #define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ | ||
324 | #define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ | ||
325 | #define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ | ||
326 | #define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ | ||
327 | |||
328 | struct usb_cdc_ncm_ndp16 { | ||
329 | __le32 dwSignature; | ||
330 | __le16 wLength; | ||
331 | __le16 wNextFpIndex; | ||
332 | __u8 data[0]; | ||
333 | } __attribute__ ((packed)); | ||
334 | |||
335 | struct usb_cdc_ncm_ndp32 { | ||
336 | __le32 dwSignature; | ||
337 | __le16 wLength; | ||
338 | __le16 wReserved6; | ||
339 | __le32 dwNextFpIndex; | ||
340 | __le32 dwReserved12; | ||
341 | __u8 data[0]; | ||
342 | } __attribute__ ((packed)); | ||
343 | |||
250 | #endif /* __LINUX_USB_CDC_H */ | 344 | #endif /* __LINUX_USB_CDC_H */ |
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h new file mode 100644 index 000000000000..119194c85d10 --- /dev/null +++ b/include/linux/usb/ch11.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * This file holds Hub protocol constants and data structures that are | ||
3 | * defined in chapter 11 (Hub Specification) of the USB 2.0 specification. | ||
4 | * | ||
5 | * It is used/shared between the USB core, the HCDs and couple of other USB | ||
6 | * drivers. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LINUX_CH11_H | ||
10 | #define __LINUX_CH11_H | ||
11 | |||
12 | #include <linux/types.h> /* __u8 etc */ | ||
13 | |||
14 | /* | ||
15 | * Hub request types | ||
16 | */ | ||
17 | |||
18 | #define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE) | ||
19 | #define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER) | ||
20 | |||
21 | /* | ||
22 | * Hub class requests | ||
23 | * See USB 2.0 spec Table 11-16 | ||
24 | */ | ||
25 | #define HUB_CLEAR_TT_BUFFER 8 | ||
26 | #define HUB_RESET_TT 9 | ||
27 | #define HUB_GET_TT_STATE 10 | ||
28 | #define HUB_STOP_TT 11 | ||
29 | |||
30 | /* | ||
31 | * Hub Class feature numbers | ||
32 | * See USB 2.0 spec Table 11-17 | ||
33 | */ | ||
34 | #define C_HUB_LOCAL_POWER 0 | ||
35 | #define C_HUB_OVER_CURRENT 1 | ||
36 | |||
37 | /* | ||
38 | * Port feature numbers | ||
39 | * See USB 2.0 spec Table 11-17 | ||
40 | */ | ||
41 | #define USB_PORT_FEAT_CONNECTION 0 | ||
42 | #define USB_PORT_FEAT_ENABLE 1 | ||
43 | #define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */ | ||
44 | #define USB_PORT_FEAT_OVER_CURRENT 3 | ||
45 | #define USB_PORT_FEAT_RESET 4 | ||
46 | #define USB_PORT_FEAT_L1 5 /* L1 suspend */ | ||
47 | #define USB_PORT_FEAT_POWER 8 | ||
48 | #define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */ | ||
49 | #define USB_PORT_FEAT_C_CONNECTION 16 | ||
50 | #define USB_PORT_FEAT_C_ENABLE 17 | ||
51 | #define USB_PORT_FEAT_C_SUSPEND 18 | ||
52 | #define USB_PORT_FEAT_C_OVER_CURRENT 19 | ||
53 | #define USB_PORT_FEAT_C_RESET 20 | ||
54 | #define USB_PORT_FEAT_TEST 21 | ||
55 | #define USB_PORT_FEAT_INDICATOR 22 | ||
56 | #define USB_PORT_FEAT_C_PORT_L1 23 | ||
57 | |||
58 | /* | ||
59 | * Hub Status and Hub Change results | ||
60 | * See USB 2.0 spec Table 11-19 and Table 11-20 | ||
61 | */ | ||
62 | struct usb_port_status { | ||
63 | __le16 wPortStatus; | ||
64 | __le16 wPortChange; | ||
65 | } __attribute__ ((packed)); | ||
66 | |||
67 | /* | ||
68 | * wPortStatus bit field | ||
69 | * See USB 2.0 spec Table 11-21 | ||
70 | */ | ||
71 | #define USB_PORT_STAT_CONNECTION 0x0001 | ||
72 | #define USB_PORT_STAT_ENABLE 0x0002 | ||
73 | #define USB_PORT_STAT_SUSPEND 0x0004 | ||
74 | #define USB_PORT_STAT_OVERCURRENT 0x0008 | ||
75 | #define USB_PORT_STAT_RESET 0x0010 | ||
76 | #define USB_PORT_STAT_L1 0x0020 | ||
77 | /* bits 6 to 7 are reserved */ | ||
78 | #define USB_PORT_STAT_POWER 0x0100 | ||
79 | #define USB_PORT_STAT_LOW_SPEED 0x0200 | ||
80 | #define USB_PORT_STAT_HIGH_SPEED 0x0400 | ||
81 | #define USB_PORT_STAT_TEST 0x0800 | ||
82 | #define USB_PORT_STAT_INDICATOR 0x1000 | ||
83 | /* bits 13 to 15 are reserved */ | ||
84 | #define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */ | ||
85 | |||
86 | /* | ||
87 | * wPortChange bit field | ||
88 | * See USB 2.0 spec Table 11-22 | ||
89 | * Bits 0 to 4 shown, bits 5 to 15 are reserved | ||
90 | */ | ||
91 | #define USB_PORT_STAT_C_CONNECTION 0x0001 | ||
92 | #define USB_PORT_STAT_C_ENABLE 0x0002 | ||
93 | #define USB_PORT_STAT_C_SUSPEND 0x0004 | ||
94 | #define USB_PORT_STAT_C_OVERCURRENT 0x0008 | ||
95 | #define USB_PORT_STAT_C_RESET 0x0010 | ||
96 | #define USB_PORT_STAT_C_L1 0x0020 | ||
97 | |||
98 | /* | ||
99 | * wHubCharacteristics (masks) | ||
100 | * See USB 2.0 spec Table 11-13, offset 3 | ||
101 | */ | ||
102 | #define HUB_CHAR_LPSM 0x0003 /* D1 .. D0 */ | ||
103 | #define HUB_CHAR_COMPOUND 0x0004 /* D2 */ | ||
104 | #define HUB_CHAR_OCPM 0x0018 /* D4 .. D3 */ | ||
105 | #define HUB_CHAR_TTTT 0x0060 /* D6 .. D5 */ | ||
106 | #define HUB_CHAR_PORTIND 0x0080 /* D7 */ | ||
107 | |||
108 | struct usb_hub_status { | ||
109 | __le16 wHubStatus; | ||
110 | __le16 wHubChange; | ||
111 | } __attribute__ ((packed)); | ||
112 | |||
113 | /* | ||
114 | * Hub Status & Hub Change bit masks | ||
115 | * See USB 2.0 spec Table 11-19 and Table 11-20 | ||
116 | * Bits 0 and 1 for wHubStatus and wHubChange | ||
117 | * Bits 2 to 15 are reserved for both | ||
118 | */ | ||
119 | #define HUB_STATUS_LOCAL_POWER 0x0001 | ||
120 | #define HUB_STATUS_OVERCURRENT 0x0002 | ||
121 | #define HUB_CHANGE_LOCAL_POWER 0x0001 | ||
122 | #define HUB_CHANGE_OVERCURRENT 0x0002 | ||
123 | |||
124 | |||
125 | /* | ||
126 | * Hub descriptor | ||
127 | * See USB 2.0 spec Table 11-13 | ||
128 | */ | ||
129 | |||
130 | #define USB_DT_HUB (USB_TYPE_CLASS | 0x09) | ||
131 | #define USB_DT_HUB_NONVAR_SIZE 7 | ||
132 | |||
133 | struct usb_hub_descriptor { | ||
134 | __u8 bDescLength; | ||
135 | __u8 bDescriptorType; | ||
136 | __u8 bNbrPorts; | ||
137 | __le16 wHubCharacteristics; | ||
138 | __u8 bPwrOn2PwrGood; | ||
139 | __u8 bHubContrCurrent; | ||
140 | /* add 1 bit for hub status change; round to bytes */ | ||
141 | __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
142 | __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8]; | ||
143 | } __attribute__ ((packed)); | ||
144 | |||
145 | |||
146 | /* port indicator status selectors, tables 11-7 and 11-25 */ | ||
147 | #define HUB_LED_AUTO 0 | ||
148 | #define HUB_LED_AMBER 1 | ||
149 | #define HUB_LED_GREEN 2 | ||
150 | #define HUB_LED_OFF 3 | ||
151 | |||
152 | enum hub_led_mode { | ||
153 | INDICATOR_AUTO = 0, | ||
154 | INDICATOR_CYCLE, | ||
155 | /* software blinks for attention: software, hardware, reserved */ | ||
156 | INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF, | ||
157 | INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF, | ||
158 | INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF | ||
159 | } __attribute__ ((packed)); | ||
160 | |||
161 | /* Transaction Translator Think Times, in bits */ | ||
162 | #define HUB_TTTT_8_BITS 0x00 | ||
163 | #define HUB_TTTT_16_BITS 0x20 | ||
164 | #define HUB_TTTT_24_BITS 0x40 | ||
165 | #define HUB_TTTT_32_BITS 0x60 | ||
166 | |||
167 | #endif /* __LINUX_CH11_H */ | ||
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index e58369ff8168..da2ed77d3e8d 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -191,6 +191,8 @@ struct usb_ctrlrequest { | |||
191 | #define USB_DT_WIRE_ADAPTER 0x21 | 191 | #define USB_DT_WIRE_ADAPTER 0x21 |
192 | #define USB_DT_RPIPE 0x22 | 192 | #define USB_DT_RPIPE 0x22 |
193 | #define USB_DT_CS_RADIO_CONTROL 0x23 | 193 | #define USB_DT_CS_RADIO_CONTROL 0x23 |
194 | /* From the T10 UAS specification */ | ||
195 | #define USB_DT_PIPE_USAGE 0x24 | ||
194 | /* From the USB 3.0 spec */ | 196 | /* From the USB 3.0 spec */ |
195 | #define USB_DT_SS_ENDPOINT_COMP 0x30 | 197 | #define USB_DT_SS_ENDPOINT_COMP 0x30 |
196 | 198 | ||
@@ -475,7 +477,7 @@ static inline int usb_endpoint_xfer_isoc( | |||
475 | static inline int usb_endpoint_is_bulk_in( | 477 | static inline int usb_endpoint_is_bulk_in( |
476 | const struct usb_endpoint_descriptor *epd) | 478 | const struct usb_endpoint_descriptor *epd) |
477 | { | 479 | { |
478 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | 480 | return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd); |
479 | } | 481 | } |
480 | 482 | ||
481 | /** | 483 | /** |
@@ -488,7 +490,7 @@ static inline int usb_endpoint_is_bulk_in( | |||
488 | static inline int usb_endpoint_is_bulk_out( | 490 | static inline int usb_endpoint_is_bulk_out( |
489 | const struct usb_endpoint_descriptor *epd) | 491 | const struct usb_endpoint_descriptor *epd) |
490 | { | 492 | { |
491 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | 493 | return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd); |
492 | } | 494 | } |
493 | 495 | ||
494 | /** | 496 | /** |
@@ -501,7 +503,7 @@ static inline int usb_endpoint_is_bulk_out( | |||
501 | static inline int usb_endpoint_is_int_in( | 503 | static inline int usb_endpoint_is_int_in( |
502 | const struct usb_endpoint_descriptor *epd) | 504 | const struct usb_endpoint_descriptor *epd) |
503 | { | 505 | { |
504 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | 506 | return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd); |
505 | } | 507 | } |
506 | 508 | ||
507 | /** | 509 | /** |
@@ -514,7 +516,7 @@ static inline int usb_endpoint_is_int_in( | |||
514 | static inline int usb_endpoint_is_int_out( | 516 | static inline int usb_endpoint_is_int_out( |
515 | const struct usb_endpoint_descriptor *epd) | 517 | const struct usb_endpoint_descriptor *epd) |
516 | { | 518 | { |
517 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | 519 | return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd); |
518 | } | 520 | } |
519 | 521 | ||
520 | /** | 522 | /** |
@@ -527,7 +529,7 @@ static inline int usb_endpoint_is_int_out( | |||
527 | static inline int usb_endpoint_is_isoc_in( | 529 | static inline int usb_endpoint_is_isoc_in( |
528 | const struct usb_endpoint_descriptor *epd) | 530 | const struct usb_endpoint_descriptor *epd) |
529 | { | 531 | { |
530 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | 532 | return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd); |
531 | } | 533 | } |
532 | 534 | ||
533 | /** | 535 | /** |
@@ -540,7 +542,7 @@ static inline int usb_endpoint_is_isoc_in( | |||
540 | static inline int usb_endpoint_is_isoc_out( | 542 | static inline int usb_endpoint_is_isoc_out( |
541 | const struct usb_endpoint_descriptor *epd) | 543 | const struct usb_endpoint_descriptor *epd) |
542 | { | 544 | { |
543 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | 545 | return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); |
544 | } | 546 | } |
545 | 547 | ||
546 | /*-------------------------------------------------------------------------*/ | 548 | /*-------------------------------------------------------------------------*/ |
@@ -556,6 +558,8 @@ struct usb_ss_ep_comp_descriptor { | |||
556 | } __attribute__ ((packed)); | 558 | } __attribute__ ((packed)); |
557 | 559 | ||
558 | #define USB_DT_SS_EP_COMP_SIZE 6 | 560 | #define USB_DT_SS_EP_COMP_SIZE 6 |
561 | /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ | ||
562 | #define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f)) | ||
559 | 563 | ||
560 | /*-------------------------------------------------------------------------*/ | 564 | /*-------------------------------------------------------------------------*/ |
561 | 565 | ||
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 738ea1a691cb..139353efad34 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -326,6 +326,7 @@ struct usb_composite_dev { | |||
326 | 326 | ||
327 | /* private: */ | 327 | /* private: */ |
328 | /* internals */ | 328 | /* internals */ |
329 | unsigned int suspended:1; | ||
329 | struct usb_device_descriptor desc; | 330 | struct usb_device_descriptor desc; |
330 | struct list_head configs; | 331 | struct list_head configs; |
331 | struct usb_composite_driver *driver; | 332 | struct usb_composite_driver *driver; |
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index af4b86f3aca3..80287af2a738 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h | |||
@@ -45,7 +45,7 @@ struct ehci_caps { | |||
45 | #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ | 45 | #define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */ |
46 | #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ | 46 | #define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ |
47 | #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ | 47 | #define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ |
48 | u8 portroute [8]; /* nibbles for routing - offset 0xC */ | 48 | u8 portroute[8]; /* nibbles for routing - offset 0xC */ |
49 | } __attribute__ ((packed)); | 49 | } __attribute__ ((packed)); |
50 | 50 | ||
51 | 51 | ||
@@ -92,14 +92,14 @@ struct ehci_regs { | |||
92 | /* ASYNCLISTADDR: offset 0x18 */ | 92 | /* ASYNCLISTADDR: offset 0x18 */ |
93 | u32 async_next; /* address of next async queue head */ | 93 | u32 async_next; /* address of next async queue head */ |
94 | 94 | ||
95 | u32 reserved [9]; | 95 | u32 reserved[9]; |
96 | 96 | ||
97 | /* CONFIGFLAG: offset 0x40 */ | 97 | /* CONFIGFLAG: offset 0x40 */ |
98 | u32 configured_flag; | 98 | u32 configured_flag; |
99 | #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ | 99 | #define FLAG_CF (1<<0) /* true: we'll support "high speed" */ |
100 | 100 | ||
101 | /* PORTSC: offset 0x44 */ | 101 | /* PORTSC: offset 0x44 */ |
102 | u32 port_status [0]; /* up to N_PORTS */ | 102 | u32 port_status[0]; /* up to N_PORTS */ |
103 | /* 31:23 reserved */ | 103 | /* 31:23 reserved */ |
104 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ | 104 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ |
105 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ | 105 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ |
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h new file mode 100644 index 000000000000..a34a2a043b21 --- /dev/null +++ b/include/linux/usb/functionfs.h | |||
@@ -0,0 +1,199 @@ | |||
1 | #ifndef __LINUX_FUNCTIONFS_H__ | ||
2 | #define __LINUX_FUNCTIONFS_H__ 1 | ||
3 | |||
4 | |||
5 | #include <linux/types.h> | ||
6 | #include <linux/ioctl.h> | ||
7 | |||
8 | #include <linux/usb/ch9.h> | ||
9 | |||
10 | |||
11 | enum { | ||
12 | FUNCTIONFS_DESCRIPTORS_MAGIC = 1, | ||
13 | FUNCTIONFS_STRINGS_MAGIC = 2 | ||
14 | }; | ||
15 | |||
16 | |||
17 | #ifndef __KERNEL__ | ||
18 | |||
19 | /* Descriptor of an non-audio endpoint */ | ||
20 | struct usb_endpoint_descriptor_no_audio { | ||
21 | __u8 bLength; | ||
22 | __u8 bDescriptorType; | ||
23 | |||
24 | __u8 bEndpointAddress; | ||
25 | __u8 bmAttributes; | ||
26 | __le16 wMaxPacketSize; | ||
27 | __u8 bInterval; | ||
28 | } __attribute__((packed)); | ||
29 | |||
30 | |||
31 | /* | ||
32 | * All numbers must be in little endian order. | ||
33 | */ | ||
34 | |||
35 | struct usb_functionfs_descs_head { | ||
36 | __le32 magic; | ||
37 | __le32 length; | ||
38 | __le32 fs_count; | ||
39 | __le32 hs_count; | ||
40 | } __attribute__((packed)); | ||
41 | |||
42 | /* | ||
43 | * Descriptors format: | ||
44 | * | ||
45 | * | off | name | type | description | | ||
46 | * |-----+-----------+--------------+--------------------------------------| | ||
47 | * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC | | ||
48 | * | 4 | lenght | LE32 | length of the whole data chunk | | ||
49 | * | 8 | fs_count | LE32 | number of full-speed descriptors | | ||
50 | * | 12 | hs_count | LE32 | number of high-speed descriptors | | ||
51 | * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | | ||
52 | * | | hs_descrs | Descriptor[] | list of high-speed descriptors | | ||
53 | * | ||
54 | * descs are just valid USB descriptors and have the following format: | ||
55 | * | ||
56 | * | off | name | type | description | | ||
57 | * |-----+-----------------+------+--------------------------| | ||
58 | * | 0 | bLength | U8 | length of the descriptor | | ||
59 | * | 1 | bDescriptorType | U8 | descriptor type | | ||
60 | * | 2 | payload | | descriptor's payload | | ||
61 | */ | ||
62 | |||
63 | struct usb_functionfs_strings_head { | ||
64 | __le32 magic; | ||
65 | __le32 length; | ||
66 | __le32 str_count; | ||
67 | __le32 lang_count; | ||
68 | } __attribute__((packed)); | ||
69 | |||
70 | /* | ||
71 | * Strings format: | ||
72 | * | ||
73 | * | off | name | type | description | | ||
74 | * |-----+------------+-----------------------+----------------------------| | ||
75 | * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC | | ||
76 | * | 4 | length | LE32 | length of the data chunk | | ||
77 | * | 8 | str_count | LE32 | number of strings | | ||
78 | * | 12 | lang_count | LE32 | number of languages | | ||
79 | * | 16 | stringtab | StringTab[lang_count] | table of strings per lang | | ||
80 | * | ||
81 | * For each language there is one stringtab entry (ie. there are lang_count | ||
82 | * stringtab entires). Each StringTab has following format: | ||
83 | * | ||
84 | * | off | name | type | description | | ||
85 | * |-----+---------+-------------------+------------------------------------| | ||
86 | * | 0 | lang | LE16 | language code | | ||
87 | * | 2 | strings | String[str_count] | array of strings in given language | | ||
88 | * | ||
89 | * For each string ther is one strings entry (ie. there are str_count | ||
90 | * string entries). Each String is a NUL terminated string encoded in | ||
91 | * UTF-8. | ||
92 | */ | ||
93 | |||
94 | #endif | ||
95 | |||
96 | |||
97 | /* | ||
98 | * Events are delivered on the ep0 file descriptor, when the user mode driver | ||
99 | * reads from this file descriptor after writing the descriptors. Don't | ||
100 | * stop polling this descriptor. | ||
101 | */ | ||
102 | |||
103 | enum usb_functionfs_event_type { | ||
104 | FUNCTIONFS_BIND, | ||
105 | FUNCTIONFS_UNBIND, | ||
106 | |||
107 | FUNCTIONFS_ENABLE, | ||
108 | FUNCTIONFS_DISABLE, | ||
109 | |||
110 | FUNCTIONFS_SETUP, | ||
111 | |||
112 | FUNCTIONFS_SUSPEND, | ||
113 | FUNCTIONFS_RESUME | ||
114 | }; | ||
115 | |||
116 | /* NOTE: this structure must stay the same size and layout on | ||
117 | * both 32-bit and 64-bit kernels. | ||
118 | */ | ||
119 | struct usb_functionfs_event { | ||
120 | union { | ||
121 | /* SETUP: packet; DATA phase i/o precedes next event | ||
122 | *(setup.bmRequestType & USB_DIR_IN) flags direction */ | ||
123 | struct usb_ctrlrequest setup; | ||
124 | } __attribute__((packed)) u; | ||
125 | |||
126 | /* enum usb_functionfs_event_type */ | ||
127 | __u8 type; | ||
128 | __u8 _pad[3]; | ||
129 | } __attribute__((packed)); | ||
130 | |||
131 | |||
132 | /* Endpoint ioctls */ | ||
133 | /* The same as in gadgetfs */ | ||
134 | |||
135 | /* IN transfers may be reported to the gadget driver as complete | ||
136 | * when the fifo is loaded, before the host reads the data; | ||
137 | * OUT transfers may be reported to the host's "client" driver as | ||
138 | * complete when they're sitting in the FIFO unread. | ||
139 | * THIS returns how many bytes are "unclaimed" in the endpoint fifo | ||
140 | * (needed for precise fault handling, when the hardware allows it) | ||
141 | */ | ||
142 | #define FUNCTIONFS_FIFO_STATUS _IO('g', 1) | ||
143 | |||
144 | /* discards any unclaimed data in the fifo. */ | ||
145 | #define FUNCTIONFS_FIFO_FLUSH _IO('g', 2) | ||
146 | |||
147 | /* resets endpoint halt+toggle; used to implement set_interface. | ||
148 | * some hardware (like pxa2xx) can't support this. | ||
149 | */ | ||
150 | #define FUNCTIONFS_CLEAR_HALT _IO('g', 3) | ||
151 | |||
152 | /* Specific for functionfs */ | ||
153 | |||
154 | /* | ||
155 | * Returns reverse mapping of an interface. Called on EP0. If there | ||
156 | * is no such interface returns -EDOM. If function is not active | ||
157 | * returns -ENODEV. | ||
158 | */ | ||
159 | #define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128) | ||
160 | |||
161 | /* | ||
162 | * Returns real bEndpointAddress of an endpoint. If function is not | ||
163 | * active returns -ENODEV. | ||
164 | */ | ||
165 | #define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129) | ||
166 | |||
167 | |||
168 | #ifdef __KERNEL__ | ||
169 | |||
170 | struct ffs_data; | ||
171 | struct usb_composite_dev; | ||
172 | struct usb_configuration; | ||
173 | |||
174 | |||
175 | static int functionfs_init(void) __attribute__((warn_unused_result)); | ||
176 | static void functionfs_cleanup(void); | ||
177 | |||
178 | static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | ||
179 | __attribute__((warn_unused_result, nonnull)); | ||
180 | static void functionfs_unbind(struct ffs_data *ffs) | ||
181 | __attribute__((nonnull)); | ||
182 | |||
183 | static int functionfs_add(struct usb_composite_dev *cdev, | ||
184 | struct usb_configuration *c, | ||
185 | struct ffs_data *ffs) | ||
186 | __attribute__((warn_unused_result, nonnull)); | ||
187 | |||
188 | |||
189 | static int functionfs_ready_callback(struct ffs_data *ffs) | ||
190 | __attribute__((warn_unused_result, nonnull)); | ||
191 | static void functionfs_closed_callback(struct ffs_data *ffs) | ||
192 | __attribute__((nonnull)); | ||
193 | static int functionfs_check_dev_callback(const char *dev_name) | ||
194 | __attribute__((warn_unused_result, nonnull)); | ||
195 | |||
196 | |||
197 | #endif | ||
198 | |||
199 | #endif | ||
diff --git a/include/linux/usb/g_hid.h b/include/linux/usb/g_hid.h new file mode 100644 index 000000000000..50f5745df28c --- /dev/null +++ b/include/linux/usb/g_hid.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * g_hid.h -- Header file for USB HID gadget driver | ||
3 | * | ||
4 | * Copyright (C) 2010 Fabien Chouteau <fabien.chouteau@barco.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef __LINUX_USB_G_HID_H | ||
22 | #define __LINUX_USB_G_HID_H | ||
23 | |||
24 | struct hidg_func_descriptor { | ||
25 | unsigned char subclass; | ||
26 | unsigned char protocol; | ||
27 | unsigned short report_length; | ||
28 | unsigned short report_desc_length; | ||
29 | unsigned char report_desc[]; | ||
30 | }; | ||
31 | |||
32 | #endif /* __LINUX_USB_G_HID_H */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index f4b7ca516cdd..d3ef42d7d2f0 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -494,9 +494,13 @@ static inline void set_gadget_data(struct usb_gadget *gadget, void *data) | |||
494 | { dev_set_drvdata(&gadget->dev, data); } | 494 | { dev_set_drvdata(&gadget->dev, data); } |
495 | static inline void *get_gadget_data(struct usb_gadget *gadget) | 495 | static inline void *get_gadget_data(struct usb_gadget *gadget) |
496 | { return dev_get_drvdata(&gadget->dev); } | 496 | { return dev_get_drvdata(&gadget->dev); } |
497 | static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev) | ||
498 | { | ||
499 | return container_of(dev, struct usb_gadget, dev); | ||
500 | } | ||
497 | 501 | ||
498 | /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ | 502 | /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ |
499 | #define gadget_for_each_ep(tmp,gadget) \ | 503 | #define gadget_for_each_ep(tmp, gadget) \ |
500 | list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) | 504 | list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) |
501 | 505 | ||
502 | 506 | ||
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h index 612102e4d75e..0bb12e0d4f8f 100644 --- a/include/linux/usb/gadgetfs.h +++ b/include/linux/usb/gadgetfs.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #define __LINUX_USB_GADGETFS_H | 19 | #define __LINUX_USB_GADGETFS_H |
20 | 20 | ||
21 | #include <linux/types.h> | 21 | #include <linux/types.h> |
22 | #include <asm/ioctl.h> | 22 | #include <linux/ioctl.h> |
23 | 23 | ||
24 | #include <linux/usb/ch9.h> | 24 | #include <linux/usb/ch9.h> |
25 | 25 | ||
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h new file mode 100644 index 000000000000..2e3a4ea1a3da --- /dev/null +++ b/include/linux/usb/hcd.h | |||
@@ -0,0 +1,625 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2001-2002 by David Brownell | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, but | ||
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software Foundation, | ||
16 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef __USB_CORE_HCD_H | ||
20 | #define __USB_CORE_HCD_H | ||
21 | |||
22 | #ifdef __KERNEL__ | ||
23 | |||
24 | #include <linux/rwsem.h> | ||
25 | |||
26 | #define MAX_TOPO_LEVEL 6 | ||
27 | |||
28 | /* This file contains declarations of usbcore internals that are mostly | ||
29 | * used or exposed by Host Controller Drivers. | ||
30 | */ | ||
31 | |||
32 | /* | ||
33 | * USB Packet IDs (PIDs) | ||
34 | */ | ||
35 | #define USB_PID_EXT 0xf0 /* USB 2.0 LPM ECN */ | ||
36 | #define USB_PID_OUT 0xe1 | ||
37 | #define USB_PID_ACK 0xd2 | ||
38 | #define USB_PID_DATA0 0xc3 | ||
39 | #define USB_PID_PING 0xb4 /* USB 2.0 */ | ||
40 | #define USB_PID_SOF 0xa5 | ||
41 | #define USB_PID_NYET 0x96 /* USB 2.0 */ | ||
42 | #define USB_PID_DATA2 0x87 /* USB 2.0 */ | ||
43 | #define USB_PID_SPLIT 0x78 /* USB 2.0 */ | ||
44 | #define USB_PID_IN 0x69 | ||
45 | #define USB_PID_NAK 0x5a | ||
46 | #define USB_PID_DATA1 0x4b | ||
47 | #define USB_PID_PREAMBLE 0x3c /* Token mode */ | ||
48 | #define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */ | ||
49 | #define USB_PID_SETUP 0x2d | ||
50 | #define USB_PID_STALL 0x1e | ||
51 | #define USB_PID_MDATA 0x0f /* USB 2.0 */ | ||
52 | |||
53 | /*-------------------------------------------------------------------------*/ | ||
54 | |||
55 | /* | ||
56 | * USB Host Controller Driver (usb_hcd) framework | ||
57 | * | ||
58 | * Since "struct usb_bus" is so thin, you can't share much code in it. | ||
59 | * This framework is a layer over that, and should be more sharable. | ||
60 | * | ||
61 | * @authorized_default: Specifies if new devices are authorized to | ||
62 | * connect by default or they require explicit | ||
63 | * user space authorization; this bit is settable | ||
64 | * through /sys/class/usb_host/X/authorized_default. | ||
65 | * For the rest is RO, so we don't lock to r/w it. | ||
66 | */ | ||
67 | |||
68 | /*-------------------------------------------------------------------------*/ | ||
69 | |||
70 | struct usb_hcd { | ||
71 | |||
72 | /* | ||
73 | * housekeeping | ||
74 | */ | ||
75 | struct usb_bus self; /* hcd is-a bus */ | ||
76 | struct kref kref; /* reference counter */ | ||
77 | |||
78 | const char *product_desc; /* product/vendor string */ | ||
79 | char irq_descr[24]; /* driver + bus # */ | ||
80 | |||
81 | struct timer_list rh_timer; /* drives root-hub polling */ | ||
82 | struct urb *status_urb; /* the current status urb */ | ||
83 | #ifdef CONFIG_USB_SUSPEND | ||
84 | struct work_struct wakeup_work; /* for remote wakeup */ | ||
85 | #endif | ||
86 | |||
87 | /* | ||
88 | * hardware info/state | ||
89 | */ | ||
90 | const struct hc_driver *driver; /* hw-specific hooks */ | ||
91 | |||
92 | /* Flags that need to be manipulated atomically */ | ||
93 | unsigned long flags; | ||
94 | #define HCD_FLAG_HW_ACCESSIBLE 0x00000001 | ||
95 | #define HCD_FLAG_SAW_IRQ 0x00000002 | ||
96 | |||
97 | unsigned rh_registered:1;/* is root hub registered? */ | ||
98 | |||
99 | /* The next flag is a stopgap, to be removed when all the HCDs | ||
100 | * support the new root-hub polling mechanism. */ | ||
101 | unsigned uses_new_polling:1; | ||
102 | unsigned poll_rh:1; /* poll for rh status? */ | ||
103 | unsigned poll_pending:1; /* status has changed? */ | ||
104 | unsigned wireless:1; /* Wireless USB HCD */ | ||
105 | unsigned authorized_default:1; | ||
106 | unsigned has_tt:1; /* Integrated TT in root hub */ | ||
107 | |||
108 | int irq; /* irq allocated */ | ||
109 | void __iomem *regs; /* device memory/io */ | ||
110 | u64 rsrc_start; /* memory/io resource start */ | ||
111 | u64 rsrc_len; /* memory/io resource length */ | ||
112 | unsigned power_budget; /* in mA, 0 = no limit */ | ||
113 | |||
114 | /* bandwidth_mutex should be taken before adding or removing | ||
115 | * any new bus bandwidth constraints: | ||
116 | * 1. Before adding a configuration for a new device. | ||
117 | * 2. Before removing the configuration to put the device into | ||
118 | * the addressed state. | ||
119 | * 3. Before selecting a different configuration. | ||
120 | * 4. Before selecting an alternate interface setting. | ||
121 | * | ||
122 | * bandwidth_mutex should be dropped after a successful control message | ||
123 | * to the device, or resetting the bandwidth after a failed attempt. | ||
124 | */ | ||
125 | struct mutex bandwidth_mutex; | ||
126 | |||
127 | |||
128 | #define HCD_BUFFER_POOLS 4 | ||
129 | struct dma_pool *pool[HCD_BUFFER_POOLS]; | ||
130 | |||
131 | int state; | ||
132 | # define __ACTIVE 0x01 | ||
133 | # define __SUSPEND 0x04 | ||
134 | # define __TRANSIENT 0x80 | ||
135 | |||
136 | # define HC_STATE_HALT 0 | ||
137 | # define HC_STATE_RUNNING (__ACTIVE) | ||
138 | # define HC_STATE_QUIESCING (__SUSPEND|__TRANSIENT|__ACTIVE) | ||
139 | # define HC_STATE_RESUMING (__SUSPEND|__TRANSIENT) | ||
140 | # define HC_STATE_SUSPENDED (__SUSPEND) | ||
141 | |||
142 | #define HC_IS_RUNNING(state) ((state) & __ACTIVE) | ||
143 | #define HC_IS_SUSPENDED(state) ((state) & __SUSPEND) | ||
144 | |||
145 | /* more shared queuing code would be good; it should support | ||
146 | * smarter scheduling, handle transaction translators, etc; | ||
147 | * input size of periodic table to an interrupt scheduler. | ||
148 | * (ohci 32, uhci 1024, ehci 256/512/1024). | ||
149 | */ | ||
150 | |||
151 | /* The HC driver's private data is stored at the end of | ||
152 | * this structure. | ||
153 | */ | ||
154 | unsigned long hcd_priv[0] | ||
155 | __attribute__ ((aligned(sizeof(unsigned long)))); | ||
156 | }; | ||
157 | |||
158 | /* 2.4 does this a bit differently ... */ | ||
159 | static inline struct usb_bus *hcd_to_bus(struct usb_hcd *hcd) | ||
160 | { | ||
161 | return &hcd->self; | ||
162 | } | ||
163 | |||
164 | static inline struct usb_hcd *bus_to_hcd(struct usb_bus *bus) | ||
165 | { | ||
166 | return container_of(bus, struct usb_hcd, self); | ||
167 | } | ||
168 | |||
169 | struct hcd_timeout { /* timeouts we allocate */ | ||
170 | struct list_head timeout_list; | ||
171 | struct timer_list timer; | ||
172 | }; | ||
173 | |||
174 | /*-------------------------------------------------------------------------*/ | ||
175 | |||
176 | |||
177 | struct hc_driver { | ||
178 | const char *description; /* "ehci-hcd" etc */ | ||
179 | const char *product_desc; /* product/vendor string */ | ||
180 | size_t hcd_priv_size; /* size of private data */ | ||
181 | |||
182 | /* irq handler */ | ||
183 | irqreturn_t (*irq) (struct usb_hcd *hcd); | ||
184 | |||
185 | int flags; | ||
186 | #define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ | ||
187 | #define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ | ||
188 | #define HCD_USB11 0x0010 /* USB 1.1 */ | ||
189 | #define HCD_USB2 0x0020 /* USB 2.0 */ | ||
190 | #define HCD_USB3 0x0040 /* USB 3.0 */ | ||
191 | #define HCD_MASK 0x0070 | ||
192 | |||
193 | /* called to init HCD and root hub */ | ||
194 | int (*reset) (struct usb_hcd *hcd); | ||
195 | int (*start) (struct usb_hcd *hcd); | ||
196 | |||
197 | /* NOTE: these suspend/resume calls relate to the HC as | ||
198 | * a whole, not just the root hub; they're for PCI bus glue. | ||
199 | */ | ||
200 | /* called after suspending the hub, before entering D3 etc */ | ||
201 | int (*pci_suspend)(struct usb_hcd *hcd); | ||
202 | |||
203 | /* called after entering D0 (etc), before resuming the hub */ | ||
204 | int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); | ||
205 | |||
206 | /* cleanly make HCD stop writing memory and doing I/O */ | ||
207 | void (*stop) (struct usb_hcd *hcd); | ||
208 | |||
209 | /* shutdown HCD */ | ||
210 | void (*shutdown) (struct usb_hcd *hcd); | ||
211 | |||
212 | /* return current frame number */ | ||
213 | int (*get_frame_number) (struct usb_hcd *hcd); | ||
214 | |||
215 | /* manage i/o requests, device state */ | ||
216 | int (*urb_enqueue)(struct usb_hcd *hcd, | ||
217 | struct urb *urb, gfp_t mem_flags); | ||
218 | int (*urb_dequeue)(struct usb_hcd *hcd, | ||
219 | struct urb *urb, int status); | ||
220 | |||
221 | /* hw synch, freeing endpoint resources that urb_dequeue can't */ | ||
222 | void (*endpoint_disable)(struct usb_hcd *hcd, | ||
223 | struct usb_host_endpoint *ep); | ||
224 | |||
225 | /* (optional) reset any endpoint state such as sequence number | ||
226 | and current window */ | ||
227 | void (*endpoint_reset)(struct usb_hcd *hcd, | ||
228 | struct usb_host_endpoint *ep); | ||
229 | |||
230 | /* root hub support */ | ||
231 | int (*hub_status_data) (struct usb_hcd *hcd, char *buf); | ||
232 | int (*hub_control) (struct usb_hcd *hcd, | ||
233 | u16 typeReq, u16 wValue, u16 wIndex, | ||
234 | char *buf, u16 wLength); | ||
235 | int (*bus_suspend)(struct usb_hcd *); | ||
236 | int (*bus_resume)(struct usb_hcd *); | ||
237 | int (*start_port_reset)(struct usb_hcd *, unsigned port_num); | ||
238 | |||
239 | /* force handover of high-speed port to full-speed companion */ | ||
240 | void (*relinquish_port)(struct usb_hcd *, int); | ||
241 | /* has a port been handed over to a companion? */ | ||
242 | int (*port_handed_over)(struct usb_hcd *, int); | ||
243 | |||
244 | /* CLEAR_TT_BUFFER completion callback */ | ||
245 | void (*clear_tt_buffer_complete)(struct usb_hcd *, | ||
246 | struct usb_host_endpoint *); | ||
247 | |||
248 | /* xHCI specific functions */ | ||
249 | /* Called by usb_alloc_dev to alloc HC device structures */ | ||
250 | int (*alloc_dev)(struct usb_hcd *, struct usb_device *); | ||
251 | /* Called by usb_disconnect to free HC device structures */ | ||
252 | void (*free_dev)(struct usb_hcd *, struct usb_device *); | ||
253 | /* Change a group of bulk endpoints to support multiple stream IDs */ | ||
254 | int (*alloc_streams)(struct usb_hcd *hcd, struct usb_device *udev, | ||
255 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
256 | unsigned int num_streams, gfp_t mem_flags); | ||
257 | /* Reverts a group of bulk endpoints back to not using stream IDs. | ||
258 | * Can fail if we run out of memory. | ||
259 | */ | ||
260 | int (*free_streams)(struct usb_hcd *hcd, struct usb_device *udev, | ||
261 | struct usb_host_endpoint **eps, unsigned int num_eps, | ||
262 | gfp_t mem_flags); | ||
263 | |||
264 | /* Bandwidth computation functions */ | ||
265 | /* Note that add_endpoint() can only be called once per endpoint before | ||
266 | * check_bandwidth() or reset_bandwidth() must be called. | ||
267 | * drop_endpoint() can only be called once per endpoint also. | ||
268 | * A call to xhci_drop_endpoint() followed by a call to | ||
269 | * xhci_add_endpoint() will add the endpoint to the schedule with | ||
270 | * possibly new parameters denoted by a different endpoint descriptor | ||
271 | * in usb_host_endpoint. A call to xhci_add_endpoint() followed by a | ||
272 | * call to xhci_drop_endpoint() is not allowed. | ||
273 | */ | ||
274 | /* Allocate endpoint resources and add them to a new schedule */ | ||
275 | int (*add_endpoint)(struct usb_hcd *, struct usb_device *, | ||
276 | struct usb_host_endpoint *); | ||
277 | /* Drop an endpoint from a new schedule */ | ||
278 | int (*drop_endpoint)(struct usb_hcd *, struct usb_device *, | ||
279 | struct usb_host_endpoint *); | ||
280 | /* Check that a new hardware configuration, set using | ||
281 | * endpoint_enable and endpoint_disable, does not exceed bus | ||
282 | * bandwidth. This must be called before any set configuration | ||
283 | * or set interface requests are sent to the device. | ||
284 | */ | ||
285 | int (*check_bandwidth)(struct usb_hcd *, struct usb_device *); | ||
286 | /* Reset the device schedule to the last known good schedule, | ||
287 | * which was set from a previous successful call to | ||
288 | * check_bandwidth(). This reverts any add_endpoint() and | ||
289 | * drop_endpoint() calls since that last successful call. | ||
290 | * Used for when a check_bandwidth() call fails due to resource | ||
291 | * or bandwidth constraints. | ||
292 | */ | ||
293 | void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); | ||
294 | /* Returns the hardware-chosen device address */ | ||
295 | int (*address_device)(struct usb_hcd *, struct usb_device *udev); | ||
296 | /* Notifies the HCD after a hub descriptor is fetched. | ||
297 | * Will block. | ||
298 | */ | ||
299 | int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, | ||
300 | struct usb_tt *tt, gfp_t mem_flags); | ||
301 | int (*reset_device)(struct usb_hcd *, struct usb_device *); | ||
302 | }; | ||
303 | |||
304 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); | ||
305 | extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, | ||
306 | int status); | ||
307 | extern void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb); | ||
308 | |||
309 | extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); | ||
310 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); | ||
311 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, | ||
312 | int status); | ||
313 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, | ||
314 | struct usb_host_endpoint *ep); | ||
315 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | ||
316 | struct usb_host_endpoint *ep); | ||
317 | extern void usb_hcd_reset_endpoint(struct usb_device *udev, | ||
318 | struct usb_host_endpoint *ep); | ||
319 | extern void usb_hcd_synchronize_unlinks(struct usb_device *udev); | ||
320 | extern int usb_hcd_alloc_bandwidth(struct usb_device *udev, | ||
321 | struct usb_host_config *new_config, | ||
322 | struct usb_host_interface *old_alt, | ||
323 | struct usb_host_interface *new_alt); | ||
324 | extern int usb_hcd_get_frame_number(struct usb_device *udev); | ||
325 | |||
326 | extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, | ||
327 | struct device *dev, const char *bus_name); | ||
328 | extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); | ||
329 | extern void usb_put_hcd(struct usb_hcd *hcd); | ||
330 | extern int usb_add_hcd(struct usb_hcd *hcd, | ||
331 | unsigned int irqnum, unsigned long irqflags); | ||
332 | extern void usb_remove_hcd(struct usb_hcd *hcd); | ||
333 | |||
334 | struct platform_device; | ||
335 | extern void usb_hcd_platform_shutdown(struct platform_device *dev); | ||
336 | |||
337 | #ifdef CONFIG_PCI | ||
338 | struct pci_dev; | ||
339 | struct pci_device_id; | ||
340 | extern int usb_hcd_pci_probe(struct pci_dev *dev, | ||
341 | const struct pci_device_id *id); | ||
342 | extern void usb_hcd_pci_remove(struct pci_dev *dev); | ||
343 | extern void usb_hcd_pci_shutdown(struct pci_dev *dev); | ||
344 | |||
345 | #ifdef CONFIG_PM_SLEEP | ||
346 | extern const struct dev_pm_ops usb_hcd_pci_pm_ops; | ||
347 | #endif | ||
348 | #endif /* CONFIG_PCI */ | ||
349 | |||
350 | /* pci-ish (pdev null is ok) buffer alloc/mapping support */ | ||
351 | int hcd_buffer_create(struct usb_hcd *hcd); | ||
352 | void hcd_buffer_destroy(struct usb_hcd *hcd); | ||
353 | |||
354 | void *hcd_buffer_alloc(struct usb_bus *bus, size_t size, | ||
355 | gfp_t mem_flags, dma_addr_t *dma); | ||
356 | void hcd_buffer_free(struct usb_bus *bus, size_t size, | ||
357 | void *addr, dma_addr_t dma); | ||
358 | |||
359 | /* generic bus glue, needed for host controllers that don't use PCI */ | ||
360 | extern irqreturn_t usb_hcd_irq(int irq, void *__hcd); | ||
361 | |||
362 | extern void usb_hc_died(struct usb_hcd *hcd); | ||
363 | extern void usb_hcd_poll_rh_status(struct usb_hcd *hcd); | ||
364 | |||
365 | /* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ | ||
366 | #define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) | ||
367 | #define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) | ||
368 | #define usb_settoggle(dev, ep, out, bit) \ | ||
369 | ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \ | ||
370 | ((bit) << (ep))) | ||
371 | |||
372 | /* -------------------------------------------------------------------------- */ | ||
373 | |||
374 | /* Enumeration is only for the hub driver, or HCD virtual root hubs */ | ||
375 | extern struct usb_device *usb_alloc_dev(struct usb_device *parent, | ||
376 | struct usb_bus *, unsigned port); | ||
377 | extern int usb_new_device(struct usb_device *dev); | ||
378 | extern void usb_disconnect(struct usb_device **); | ||
379 | |||
380 | extern int usb_get_configuration(struct usb_device *dev); | ||
381 | extern void usb_destroy_configuration(struct usb_device *dev); | ||
382 | |||
383 | /*-------------------------------------------------------------------------*/ | ||
384 | |||
385 | /* | ||
386 | * HCD Root Hub support | ||
387 | */ | ||
388 | |||
389 | #include <linux/usb/ch11.h> | ||
390 | |||
391 | /* | ||
392 | * As of USB 2.0, full/low speed devices are segregated into trees. | ||
393 | * One type grows from USB 1.1 host controllers (OHCI, UHCI etc). | ||
394 | * The other type grows from high speed hubs when they connect to | ||
395 | * full/low speed devices using "Transaction Translators" (TTs). | ||
396 | * | ||
397 | * TTs should only be known to the hub driver, and high speed bus | ||
398 | * drivers (only EHCI for now). They affect periodic scheduling and | ||
399 | * sometimes control/bulk error recovery. | ||
400 | */ | ||
401 | |||
402 | struct usb_device; | ||
403 | |||
404 | struct usb_tt { | ||
405 | struct usb_device *hub; /* upstream highspeed hub */ | ||
406 | int multi; /* true means one TT per port */ | ||
407 | unsigned think_time; /* think time in ns */ | ||
408 | |||
409 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ | ||
410 | spinlock_t lock; | ||
411 | struct list_head clear_list; /* of usb_tt_clear */ | ||
412 | struct work_struct clear_work; | ||
413 | }; | ||
414 | |||
415 | struct usb_tt_clear { | ||
416 | struct list_head clear_list; | ||
417 | unsigned tt; | ||
418 | u16 devinfo; | ||
419 | struct usb_hcd *hcd; | ||
420 | struct usb_host_endpoint *ep; | ||
421 | }; | ||
422 | |||
423 | extern int usb_hub_clear_tt_buffer(struct urb *urb); | ||
424 | extern void usb_ep0_reinit(struct usb_device *); | ||
425 | |||
426 | /* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */ | ||
427 | #define DeviceRequest \ | ||
428 | ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8) | ||
429 | #define DeviceOutRequest \ | ||
430 | ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_DEVICE)<<8) | ||
431 | |||
432 | #define InterfaceRequest \ | ||
433 | ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8) | ||
434 | |||
435 | #define EndpointRequest \ | ||
436 | ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8) | ||
437 | #define EndpointOutRequest \ | ||
438 | ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8) | ||
439 | |||
440 | /* class requests from the USB 2.0 hub spec, table 11-15 */ | ||
441 | /* GetBusState and SetHubDescriptor are optional, omitted */ | ||
442 | #define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE) | ||
443 | #define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE) | ||
444 | #define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR) | ||
445 | #define GetHubStatus (0xa000 | USB_REQ_GET_STATUS) | ||
446 | #define GetPortStatus (0xa300 | USB_REQ_GET_STATUS) | ||
447 | #define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE) | ||
448 | #define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE) | ||
449 | |||
450 | |||
451 | /*-------------------------------------------------------------------------*/ | ||
452 | |||
453 | /* | ||
454 | * Generic bandwidth allocation constants/support | ||
455 | */ | ||
456 | #define FRAME_TIME_USECS 1000L | ||
457 | #define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */ | ||
458 | /* Trying not to use worst-case bit-stuffing | ||
459 | * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ | ||
460 | /* bytecount = data payload byte count */ | ||
461 | |||
462 | #define NS_TO_US(ns) ((ns + 500L) / 1000L) | ||
463 | /* convert & round nanoseconds to microseconds */ | ||
464 | |||
465 | |||
466 | /* | ||
467 | * Full/low speed bandwidth allocation constants/support. | ||
468 | */ | ||
469 | #define BW_HOST_DELAY 1000L /* nanoseconds */ | ||
470 | #define BW_HUB_LS_SETUP 333L /* nanoseconds */ | ||
471 | /* 4 full-speed bit times (est.) */ | ||
472 | |||
473 | #define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */ | ||
474 | #define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L) | ||
475 | #define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L) | ||
476 | |||
477 | /* | ||
478 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed | ||
479 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed | ||
480 | * to preallocate bandwidth) | ||
481 | */ | ||
482 | #define USB2_HOST_DELAY 5 /* nsec, guess */ | ||
483 | #define HS_NSECS(bytes) (((55 * 8 * 2083) \ | ||
484 | + (2083UL * (3 + BitTime(bytes))))/1000 \ | ||
485 | + USB2_HOST_DELAY) | ||
486 | #define HS_NSECS_ISO(bytes) (((38 * 8 * 2083) \ | ||
487 | + (2083UL * (3 + BitTime(bytes))))/1000 \ | ||
488 | + USB2_HOST_DELAY) | ||
489 | #define HS_USECS(bytes) NS_TO_US(HS_NSECS(bytes)) | ||
490 | #define HS_USECS_ISO(bytes) NS_TO_US(HS_NSECS_ISO(bytes)) | ||
491 | |||
492 | extern long usb_calc_bus_time(int speed, int is_input, | ||
493 | int isoc, int bytecount); | ||
494 | |||
495 | /*-------------------------------------------------------------------------*/ | ||
496 | |||
497 | extern void usb_set_device_state(struct usb_device *udev, | ||
498 | enum usb_device_state new_state); | ||
499 | |||
500 | /*-------------------------------------------------------------------------*/ | ||
501 | |||
502 | /* exported only within usbcore */ | ||
503 | |||
504 | extern struct list_head usb_bus_list; | ||
505 | extern struct mutex usb_bus_list_lock; | ||
506 | extern wait_queue_head_t usb_kill_urb_queue; | ||
507 | |||
508 | extern int usb_find_interface_driver(struct usb_device *dev, | ||
509 | struct usb_interface *interface); | ||
510 | |||
511 | #define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) | ||
512 | |||
513 | #ifdef CONFIG_PM | ||
514 | extern void usb_root_hub_lost_power(struct usb_device *rhdev); | ||
515 | extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); | ||
516 | extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); | ||
517 | #endif /* CONFIG_PM */ | ||
518 | |||
519 | #ifdef CONFIG_USB_SUSPEND | ||
520 | extern void usb_hcd_resume_root_hub(struct usb_hcd *hcd); | ||
521 | #else | ||
522 | static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) | ||
523 | { | ||
524 | return; | ||
525 | } | ||
526 | #endif /* CONFIG_USB_SUSPEND */ | ||
527 | |||
528 | |||
529 | /* | ||
530 | * USB device fs stuff | ||
531 | */ | ||
532 | |||
533 | #ifdef CONFIG_USB_DEVICEFS | ||
534 | |||
535 | /* | ||
536 | * these are expected to be called from the USB core/hub thread | ||
537 | * with the kernel lock held | ||
538 | */ | ||
539 | extern void usbfs_update_special(void); | ||
540 | extern int usbfs_init(void); | ||
541 | extern void usbfs_cleanup(void); | ||
542 | |||
543 | #else /* CONFIG_USB_DEVICEFS */ | ||
544 | |||
545 | static inline void usbfs_update_special(void) {} | ||
546 | static inline int usbfs_init(void) { return 0; } | ||
547 | static inline void usbfs_cleanup(void) { } | ||
548 | |||
549 | #endif /* CONFIG_USB_DEVICEFS */ | ||
550 | |||
551 | /*-------------------------------------------------------------------------*/ | ||
552 | |||
553 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | ||
554 | |||
555 | struct usb_mon_operations { | ||
556 | void (*urb_submit)(struct usb_bus *bus, struct urb *urb); | ||
557 | void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err); | ||
558 | void (*urb_complete)(struct usb_bus *bus, struct urb *urb, int status); | ||
559 | /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ | ||
560 | }; | ||
561 | |||
562 | extern struct usb_mon_operations *mon_ops; | ||
563 | |||
564 | static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) | ||
565 | { | ||
566 | if (bus->monitored) | ||
567 | (*mon_ops->urb_submit)(bus, urb); | ||
568 | } | ||
569 | |||
570 | static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb, | ||
571 | int error) | ||
572 | { | ||
573 | if (bus->monitored) | ||
574 | (*mon_ops->urb_submit_error)(bus, urb, error); | ||
575 | } | ||
576 | |||
577 | static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | ||
578 | int status) | ||
579 | { | ||
580 | if (bus->monitored) | ||
581 | (*mon_ops->urb_complete)(bus, urb, status); | ||
582 | } | ||
583 | |||
584 | int usb_mon_register(struct usb_mon_operations *ops); | ||
585 | void usb_mon_deregister(void); | ||
586 | |||
587 | #else | ||
588 | |||
589 | static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {} | ||
590 | static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb, | ||
591 | int error) {} | ||
592 | static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb, | ||
593 | int status) {} | ||
594 | |||
595 | #endif /* CONFIG_USB_MON || CONFIG_USB_MON_MODULE */ | ||
596 | |||
597 | /*-------------------------------------------------------------------------*/ | ||
598 | |||
599 | /* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */ | ||
600 | /* bleech -- resurfaced in 2.4.11 or 2.4.12 */ | ||
601 | #define bitmap DeviceRemovable | ||
602 | |||
603 | |||
604 | /*-------------------------------------------------------------------------*/ | ||
605 | |||
606 | /* random stuff */ | ||
607 | |||
608 | #define RUN_CONTEXT (in_irq() ? "in_irq" \ | ||
609 | : (in_interrupt() ? "in_interrupt" : "can sleep")) | ||
610 | |||
611 | |||
612 | /* This rwsem is for use only by the hub driver and ehci-hcd. | ||
613 | * Nobody else should touch it. | ||
614 | */ | ||
615 | extern struct rw_semaphore ehci_cf_port_reset_rwsem; | ||
616 | |||
617 | /* Keep track of which host controller drivers are loaded */ | ||
618 | #define USB_UHCI_LOADED 0 | ||
619 | #define USB_OHCI_LOADED 1 | ||
620 | #define USB_EHCI_LOADED 2 | ||
621 | extern unsigned long usb_hcds_loaded; | ||
622 | |||
623 | #endif /* __KERNEL__ */ | ||
624 | |||
625 | #endif /* __USB_CORE_HCD_H */ | ||
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h index c949178a6530..2d2d1bbad9d2 100644 --- a/include/linux/usb/langwell_udc.h +++ b/include/linux/usb/langwell_udc.h | |||
@@ -181,7 +181,7 @@ struct langwell_op_regs { | |||
181 | #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ | 181 | #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ |
182 | #define PORTS_PO BIT(13) /* port owner */ | 182 | #define PORTS_PO BIT(13) /* port owner */ |
183 | #define PORTS_PP BIT(12) /* port power */ | 183 | #define PORTS_PP BIT(12) /* port power */ |
184 | #define PORTS_LS (BIT(11) | BIT(10)) /* line status */ | 184 | #define PORTS_LS (BIT(11) | BIT(10)) /* line status */ |
185 | #define PORTS_SLP BIT(9) /* suspend using L1 */ | 185 | #define PORTS_SLP BIT(9) /* suspend using L1 */ |
186 | #define PORTS_PR BIT(8) /* port reset */ | 186 | #define PORTS_PR BIT(8) /* port reset */ |
187 | #define PORTS_SUSP BIT(7) /* suspend */ | 187 | #define PORTS_SUSP BIT(7) /* suspend */ |
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 7acef0234c0e..ee2dd1d506ed 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
@@ -22,12 +22,47 @@ enum musb_mode { | |||
22 | 22 | ||
23 | struct clk; | 23 | struct clk; |
24 | 24 | ||
25 | enum musb_fifo_style { | ||
26 | FIFO_RXTX, | ||
27 | FIFO_TX, | ||
28 | FIFO_RX | ||
29 | } __attribute__ ((packed)); | ||
30 | |||
31 | enum musb_buf_mode { | ||
32 | BUF_SINGLE, | ||
33 | BUF_DOUBLE | ||
34 | } __attribute__ ((packed)); | ||
35 | |||
36 | struct musb_fifo_cfg { | ||
37 | u8 hw_ep_num; | ||
38 | enum musb_fifo_style style; | ||
39 | enum musb_buf_mode mode; | ||
40 | u16 maxpacket; | ||
41 | }; | ||
42 | |||
43 | #define MUSB_EP_FIFO(ep, st, m, pkt) \ | ||
44 | { \ | ||
45 | .hw_ep_num = ep, \ | ||
46 | .style = st, \ | ||
47 | .mode = m, \ | ||
48 | .maxpacket = pkt, \ | ||
49 | } | ||
50 | |||
51 | #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \ | ||
52 | MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt) | ||
53 | |||
54 | #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \ | ||
55 | MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt) | ||
56 | |||
25 | struct musb_hdrc_eps_bits { | 57 | struct musb_hdrc_eps_bits { |
26 | const char name[16]; | 58 | const char name[16]; |
27 | u8 bits; | 59 | u8 bits; |
28 | }; | 60 | }; |
29 | 61 | ||
30 | struct musb_hdrc_config { | 62 | struct musb_hdrc_config { |
63 | struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */ | ||
64 | unsigned fifo_cfg_size; /* size of the fifo configuration */ | ||
65 | |||
31 | /* MUSB configuration-specific details */ | 66 | /* MUSB configuration-specific details */ |
32 | unsigned multipoint:1; /* multipoint device */ | 67 | unsigned multipoint:1; /* multipoint device */ |
33 | unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ | 68 | unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ |
@@ -51,8 +86,9 @@ struct musb_hdrc_config { | |||
51 | 86 | ||
52 | struct musb_hdrc_eps_bits *eps_bits __deprecated; | 87 | struct musb_hdrc_eps_bits *eps_bits __deprecated; |
53 | #ifdef CONFIG_BLACKFIN | 88 | #ifdef CONFIG_BLACKFIN |
54 | /* A GPIO controlling VRSEL in Blackfin */ | 89 | /* A GPIO controlling VRSEL in Blackfin */ |
55 | unsigned int gpio_vrsel; | 90 | unsigned int gpio_vrsel; |
91 | unsigned int gpio_vrsel_active; | ||
56 | #endif | 92 | #endif |
57 | 93 | ||
58 | }; | 94 | }; |
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h new file mode 100644 index 000000000000..006d1064c8b2 --- /dev/null +++ b/include/linux/usb/ncm.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * USB CDC NCM auxiliary definitions | ||
3 | */ | ||
4 | |||
5 | #ifndef __LINUX_USB_NCM_H | ||
6 | #define __LINUX_USB_NCM_H | ||
7 | |||
8 | #include <linux/types.h> | ||
9 | #include <linux/usb/cdc.h> | ||
10 | #include <asm/unaligned.h> | ||
11 | |||
12 | #define NCM_NTB_MIN_IN_SIZE 2048 | ||
13 | #define NCM_NTB_MIN_OUT_SIZE 2048 | ||
14 | |||
15 | #define NCM_CONTROL_TIMEOUT (5 * 1000) | ||
16 | |||
17 | /* bmNetworkCapabilities */ | ||
18 | |||
19 | #define NCM_NCAP_ETH_FILTER (1 << 0) | ||
20 | #define NCM_NCAP_NET_ADDRESS (1 << 1) | ||
21 | #define NCM_NCAP_ENCAP_COMM (1 << 2) | ||
22 | #define NCM_NCAP_MAX_DGRAM (1 << 3) | ||
23 | #define NCM_NCAP_CRC_MODE (1 << 4) | ||
24 | |||
25 | /* | ||
26 | * Here are options for NCM Datagram Pointer table (NDP) parser. | ||
27 | * There are 2 different formats: NDP16 and NDP32 in the spec (ch. 3), | ||
28 | * in NDP16 offsets and sizes fields are 1 16bit word wide, | ||
29 | * in NDP32 -- 2 16bit words wide. Also signatures are different. | ||
30 | * To make the parser code the same, put the differences in the structure, | ||
31 | * and switch pointers to the structures when the format is changed. | ||
32 | */ | ||
33 | |||
34 | struct ndp_parser_opts { | ||
35 | u32 nth_sign; | ||
36 | u32 ndp_sign; | ||
37 | unsigned nth_size; | ||
38 | unsigned ndp_size; | ||
39 | unsigned ndplen_align; | ||
40 | /* sizes in u16 units */ | ||
41 | unsigned dgram_item_len; /* index or length */ | ||
42 | unsigned block_length; | ||
43 | unsigned fp_index; | ||
44 | unsigned reserved1; | ||
45 | unsigned reserved2; | ||
46 | unsigned next_fp_index; | ||
47 | }; | ||
48 | |||
49 | #define INIT_NDP16_OPTS { \ | ||
50 | .nth_sign = NCM_NTH16_SIGN, \ | ||
51 | .ndp_sign = NCM_NDP16_NOCRC_SIGN, \ | ||
52 | .nth_size = sizeof(struct usb_cdc_ncm_nth16), \ | ||
53 | .ndp_size = sizeof(struct usb_cdc_ncm_ndp16), \ | ||
54 | .ndplen_align = 4, \ | ||
55 | .dgram_item_len = 1, \ | ||
56 | .block_length = 1, \ | ||
57 | .fp_index = 1, \ | ||
58 | .reserved1 = 0, \ | ||
59 | .reserved2 = 0, \ | ||
60 | .next_fp_index = 1, \ | ||
61 | } | ||
62 | |||
63 | |||
64 | #define INIT_NDP32_OPTS { \ | ||
65 | .nth_sign = NCM_NTH32_SIGN, \ | ||
66 | .ndp_sign = NCM_NDP32_NOCRC_SIGN, \ | ||
67 | .nth_size = sizeof(struct usb_cdc_ncm_nth32), \ | ||
68 | .ndp_size = sizeof(struct usb_cdc_ncm_ndp32), \ | ||
69 | .ndplen_align = 8, \ | ||
70 | .dgram_item_len = 2, \ | ||
71 | .block_length = 2, \ | ||
72 | .fp_index = 2, \ | ||
73 | .reserved1 = 1, \ | ||
74 | .reserved2 = 2, \ | ||
75 | .next_fp_index = 2, \ | ||
76 | } | ||
77 | |||
78 | static inline void put_ncm(__le16 **p, unsigned size, unsigned val) | ||
79 | { | ||
80 | switch (size) { | ||
81 | case 1: | ||
82 | put_unaligned_le16((u16)val, *p); | ||
83 | break; | ||
84 | case 2: | ||
85 | put_unaligned_le32((u32)val, *p); | ||
86 | |||
87 | break; | ||
88 | default: | ||
89 | BUG(); | ||
90 | } | ||
91 | |||
92 | *p += size; | ||
93 | } | ||
94 | |||
95 | static inline unsigned get_ncm(__le16 **p, unsigned size) | ||
96 | { | ||
97 | unsigned tmp; | ||
98 | |||
99 | switch (size) { | ||
100 | case 1: | ||
101 | tmp = get_unaligned_le16(*p); | ||
102 | break; | ||
103 | case 2: | ||
104 | tmp = get_unaligned_le32(*p); | ||
105 | break; | ||
106 | default: | ||
107 | BUG(); | ||
108 | } | ||
109 | |||
110 | *p += size; | ||
111 | return tmp; | ||
112 | } | ||
113 | |||
114 | #endif /* __LINUX_USB_NCM_H */ | ||
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h index 96ca549a778d..148b8fa5b1a2 100644 --- a/include/linux/usb/net2280.h +++ b/include/linux/usb/net2280.h | |||
@@ -353,7 +353,7 @@ struct net2280_dma_regs { /* [11.7] */ | |||
353 | #define DMA_TRANSACTION_DONE_INTERRUPT 24 | 353 | #define DMA_TRANSACTION_DONE_INTERRUPT 24 |
354 | #define DMA_ABORT 1 | 354 | #define DMA_ABORT 1 |
355 | #define DMA_START 0 | 355 | #define DMA_START 0 |
356 | u32 _unused0 [2]; | 356 | u32 _unused0[2]; |
357 | /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ | 357 | /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */ |
358 | u32 dmacount; | 358 | u32 dmacount; |
359 | #define VALID_BIT 31 | 359 | #define VALID_BIT 31 |
@@ -374,7 +374,7 @@ struct net2280_dep_regs { /* [11.8] */ | |||
374 | u32 dep_cfg; | 374 | u32 dep_cfg; |
375 | /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ | 375 | /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */ |
376 | u32 dep_rsp; | 376 | u32 dep_rsp; |
377 | u32 _unused [2]; | 377 | u32 _unused[2]; |
378 | } __attribute__ ((packed)); | 378 | } __attribute__ ((packed)); |
379 | 379 | ||
380 | /* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs | 380 | /* configurable endpoint registers, BAR0 + 0x0300 ... array of seven structs |
@@ -437,7 +437,7 @@ struct net2280_ep_regs { /* [11.9] */ | |||
437 | /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ | 437 | /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */ |
438 | u32 ep_avail; | 438 | u32 ep_avail; |
439 | u32 ep_data; | 439 | u32 ep_data; |
440 | u32 _unused0 [2]; | 440 | u32 _unused0[2]; |
441 | } __attribute__ ((packed)); | 441 | } __attribute__ ((packed)); |
442 | 442 | ||
443 | #endif /* __LINUX_USB_NET2280_H */ | 443 | #endif /* __LINUX_USB_NET2280_H */ |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 0a555dd131fc..16b7f3347545 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
@@ -22,4 +22,8 @@ | |||
22 | /*device will morph if reset, don't use reset for handling errors */ | 22 | /*device will morph if reset, don't use reset for handling errors */ |
23 | #define USB_QUIRK_RESET_MORPHS 0x00000010 | 23 | #define USB_QUIRK_RESET_MORPHS 0x00000010 |
24 | 24 | ||
25 | /* device has more interface descriptions than the bNumInterfaces count, | ||
26 | and can't handle talking to these interfaces */ | ||
27 | #define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 | ||
28 | |||
25 | #endif /* __LINUX_USB_QUIRKS_H */ | 29 | #endif /* __LINUX_USB_QUIRKS_H */ |
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h index 1ef1ebc2b04f..05ef52861988 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h | |||
@@ -34,10 +34,10 @@ | |||
34 | struct rndis_msg_hdr { | 34 | struct rndis_msg_hdr { |
35 | __le32 msg_type; /* RNDIS_MSG_* */ | 35 | __le32 msg_type; /* RNDIS_MSG_* */ |
36 | __le32 msg_len; | 36 | __le32 msg_len; |
37 | // followed by data that varies between messages | 37 | /* followed by data that varies between messages */ |
38 | __le32 request_id; | 38 | __le32 request_id; |
39 | __le32 status; | 39 | __le32 status; |
40 | // ... and more | 40 | /* ... and more */ |
41 | } __attribute__ ((packed)); | 41 | } __attribute__ ((packed)); |
42 | 42 | ||
43 | /* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ | 43 | /* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ |
@@ -92,67 +92,67 @@ struct rndis_msg_hdr { | |||
92 | 92 | ||
93 | struct rndis_data_hdr { | 93 | struct rndis_data_hdr { |
94 | __le32 msg_type; /* RNDIS_MSG_PACKET */ | 94 | __le32 msg_type; /* RNDIS_MSG_PACKET */ |
95 | __le32 msg_len; // rndis_data_hdr + data_len + pad | 95 | __le32 msg_len; /* rndis_data_hdr + data_len + pad */ |
96 | __le32 data_offset; // 36 -- right after header | 96 | __le32 data_offset; /* 36 -- right after header */ |
97 | __le32 data_len; // ... real packet size | 97 | __le32 data_len; /* ... real packet size */ |
98 | 98 | ||
99 | __le32 oob_data_offset; // zero | 99 | __le32 oob_data_offset; /* zero */ |
100 | __le32 oob_data_len; // zero | 100 | __le32 oob_data_len; /* zero */ |
101 | __le32 num_oob; // zero | 101 | __le32 num_oob; /* zero */ |
102 | __le32 packet_data_offset; // zero | 102 | __le32 packet_data_offset; /* zero */ |
103 | 103 | ||
104 | __le32 packet_data_len; // zero | 104 | __le32 packet_data_len; /* zero */ |
105 | __le32 vc_handle; // zero | 105 | __le32 vc_handle; /* zero */ |
106 | __le32 reserved; // zero | 106 | __le32 reserved; /* zero */ |
107 | } __attribute__ ((packed)); | 107 | } __attribute__ ((packed)); |
108 | 108 | ||
109 | struct rndis_init { /* OUT */ | 109 | struct rndis_init { /* OUT */ |
110 | // header and: | 110 | /* header and: */ |
111 | __le32 msg_type; /* RNDIS_MSG_INIT */ | 111 | __le32 msg_type; /* RNDIS_MSG_INIT */ |
112 | __le32 msg_len; // 24 | 112 | __le32 msg_len; /* 24 */ |
113 | __le32 request_id; | 113 | __le32 request_id; |
114 | __le32 major_version; // of rndis (1.0) | 114 | __le32 major_version; /* of rndis (1.0) */ |
115 | __le32 minor_version; | 115 | __le32 minor_version; |
116 | __le32 max_transfer_size; | 116 | __le32 max_transfer_size; |
117 | } __attribute__ ((packed)); | 117 | } __attribute__ ((packed)); |
118 | 118 | ||
119 | struct rndis_init_c { /* IN */ | 119 | struct rndis_init_c { /* IN */ |
120 | // header and: | 120 | /* header and: */ |
121 | __le32 msg_type; /* RNDIS_MSG_INIT_C */ | 121 | __le32 msg_type; /* RNDIS_MSG_INIT_C */ |
122 | __le32 msg_len; | 122 | __le32 msg_len; |
123 | __le32 request_id; | 123 | __le32 request_id; |
124 | __le32 status; | 124 | __le32 status; |
125 | __le32 major_version; // of rndis (1.0) | 125 | __le32 major_version; /* of rndis (1.0) */ |
126 | __le32 minor_version; | 126 | __le32 minor_version; |
127 | __le32 device_flags; | 127 | __le32 device_flags; |
128 | __le32 medium; // zero == 802.3 | 128 | __le32 medium; /* zero == 802.3 */ |
129 | __le32 max_packets_per_message; | 129 | __le32 max_packets_per_message; |
130 | __le32 max_transfer_size; | 130 | __le32 max_transfer_size; |
131 | __le32 packet_alignment; // max 7; (1<<n) bytes | 131 | __le32 packet_alignment; /* max 7; (1<<n) bytes */ |
132 | __le32 af_list_offset; // zero | 132 | __le32 af_list_offset; /* zero */ |
133 | __le32 af_list_size; // zero | 133 | __le32 af_list_size; /* zero */ |
134 | } __attribute__ ((packed)); | 134 | } __attribute__ ((packed)); |
135 | 135 | ||
136 | struct rndis_halt { /* OUT (no reply) */ | 136 | struct rndis_halt { /* OUT (no reply) */ |
137 | // header and: | 137 | /* header and: */ |
138 | __le32 msg_type; /* RNDIS_MSG_HALT */ | 138 | __le32 msg_type; /* RNDIS_MSG_HALT */ |
139 | __le32 msg_len; | 139 | __le32 msg_len; |
140 | __le32 request_id; | 140 | __le32 request_id; |
141 | } __attribute__ ((packed)); | 141 | } __attribute__ ((packed)); |
142 | 142 | ||
143 | struct rndis_query { /* OUT */ | 143 | struct rndis_query { /* OUT */ |
144 | // header and: | 144 | /* header and: */ |
145 | __le32 msg_type; /* RNDIS_MSG_QUERY */ | 145 | __le32 msg_type; /* RNDIS_MSG_QUERY */ |
146 | __le32 msg_len; | 146 | __le32 msg_len; |
147 | __le32 request_id; | 147 | __le32 request_id; |
148 | __le32 oid; | 148 | __le32 oid; |
149 | __le32 len; | 149 | __le32 len; |
150 | __le32 offset; | 150 | __le32 offset; |
151 | /*?*/ __le32 handle; // zero | 151 | /*?*/ __le32 handle; /* zero */ |
152 | } __attribute__ ((packed)); | 152 | } __attribute__ ((packed)); |
153 | 153 | ||
154 | struct rndis_query_c { /* IN */ | 154 | struct rndis_query_c { /* IN */ |
155 | // header and: | 155 | /* header and: */ |
156 | __le32 msg_type; /* RNDIS_MSG_QUERY_C */ | 156 | __le32 msg_type; /* RNDIS_MSG_QUERY_C */ |
157 | __le32 msg_len; | 157 | __le32 msg_len; |
158 | __le32 request_id; | 158 | __le32 request_id; |
@@ -162,18 +162,18 @@ struct rndis_query_c { /* IN */ | |||
162 | } __attribute__ ((packed)); | 162 | } __attribute__ ((packed)); |
163 | 163 | ||
164 | struct rndis_set { /* OUT */ | 164 | struct rndis_set { /* OUT */ |
165 | // header and: | 165 | /* header and: */ |
166 | __le32 msg_type; /* RNDIS_MSG_SET */ | 166 | __le32 msg_type; /* RNDIS_MSG_SET */ |
167 | __le32 msg_len; | 167 | __le32 msg_len; |
168 | __le32 request_id; | 168 | __le32 request_id; |
169 | __le32 oid; | 169 | __le32 oid; |
170 | __le32 len; | 170 | __le32 len; |
171 | __le32 offset; | 171 | __le32 offset; |
172 | /*?*/ __le32 handle; // zero | 172 | /*?*/ __le32 handle; /* zero */ |
173 | } __attribute__ ((packed)); | 173 | } __attribute__ ((packed)); |
174 | 174 | ||
175 | struct rndis_set_c { /* IN */ | 175 | struct rndis_set_c { /* IN */ |
176 | // header and: | 176 | /* header and: */ |
177 | __le32 msg_type; /* RNDIS_MSG_SET_C */ | 177 | __le32 msg_type; /* RNDIS_MSG_SET_C */ |
178 | __le32 msg_len; | 178 | __le32 msg_len; |
179 | __le32 request_id; | 179 | __le32 request_id; |
@@ -181,14 +181,14 @@ struct rndis_set_c { /* IN */ | |||
181 | } __attribute__ ((packed)); | 181 | } __attribute__ ((packed)); |
182 | 182 | ||
183 | struct rndis_reset { /* IN */ | 183 | struct rndis_reset { /* IN */ |
184 | // header and: | 184 | /* header and: */ |
185 | __le32 msg_type; /* RNDIS_MSG_RESET */ | 185 | __le32 msg_type; /* RNDIS_MSG_RESET */ |
186 | __le32 msg_len; | 186 | __le32 msg_len; |
187 | __le32 reserved; | 187 | __le32 reserved; |
188 | } __attribute__ ((packed)); | 188 | } __attribute__ ((packed)); |
189 | 189 | ||
190 | struct rndis_reset_c { /* OUT */ | 190 | struct rndis_reset_c { /* OUT */ |
191 | // header and: | 191 | /* header and: */ |
192 | __le32 msg_type; /* RNDIS_MSG_RESET_C */ | 192 | __le32 msg_type; /* RNDIS_MSG_RESET_C */ |
193 | __le32 msg_len; | 193 | __le32 msg_len; |
194 | __le32 status; | 194 | __le32 status; |
@@ -196,7 +196,7 @@ struct rndis_reset_c { /* OUT */ | |||
196 | } __attribute__ ((packed)); | 196 | } __attribute__ ((packed)); |
197 | 197 | ||
198 | struct rndis_indicate { /* IN (unrequested) */ | 198 | struct rndis_indicate { /* IN (unrequested) */ |
199 | // header and: | 199 | /* header and: */ |
200 | __le32 msg_type; /* RNDIS_MSG_INDICATE */ | 200 | __le32 msg_type; /* RNDIS_MSG_INDICATE */ |
201 | __le32 msg_len; | 201 | __le32 msg_len; |
202 | __le32 status; | 202 | __le32 status; |
@@ -208,14 +208,14 @@ struct rndis_indicate { /* IN (unrequested) */ | |||
208 | } __attribute__ ((packed)); | 208 | } __attribute__ ((packed)); |
209 | 209 | ||
210 | struct rndis_keepalive { /* OUT (optionally IN) */ | 210 | struct rndis_keepalive { /* OUT (optionally IN) */ |
211 | // header and: | 211 | /* header and: */ |
212 | __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ | 212 | __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ |
213 | __le32 msg_len; | 213 | __le32 msg_len; |
214 | __le32 request_id; | 214 | __le32 request_id; |
215 | } __attribute__ ((packed)); | 215 | } __attribute__ ((packed)); |
216 | 216 | ||
217 | struct rndis_keepalive_c { /* IN (optionally OUT) */ | 217 | struct rndis_keepalive_c { /* IN (optionally OUT) */ |
218 | // header and: | 218 | /* header and: */ |
219 | __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ | 219 | __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ |
220 | __le32 msg_len; | 220 | __le32 msg_len; |
221 | __le32 request_id; | 221 | __le32 request_id; |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 0a458b861933..84a4c44c208b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -35,6 +35,9 @@ enum port_dev_state { | |||
35 | PORT_UNREGISTERING, | 35 | PORT_UNREGISTERING, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | /* USB serial flags */ | ||
39 | #define USB_SERIAL_WRITE_BUSY 0 | ||
40 | |||
38 | /** | 41 | /** |
39 | * usb_serial_port: structure for the specific ports of a device. | 42 | * usb_serial_port: structure for the specific ports of a device. |
40 | * @serial: pointer back to the struct usb_serial owner of this port. | 43 | * @serial: pointer back to the struct usb_serial owner of this port. |
@@ -49,7 +52,7 @@ enum port_dev_state { | |||
49 | * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. | 52 | * @interrupt_out_size: the size of the interrupt_out_buffer, in bytes. |
50 | * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. | 53 | * @interrupt_out_urb: pointer to the interrupt out struct urb for this port. |
51 | * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe | 54 | * @interrupt_out_endpointAddress: endpoint address for the interrupt out pipe |
52 | * for this port. | 55 | * for this port. |
53 | * @bulk_in_buffer: pointer to the bulk in buffer for this port. | 56 | * @bulk_in_buffer: pointer to the bulk in buffer for this port. |
54 | * @bulk_in_size: the size of the bulk_in_buffer, in bytes. | 57 | * @bulk_in_size: the size of the bulk_in_buffer, in bytes. |
55 | * @read_urb: pointer to the bulk in struct urb for this port. | 58 | * @read_urb: pointer to the bulk in struct urb for this port. |
@@ -60,13 +63,17 @@ enum port_dev_state { | |||
60 | * @write_urb: pointer to the bulk out struct urb for this port. | 63 | * @write_urb: pointer to the bulk out struct urb for this port. |
61 | * @write_fifo: kfifo used to buffer outgoing data | 64 | * @write_fifo: kfifo used to buffer outgoing data |
62 | * @write_urb_busy: port`s writing status | 65 | * @write_urb_busy: port`s writing status |
66 | * @bulk_out_buffers: pointers to the bulk out buffers for this port | ||
67 | * @write_urbs: pointers to the bulk out urbs for this port | ||
68 | * @write_urbs_free: status bitmap the for bulk out urbs | ||
69 | * @tx_bytes: number of bytes currently in host stack queues | ||
63 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this | 70 | * @bulk_out_endpointAddress: endpoint address for the bulk out pipe for this |
64 | * port. | 71 | * port. |
72 | * @flags: usb serial port flags | ||
65 | * @write_wait: a wait_queue_head_t used by the port. | 73 | * @write_wait: a wait_queue_head_t used by the port. |
66 | * @work: work queue entry for the line discipline waking up. | 74 | * @work: work queue entry for the line discipline waking up. |
67 | * @throttled: nonzero if the read urb is inactive to throttle the device | 75 | * @throttled: nonzero if the read urb is inactive to throttle the device |
68 | * @throttle_req: nonzero if the tty wants to throttle us | 76 | * @throttle_req: nonzero if the tty wants to throttle us |
69 | * @console: attached usb serial console | ||
70 | * @dev: pointer to the serial device | 77 | * @dev: pointer to the serial device |
71 | * | 78 | * |
72 | * This structure is used by the usb-serial core and drivers for the specific | 79 | * This structure is used by the usb-serial core and drivers for the specific |
@@ -97,16 +104,19 @@ struct usb_serial_port { | |||
97 | struct urb *write_urb; | 104 | struct urb *write_urb; |
98 | struct kfifo write_fifo; | 105 | struct kfifo write_fifo; |
99 | int write_urb_busy; | 106 | int write_urb_busy; |
107 | |||
108 | unsigned char *bulk_out_buffers[2]; | ||
109 | struct urb *write_urbs[2]; | ||
110 | unsigned long write_urbs_free; | ||
100 | __u8 bulk_out_endpointAddress; | 111 | __u8 bulk_out_endpointAddress; |
101 | 112 | ||
102 | int tx_bytes_flight; | 113 | int tx_bytes; |
103 | int urbs_in_flight; | ||
104 | 114 | ||
115 | unsigned long flags; | ||
105 | wait_queue_head_t write_wait; | 116 | wait_queue_head_t write_wait; |
106 | struct work_struct work; | 117 | struct work_struct work; |
107 | char throttled; | 118 | char throttled; |
108 | char throttle_req; | 119 | char throttle_req; |
109 | char console; | ||
110 | unsigned long sysrq; /* sysrq timeout */ | 120 | unsigned long sysrq; /* sysrq timeout */ |
111 | struct device dev; | 121 | struct device dev; |
112 | enum port_dev_state dev_state; | 122 | enum port_dev_state dev_state; |
@@ -181,6 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
181 | * @id_table: pointer to a list of usb_device_id structures that define all | 191 | * @id_table: pointer to a list of usb_device_id structures that define all |
182 | * of the devices this structure can support. | 192 | * of the devices this structure can support. |
183 | * @num_ports: the number of different ports this device will have. | 193 | * @num_ports: the number of different ports this device will have. |
194 | * @bulk_in_size: bytes to allocate for bulk-in buffer (0 = end-point size) | ||
195 | * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) | ||
184 | * @calc_num_ports: pointer to a function to determine how many ports this | 196 | * @calc_num_ports: pointer to a function to determine how many ports this |
185 | * device has dynamically. It will be called after the probe() | 197 | * device has dynamically. It will be called after the probe() |
186 | * callback is called, but before attach() | 198 | * callback is called, but before attach() |
@@ -223,7 +235,9 @@ struct usb_serial_driver { | |||
223 | struct device_driver driver; | 235 | struct device_driver driver; |
224 | struct usb_driver *usb_driver; | 236 | struct usb_driver *usb_driver; |
225 | struct usb_dynids dynids; | 237 | struct usb_dynids dynids; |
226 | int max_in_flight_urbs; | 238 | |
239 | size_t bulk_in_size; | ||
240 | size_t bulk_out_size; | ||
227 | 241 | ||
228 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); | 242 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); |
229 | int (*attach)(struct usb_serial *serial); | 243 | int (*attach)(struct usb_serial *serial); |
@@ -269,6 +283,11 @@ struct usb_serial_driver { | |||
269 | void (*write_int_callback)(struct urb *urb); | 283 | void (*write_int_callback)(struct urb *urb); |
270 | void (*read_bulk_callback)(struct urb *urb); | 284 | void (*read_bulk_callback)(struct urb *urb); |
271 | void (*write_bulk_callback)(struct urb *urb); | 285 | void (*write_bulk_callback)(struct urb *urb); |
286 | /* Called by the generic read bulk callback */ | ||
287 | void (*process_read_urb)(struct urb *urb); | ||
288 | /* Called by the generic write implementation */ | ||
289 | int (*prepare_write_buffer)(struct usb_serial_port *port, | ||
290 | void *dest, size_t size); | ||
272 | }; | 291 | }; |
273 | #define to_usb_serial_driver(d) \ | 292 | #define to_usb_serial_driver(d) \ |
274 | container_of(d, struct usb_serial_driver, driver) | 293 | container_of(d, struct usb_serial_driver, driver) |
@@ -318,8 +337,11 @@ extern void usb_serial_generic_disconnect(struct usb_serial *serial); | |||
318 | extern void usb_serial_generic_release(struct usb_serial *serial); | 337 | extern void usb_serial_generic_release(struct usb_serial *serial); |
319 | extern int usb_serial_generic_register(int debug); | 338 | extern int usb_serial_generic_register(int debug); |
320 | extern void usb_serial_generic_deregister(void); | 339 | extern void usb_serial_generic_deregister(void); |
321 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, | 340 | extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, |
322 | gfp_t mem_flags); | 341 | gfp_t mem_flags); |
342 | extern void usb_serial_generic_process_read_urb(struct urb *urb); | ||
343 | extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, | ||
344 | void *dest, size_t size); | ||
323 | extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, | 345 | extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, |
324 | struct usb_serial_port *port, | 346 | struct usb_serial_port *port, |
325 | unsigned int ch); | 347 | unsigned int ch); |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 20675c6ebc4d..2369d07c3c87 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -1,6 +1,146 @@ | |||
1 | /* | ||
2 | * ulpi.h -- ULPI defines and function prorotypes | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation | ||
5 | * | ||
6 | * This software is distributed under the terms of the GNU General | ||
7 | * Public License ("GPL") as published by the Free Software Foundation, | ||
8 | * version 2 of that License. | ||
9 | */ | ||
10 | |||
1 | #ifndef __LINUX_USB_ULPI_H | 11 | #ifndef __LINUX_USB_ULPI_H |
2 | #define __LINUX_USB_ULPI_H | 12 | #define __LINUX_USB_ULPI_H |
3 | 13 | ||
14 | /*-------------------------------------------------------------------------*/ | ||
15 | |||
16 | /* | ||
17 | * Macros for Set and Clear | ||
18 | * See ULPI 1.1 specification to find the registers with Set and Clear offsets | ||
19 | */ | ||
20 | #define ULPI_SET(a) (a + 1) | ||
21 | #define ULPI_CLR(a) (a + 2) | ||
22 | |||
23 | /*-------------------------------------------------------------------------*/ | ||
24 | |||
25 | /* | ||
26 | * Register Map | ||
27 | */ | ||
28 | #define ULPI_VENDOR_ID_LOW 0x00 | ||
29 | #define ULPI_VENDOR_ID_HIGH 0x01 | ||
30 | #define ULPI_PRODUCT_ID_LOW 0x02 | ||
31 | #define ULPI_PRODUCT_ID_HIGH 0x03 | ||
32 | #define ULPI_FUNC_CTRL 0x04 | ||
33 | #define ULPI_IFC_CTRL 0x07 | ||
34 | #define ULPI_OTG_CTRL 0x0a | ||
35 | #define ULPI_USB_INT_EN_RISE 0x0d | ||
36 | #define ULPI_USB_INT_EN_FALL 0x10 | ||
37 | #define ULPI_USB_INT_STS 0x13 | ||
38 | #define ULPI_USB_INT_LATCH 0x14 | ||
39 | #define ULPI_DEBUG 0x15 | ||
40 | #define ULPI_SCRATCH 0x16 | ||
41 | /* Optional Carkit Registers */ | ||
42 | #define ULPI_CARCIT_CTRL 0x19 | ||
43 | #define ULPI_CARCIT_INT_DELAY 0x1c | ||
44 | #define ULPI_CARCIT_INT_EN 0x1d | ||
45 | #define ULPI_CARCIT_INT_STS 0x20 | ||
46 | #define ULPI_CARCIT_INT_LATCH 0x21 | ||
47 | #define ULPI_CARCIT_PLS_CTRL 0x22 | ||
48 | /* Other Optional Registers */ | ||
49 | #define ULPI_TX_POS_WIDTH 0x25 | ||
50 | #define ULPI_TX_NEG_WIDTH 0x26 | ||
51 | #define ULPI_POLARITY_RECOVERY 0x27 | ||
52 | /* Access Extended Register Set */ | ||
53 | #define ULPI_ACCESS_EXTENDED 0x2f | ||
54 | /* Vendor Specific */ | ||
55 | #define ULPI_VENDOR_SPECIFIC 0x30 | ||
56 | /* Extended Registers */ | ||
57 | #define ULPI_EXT_VENDOR_SPECIFIC 0x80 | ||
58 | |||
59 | /*-------------------------------------------------------------------------*/ | ||
60 | |||
61 | /* Function Control */ | ||
62 | #define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) | ||
63 | #define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) | ||
64 | #define ULPI_FUNC_CTRL_HIGH_SPEED (0 << 0) | ||
65 | #define ULPI_FUNC_CTRL_FULL_SPEED (1 << 0) | ||
66 | #define ULPI_FUNC_CTRL_LOW_SPEED (2 << 0) | ||
67 | #define ULPI_FUNC_CTRL_FS4LS (3 << 0) | ||
68 | #define ULPI_FUNC_CTRL_TERMSELECT (1 << 2) | ||
69 | #define ULPI_FUNC_CTRL_OPMODE (1 << 3) | ||
70 | #define ULPI_FUNC_CTRL_OPMODE_MASK (3 << 3) | ||
71 | #define ULPI_FUNC_CTRL_OPMODE_NORMAL (0 << 3) | ||
72 | #define ULPI_FUNC_CTRL_OPMODE_NONDRIVING (1 << 3) | ||
73 | #define ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI (2 << 3) | ||
74 | #define ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP (3 << 3) | ||
75 | #define ULPI_FUNC_CTRL_RESET (1 << 5) | ||
76 | #define ULPI_FUNC_CTRL_SUSPENDM (1 << 6) | ||
77 | |||
78 | /* Interface Control */ | ||
79 | #define ULPI_IFC_CTRL_6_PIN_SERIAL_MODE (1 << 0) | ||
80 | #define ULPI_IFC_CTRL_3_PIN_SERIAL_MODE (1 << 1) | ||
81 | #define ULPI_IFC_CTRL_CARKITMODE (1 << 2) | ||
82 | #define ULPI_IFC_CTRL_CLOCKSUSPENDM (1 << 3) | ||
83 | #define ULPI_IFC_CTRL_AUTORESUME (1 << 4) | ||
84 | #define ULPI_IFC_CTRL_EXTERNAL_VBUS (1 << 5) | ||
85 | #define ULPI_IFC_CTRL_PASSTHRU (1 << 6) | ||
86 | #define ULPI_IFC_CTRL_PROTECT_IFC_DISABLE (1 << 7) | ||
87 | |||
88 | /* OTG Control */ | ||
89 | #define ULPI_OTG_CTRL_ID_PULLUP (1 << 0) | ||
90 | #define ULPI_OTG_CTRL_DP_PULLDOWN (1 << 1) | ||
91 | #define ULPI_OTG_CTRL_DM_PULLDOWN (1 << 2) | ||
92 | #define ULPI_OTG_CTRL_DISCHRGVBUS (1 << 3) | ||
93 | #define ULPI_OTG_CTRL_CHRGVBUS (1 << 4) | ||
94 | #define ULPI_OTG_CTRL_DRVVBUS (1 << 5) | ||
95 | #define ULPI_OTG_CTRL_DRVVBUS_EXT (1 << 6) | ||
96 | #define ULPI_OTG_CTRL_EXTVBUSIND (1 << 7) | ||
97 | |||
98 | /* USB Interrupt Enable Rising, | ||
99 | * USB Interrupt Enable Falling, | ||
100 | * USB Interrupt Status and | ||
101 | * USB Interrupt Latch | ||
102 | */ | ||
103 | #define ULPI_INT_HOST_DISCONNECT (1 << 0) | ||
104 | #define ULPI_INT_VBUS_VALID (1 << 1) | ||
105 | #define ULPI_INT_SESS_VALID (1 << 2) | ||
106 | #define ULPI_INT_SESS_END (1 << 3) | ||
107 | #define ULPI_INT_IDGRD (1 << 4) | ||
108 | |||
109 | /* Debug */ | ||
110 | #define ULPI_DEBUG_LINESTATE0 (1 << 0) | ||
111 | #define ULPI_DEBUG_LINESTATE1 (1 << 1) | ||
112 | |||
113 | /* Carkit Control */ | ||
114 | #define ULPI_CARKIT_CTRL_CARKITPWR (1 << 0) | ||
115 | #define ULPI_CARKIT_CTRL_IDGNDDRV (1 << 1) | ||
116 | #define ULPI_CARKIT_CTRL_TXDEN (1 << 2) | ||
117 | #define ULPI_CARKIT_CTRL_RXDEN (1 << 3) | ||
118 | #define ULPI_CARKIT_CTRL_SPKLEFTEN (1 << 4) | ||
119 | #define ULPI_CARKIT_CTRL_SPKRIGHTEN (1 << 5) | ||
120 | #define ULPI_CARKIT_CTRL_MICEN (1 << 6) | ||
121 | |||
122 | /* Carkit Interrupt Enable */ | ||
123 | #define ULPI_CARKIT_INT_EN_IDFLOAT_RISE (1 << 0) | ||
124 | #define ULPI_CARKIT_INT_EN_IDFLOAT_FALL (1 << 1) | ||
125 | #define ULPI_CARKIT_INT_EN_CARINTDET (1 << 2) | ||
126 | #define ULPI_CARKIT_INT_EN_DP_RISE (1 << 3) | ||
127 | #define ULPI_CARKIT_INT_EN_DP_FALL (1 << 4) | ||
128 | |||
129 | /* Carkit Interrupt Status and | ||
130 | * Carkit Interrupt Latch | ||
131 | */ | ||
132 | #define ULPI_CARKIT_INT_IDFLOAT (1 << 0) | ||
133 | #define ULPI_CARKIT_INT_CARINTDET (1 << 1) | ||
134 | #define ULPI_CARKIT_INT_DP (1 << 2) | ||
135 | |||
136 | /* Carkit Pulse Control*/ | ||
137 | #define ULPI_CARKIT_PLS_CTRL_TXPLSEN (1 << 0) | ||
138 | #define ULPI_CARKIT_PLS_CTRL_RXPLSEN (1 << 1) | ||
139 | #define ULPI_CARKIT_PLS_CTRL_SPKRLEFT_BIASEN (1 << 2) | ||
140 | #define ULPI_CARKIT_PLS_CTRL_SPKRRIGHT_BIASEN (1 << 3) | ||
141 | |||
142 | /*-------------------------------------------------------------------------*/ | ||
143 | |||
4 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | 144 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, |
5 | unsigned int flags); | 145 | unsigned int flags); |
6 | 146 | ||
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index df1e83dd9a54..7ae27a473818 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -43,7 +43,7 @@ struct usbnet { | |||
43 | /* protocol/interface state */ | 43 | /* protocol/interface state */ |
44 | struct net_device *net; | 44 | struct net_device *net; |
45 | int msg_enable; | 45 | int msg_enable; |
46 | unsigned long data [5]; | 46 | unsigned long data[5]; |
47 | u32 xid; | 47 | u32 xid; |
48 | u32 hard_mtu; /* count any extra framing */ | 48 | u32 hard_mtu; /* count any extra framing */ |
49 | size_t rx_urb_size; /* size for rx urbs */ | 49 | size_t rx_urb_size; /* size for rx urbs */ |
@@ -148,8 +148,8 @@ struct driver_info { | |||
148 | * much everything except custom framing and chip-specific stuff. | 148 | * much everything except custom framing and chip-specific stuff. |
149 | */ | 149 | */ |
150 | extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); | 150 | extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); |
151 | extern int usbnet_suspend (struct usb_interface *, pm_message_t ); | 151 | extern int usbnet_suspend(struct usb_interface *, pm_message_t); |
152 | extern int usbnet_resume (struct usb_interface *); | 152 | extern int usbnet_resume(struct usb_interface *); |
153 | extern void usbnet_disconnect(struct usb_interface *); | 153 | extern void usbnet_disconnect(struct usb_interface *); |
154 | 154 | ||
155 | 155 | ||
@@ -165,8 +165,8 @@ struct cdc_state { | |||
165 | struct usb_interface *data; | 165 | struct usb_interface *data; |
166 | }; | 166 | }; |
167 | 167 | ||
168 | extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *); | 168 | extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); |
169 | extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *); | 169 | extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); |
170 | 170 | ||
171 | /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ | 171 | /* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ |
172 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ | 172 | #define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ |
@@ -189,29 +189,31 @@ struct skb_data { /* skb->cb is one of these */ | |||
189 | size_t length; | 189 | size_t length; |
190 | }; | 190 | }; |
191 | 191 | ||
192 | extern int usbnet_open (struct net_device *net); | 192 | extern int usbnet_open(struct net_device *net); |
193 | extern int usbnet_stop (struct net_device *net); | 193 | extern int usbnet_stop(struct net_device *net); |
194 | extern netdev_tx_t usbnet_start_xmit (struct sk_buff *skb, | 194 | extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, |
195 | struct net_device *net); | 195 | struct net_device *net); |
196 | extern void usbnet_tx_timeout (struct net_device *net); | 196 | extern void usbnet_tx_timeout(struct net_device *net); |
197 | extern int usbnet_change_mtu (struct net_device *net, int new_mtu); | 197 | extern int usbnet_change_mtu(struct net_device *net, int new_mtu); |
198 | 198 | ||
199 | extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); | 199 | extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); |
200 | extern int usbnet_get_ethernet_addr(struct usbnet *, int); | 200 | extern int usbnet_get_ethernet_addr(struct usbnet *, int); |
201 | extern void usbnet_defer_kevent (struct usbnet *, int); | 201 | extern void usbnet_defer_kevent(struct usbnet *, int); |
202 | extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); | 202 | extern void usbnet_skb_return(struct usbnet *, struct sk_buff *); |
203 | extern void usbnet_unlink_rx_urbs(struct usbnet *); | 203 | extern void usbnet_unlink_rx_urbs(struct usbnet *); |
204 | 204 | ||
205 | extern void usbnet_pause_rx(struct usbnet *); | 205 | extern void usbnet_pause_rx(struct usbnet *); |
206 | extern void usbnet_resume_rx(struct usbnet *); | 206 | extern void usbnet_resume_rx(struct usbnet *); |
207 | extern void usbnet_purge_paused_rxq(struct usbnet *); | 207 | extern void usbnet_purge_paused_rxq(struct usbnet *); |
208 | 208 | ||
209 | extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd); | 209 | extern int usbnet_get_settings(struct net_device *net, |
210 | extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd); | 210 | struct ethtool_cmd *cmd); |
211 | extern u32 usbnet_get_link (struct net_device *net); | 211 | extern int usbnet_set_settings(struct net_device *net, |
212 | extern u32 usbnet_get_msglevel (struct net_device *); | 212 | struct ethtool_cmd *cmd); |
213 | extern void usbnet_set_msglevel (struct net_device *, u32); | 213 | extern u32 usbnet_get_link(struct net_device *net); |
214 | extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); | 214 | extern u32 usbnet_get_msglevel(struct net_device *); |
215 | extern void usbnet_set_msglevel(struct net_device *, u32); | ||
216 | extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); | ||
215 | extern int usbnet_nway_reset(struct net_device *net); | 217 | extern int usbnet_nway_reset(struct net_device *net); |
216 | 218 | ||
217 | #endif /* __LINUX_USB_USBNET_H */ | 219 | #endif /* __LINUX_USB_USBNET_H */ |
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h index fb7c359bdfba..f9dec37f617b 100644 --- a/include/linux/usb/wusb-wa.h +++ b/include/linux/usb/wusb-wa.h | |||
@@ -87,7 +87,7 @@ enum rpipe_crs { | |||
87 | * FIXME: explain rpipes | 87 | * FIXME: explain rpipes |
88 | */ | 88 | */ |
89 | struct usb_rpipe_descriptor { | 89 | struct usb_rpipe_descriptor { |
90 | u8 bLength; | 90 | u8 bLength; |
91 | u8 bDescriptorType; | 91 | u8 bDescriptorType; |
92 | __le16 wRPipeIndex; | 92 | __le16 wRPipeIndex; |
93 | __le16 wRequests; | 93 | __le16 wRequests; |
diff --git a/include/linux/wait.h b/include/linux/wait.h index 76d96d035ea0..0836ccc57121 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h | |||
@@ -376,6 +376,155 @@ do { \ | |||
376 | __ret; \ | 376 | __ret; \ |
377 | }) | 377 | }) |
378 | 378 | ||
379 | |||
380 | #define __wait_event_interruptible_locked(wq, condition, exclusive, irq) \ | ||
381 | ({ \ | ||
382 | int __ret = 0; \ | ||
383 | DEFINE_WAIT(__wait); \ | ||
384 | if (exclusive) \ | ||
385 | __wait.flags |= WQ_FLAG_EXCLUSIVE; \ | ||
386 | do { \ | ||
387 | if (likely(list_empty(&__wait.task_list))) \ | ||
388 | __add_wait_queue_tail(&(wq), &__wait); \ | ||
389 | set_current_state(TASK_INTERRUPTIBLE); \ | ||
390 | if (signal_pending(current)) { \ | ||
391 | __ret = -ERESTARTSYS; \ | ||
392 | break; \ | ||
393 | } \ | ||
394 | if (irq) \ | ||
395 | spin_unlock_irq(&(wq).lock); \ | ||
396 | else \ | ||
397 | spin_unlock(&(wq).lock); \ | ||
398 | schedule(); \ | ||
399 | if (irq) \ | ||
400 | spin_lock_irq(&(wq).lock); \ | ||
401 | else \ | ||
402 | spin_lock(&(wq).lock); \ | ||
403 | } while (!(condition)); \ | ||
404 | __remove_wait_queue(&(wq), &__wait); \ | ||
405 | __set_current_state(TASK_RUNNING); \ | ||
406 | __ret; \ | ||
407 | }) | ||
408 | |||
409 | |||
410 | /** | ||
411 | * wait_event_interruptible_locked - sleep until a condition gets true | ||
412 | * @wq: the waitqueue to wait on | ||
413 | * @condition: a C expression for the event to wait for | ||
414 | * | ||
415 | * The process is put to sleep (TASK_INTERRUPTIBLE) until the | ||
416 | * @condition evaluates to true or a signal is received. | ||
417 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
418 | * | ||
419 | * It must be called with wq.lock being held. This spinlock is | ||
420 | * unlocked while sleeping but @condition testing is done while lock | ||
421 | * is held and when this macro exits the lock is held. | ||
422 | * | ||
423 | * The lock is locked/unlocked using spin_lock()/spin_unlock() | ||
424 | * functions which must match the way they are locked/unlocked outside | ||
425 | * of this macro. | ||
426 | * | ||
427 | * wake_up_locked() has to be called after changing any variable that could | ||
428 | * change the result of the wait condition. | ||
429 | * | ||
430 | * The function will return -ERESTARTSYS if it was interrupted by a | ||
431 | * signal and 0 if @condition evaluated to true. | ||
432 | */ | ||
433 | #define wait_event_interruptible_locked(wq, condition) \ | ||
434 | ((condition) \ | ||
435 | ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 0)) | ||
436 | |||
437 | /** | ||
438 | * wait_event_interruptible_locked_irq - sleep until a condition gets true | ||
439 | * @wq: the waitqueue to wait on | ||
440 | * @condition: a C expression for the event to wait for | ||
441 | * | ||
442 | * The process is put to sleep (TASK_INTERRUPTIBLE) until the | ||
443 | * @condition evaluates to true or a signal is received. | ||
444 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
445 | * | ||
446 | * It must be called with wq.lock being held. This spinlock is | ||
447 | * unlocked while sleeping but @condition testing is done while lock | ||
448 | * is held and when this macro exits the lock is held. | ||
449 | * | ||
450 | * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq() | ||
451 | * functions which must match the way they are locked/unlocked outside | ||
452 | * of this macro. | ||
453 | * | ||
454 | * wake_up_locked() has to be called after changing any variable that could | ||
455 | * change the result of the wait condition. | ||
456 | * | ||
457 | * The function will return -ERESTARTSYS if it was interrupted by a | ||
458 | * signal and 0 if @condition evaluated to true. | ||
459 | */ | ||
460 | #define wait_event_interruptible_locked_irq(wq, condition) \ | ||
461 | ((condition) \ | ||
462 | ? 0 : __wait_event_interruptible_locked(wq, condition, 0, 1)) | ||
463 | |||
464 | /** | ||
465 | * wait_event_interruptible_exclusive_locked - sleep exclusively until a condition gets true | ||
466 | * @wq: the waitqueue to wait on | ||
467 | * @condition: a C expression for the event to wait for | ||
468 | * | ||
469 | * The process is put to sleep (TASK_INTERRUPTIBLE) until the | ||
470 | * @condition evaluates to true or a signal is received. | ||
471 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
472 | * | ||
473 | * It must be called with wq.lock being held. This spinlock is | ||
474 | * unlocked while sleeping but @condition testing is done while lock | ||
475 | * is held and when this macro exits the lock is held. | ||
476 | * | ||
477 | * The lock is locked/unlocked using spin_lock()/spin_unlock() | ||
478 | * functions which must match the way they are locked/unlocked outside | ||
479 | * of this macro. | ||
480 | * | ||
481 | * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag | ||
482 | * set thus when other process waits process on the list if this | ||
483 | * process is awaken further processes are not considered. | ||
484 | * | ||
485 | * wake_up_locked() has to be called after changing any variable that could | ||
486 | * change the result of the wait condition. | ||
487 | * | ||
488 | * The function will return -ERESTARTSYS if it was interrupted by a | ||
489 | * signal and 0 if @condition evaluated to true. | ||
490 | */ | ||
491 | #define wait_event_interruptible_exclusive_locked(wq, condition) \ | ||
492 | ((condition) \ | ||
493 | ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 0)) | ||
494 | |||
495 | /** | ||
496 | * wait_event_interruptible_exclusive_locked_irq - sleep until a condition gets true | ||
497 | * @wq: the waitqueue to wait on | ||
498 | * @condition: a C expression for the event to wait for | ||
499 | * | ||
500 | * The process is put to sleep (TASK_INTERRUPTIBLE) until the | ||
501 | * @condition evaluates to true or a signal is received. | ||
502 | * The @condition is checked each time the waitqueue @wq is woken up. | ||
503 | * | ||
504 | * It must be called with wq.lock being held. This spinlock is | ||
505 | * unlocked while sleeping but @condition testing is done while lock | ||
506 | * is held and when this macro exits the lock is held. | ||
507 | * | ||
508 | * The lock is locked/unlocked using spin_lock_irq()/spin_unlock_irq() | ||
509 | * functions which must match the way they are locked/unlocked outside | ||
510 | * of this macro. | ||
511 | * | ||
512 | * The process is put on the wait queue with an WQ_FLAG_EXCLUSIVE flag | ||
513 | * set thus when other process waits process on the list if this | ||
514 | * process is awaken further processes are not considered. | ||
515 | * | ||
516 | * wake_up_locked() has to be called after changing any variable that could | ||
517 | * change the result of the wait condition. | ||
518 | * | ||
519 | * The function will return -ERESTARTSYS if it was interrupted by a | ||
520 | * signal and 0 if @condition evaluated to true. | ||
521 | */ | ||
522 | #define wait_event_interruptible_exclusive_locked_irq(wq, condition) \ | ||
523 | ((condition) \ | ||
524 | ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) | ||
525 | |||
526 | |||
527 | |||
379 | #define __wait_event_killable(wq, condition, ret) \ | 528 | #define __wait_event_killable(wq, condition, ret) \ |
380 | do { \ | 529 | do { \ |
381 | DEFINE_WAIT(__wait); \ | 530 | DEFINE_WAIT(__wait); \ |