diff options
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/composite.h | 14 | ||||
| -rw-r--r-- | include/linux/usb/gadget.h | 31 |
2 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a3e72dfa6996..a316fba73518 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -59,6 +59,10 @@ struct usb_configuration; | |||
| 59 | * @hs_descriptors: Table of high speed descriptors, using interface and | 59 | * @hs_descriptors: Table of high speed descriptors, using interface and |
| 60 | * string identifiers assigned during @bind(). If this pointer is null, | 60 | * string identifiers assigned during @bind(). If this pointer is null, |
| 61 | * the function will not be available at high speed. | 61 | * the function will not be available at high speed. |
| 62 | * @ss_descriptors: Table of super speed descriptors, using interface and | ||
| 63 | * string identifiers assigned during @bind(). If this | ||
| 64 | * pointer is null after initiation, the function will not | ||
| 65 | * be available at super speed. | ||
| 62 | * @config: assigned when @usb_add_function() is called; this is the | 66 | * @config: assigned when @usb_add_function() is called; this is the |
| 63 | * configuration with which this function is associated. | 67 | * configuration with which this function is associated. |
| 64 | * @bind: Before the gadget can register, all of its functions bind() to the | 68 | * @bind: Before the gadget can register, all of its functions bind() to the |
| @@ -77,6 +81,10 @@ struct usb_configuration; | |||
| 77 | * @setup: Used for interface-specific control requests. | 81 | * @setup: Used for interface-specific control requests. |
| 78 | * @suspend: Notifies functions when the host stops sending USB traffic. | 82 | * @suspend: Notifies functions when the host stops sending USB traffic. |
| 79 | * @resume: Notifies functions when the host restarts USB traffic. | 83 | * @resume: Notifies functions when the host restarts USB traffic. |
| 84 | * @get_status: Returns function status as a reply to | ||
| 85 | * GetStatus() request when the recepient is Interface. | ||
| 86 | * @func_suspend: callback to be called when | ||
| 87 | * SetFeature(FUNCTION_SUSPEND) is reseived | ||
| 80 | * | 88 | * |
| 81 | * A single USB function uses one or more interfaces, and should in most | 89 | * A single USB function uses one or more interfaces, and should in most |
| 82 | * cases support operation at both full and high speeds. Each function is | 90 | * cases support operation at both full and high speeds. Each function is |
| @@ -106,6 +114,7 @@ struct usb_function { | |||
| 106 | struct usb_gadget_strings **strings; | 114 | struct usb_gadget_strings **strings; |
| 107 | struct usb_descriptor_header **descriptors; | 115 | struct usb_descriptor_header **descriptors; |
| 108 | struct usb_descriptor_header **hs_descriptors; | 116 | struct usb_descriptor_header **hs_descriptors; |
| 117 | struct usb_descriptor_header **ss_descriptors; | ||
| 109 | 118 | ||
| 110 | struct usb_configuration *config; | 119 | struct usb_configuration *config; |
| 111 | 120 | ||
| @@ -132,6 +141,10 @@ struct usb_function { | |||
| 132 | void (*suspend)(struct usb_function *); | 141 | void (*suspend)(struct usb_function *); |
| 133 | void (*resume)(struct usb_function *); | 142 | void (*resume)(struct usb_function *); |
| 134 | 143 | ||
| 144 | /* USB 3.0 additions */ | ||
| 145 | int (*get_status)(struct usb_function *); | ||
| 146 | int (*func_suspend)(struct usb_function *, | ||
| 147 | u8 suspend_opt); | ||
| 135 | /* private: */ | 148 | /* private: */ |
| 136 | /* internals */ | 149 | /* internals */ |
| 137 | struct list_head list; | 150 | struct list_head list; |
| @@ -219,6 +232,7 @@ struct usb_configuration { | |||
| 219 | struct list_head list; | 232 | struct list_head list; |
| 220 | struct list_head functions; | 233 | struct list_head functions; |
| 221 | u8 next_interface_id; | 234 | u8 next_interface_id; |
| 235 | unsigned superspeed:1; | ||
| 222 | unsigned highspeed:1; | 236 | unsigned highspeed:1; |
| 223 | unsigned fullspeed:1; | 237 | unsigned fullspeed:1; |
| 224 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; | 238 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 625971292c20..e22ce7e5a444 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -136,6 +136,8 @@ struct usb_ep_ops { | |||
| 136 | * the endpoint descriptor used to configure the endpoint. | 136 | * the endpoint descriptor used to configure the endpoint. |
| 137 | * @max_streams: The maximum number of streams supported | 137 | * @max_streams: The maximum number of streams supported |
| 138 | * by this EP (0 - 16, actual number is 2^n) | 138 | * by this EP (0 - 16, actual number is 2^n) |
| 139 | * @mult: multiplier, 'mult' value for SS Isoc EPs | ||
| 140 | * @maxburst: the maximum number of bursts supported by this EP (for usb3) | ||
| 139 | * @driver_data:for use by the gadget driver. | 141 | * @driver_data:for use by the gadget driver. |
| 140 | * @address: used to identify the endpoint when finding descriptor that | 142 | * @address: used to identify the endpoint when finding descriptor that |
| 141 | * matches connection speed | 143 | * matches connection speed |
| @@ -156,6 +158,8 @@ struct usb_ep { | |||
| 156 | struct list_head ep_list; | 158 | struct list_head ep_list; |
| 157 | unsigned maxpacket:16; | 159 | unsigned maxpacket:16; |
| 158 | unsigned max_streams:16; | 160 | unsigned max_streams:16; |
| 161 | unsigned mult:2; | ||
| 162 | unsigned maxburst:4; | ||
| 159 | u8 address; | 163 | u8 address; |
| 160 | const struct usb_endpoint_descriptor *desc; | 164 | const struct usb_endpoint_descriptor *desc; |
| 161 | const struct usb_ss_ep_comp_descriptor *comp_desc; | 165 | const struct usb_ss_ep_comp_descriptor *comp_desc; |
| @@ -426,6 +430,14 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep) | |||
| 426 | 430 | ||
| 427 | /*-------------------------------------------------------------------------*/ | 431 | /*-------------------------------------------------------------------------*/ |
| 428 | 432 | ||
| 433 | struct usb_dcd_config_params { | ||
| 434 | __u8 bU1devExitLat; /* U1 Device exit Latency */ | ||
| 435 | #define USB_DEFULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */ | ||
| 436 | __le16 bU2DevExitLat; /* U2 Device exit Latency */ | ||
| 437 | #define USB_DEFULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */ | ||
| 438 | }; | ||
| 439 | |||
| 440 | |||
| 429 | struct usb_gadget; | 441 | struct usb_gadget; |
| 430 | struct usb_gadget_driver; | 442 | struct usb_gadget_driver; |
| 431 | 443 | ||
| @@ -441,6 +453,7 @@ struct usb_gadget_ops { | |||
| 441 | int (*pullup) (struct usb_gadget *, int is_on); | 453 | int (*pullup) (struct usb_gadget *, int is_on); |
| 442 | int (*ioctl)(struct usb_gadget *, | 454 | int (*ioctl)(struct usb_gadget *, |
| 443 | unsigned code, unsigned long param); | 455 | unsigned code, unsigned long param); |
| 456 | void (*get_config_params)(struct usb_dcd_config_params *); | ||
| 444 | int (*start)(struct usb_gadget_driver *, | 457 | int (*start)(struct usb_gadget_driver *, |
| 445 | int (*bind)(struct usb_gadget *)); | 458 | int (*bind)(struct usb_gadget *)); |
| 446 | int (*stop)(struct usb_gadget_driver *); | 459 | int (*stop)(struct usb_gadget_driver *); |
| @@ -535,6 +548,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g) | |||
| 535 | } | 548 | } |
| 536 | 549 | ||
| 537 | /** | 550 | /** |
| 551 | * gadget_is_superspeed() - return true if the hardware handles | ||
| 552 | * supperspeed | ||
| 553 | * @g: controller that might support supper speed | ||
| 554 | */ | ||
| 555 | static inline int gadget_is_superspeed(struct usb_gadget *g) | ||
| 556 | { | ||
| 557 | #ifdef CONFIG_USB_GADGET_SUPERSPEED | ||
| 558 | /* | ||
| 559 | * runtime test would check "g->is_superspeed" ... that might be | ||
| 560 | * useful to work around hardware bugs, but is mostly pointless | ||
| 561 | */ | ||
| 562 | return 1; | ||
| 563 | #else | ||
| 564 | return 0; | ||
| 565 | #endif | ||
| 566 | } | ||
| 567 | |||
| 568 | /** | ||
| 538 | * gadget_is_otg - return true iff the hardware is OTG-ready | 569 | * gadget_is_otg - return true iff the hardware is OTG-ready |
| 539 | * @g: controller that might have a Mini-AB connector | 570 | * @g: controller that might have a Mini-AB connector |
| 540 | * | 571 | * |
