diff options
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/ch9.h | 20 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 35 | ||||
-rw-r--r-- | include/linux/usb/f_accessory.h | 83 | ||||
-rw-r--r-- | include/linux/usb/f_mtp.h | 75 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 88 | ||||
-rw-r--r-- | include/linux/usb/hcd.h | 2 | ||||
-rw-r--r-- | include/linux/usb/m66592.h | 2 | ||||
-rw-r--r-- | include/linux/usb/otg_id.h | 58 | ||||
-rw-r--r-- | include/linux/usb/r8a66597.h | 8 | ||||
-rw-r--r-- | include/linux/usb/renesas_usbhs.h | 17 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 3 |
11 files changed, 358 insertions, 33 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 0fd3fbdd828..cf65b5cff72 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -583,8 +583,26 @@ struct usb_ss_ep_comp_descriptor { | |||
583 | } __attribute__ ((packed)); | 583 | } __attribute__ ((packed)); |
584 | 584 | ||
585 | #define USB_DT_SS_EP_COMP_SIZE 6 | 585 | #define USB_DT_SS_EP_COMP_SIZE 6 |
586 | |||
586 | /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ | 587 | /* Bits 4:0 of bmAttributes if this is a bulk endpoint */ |
587 | #define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f)) | 588 | static inline int |
589 | usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp) | ||
590 | { | ||
591 | int max_streams; | ||
592 | |||
593 | if (!comp) | ||
594 | return 0; | ||
595 | |||
596 | max_streams = comp->bmAttributes & 0x1f; | ||
597 | |||
598 | if (!max_streams) | ||
599 | return 0; | ||
600 | |||
601 | max_streams = 1 << max_streams; | ||
602 | |||
603 | return max_streams; | ||
604 | } | ||
605 | |||
588 | /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ | 606 | /* Bits 1:0 of bmAttributes if this is an isoc endpoint */ |
589 | #define USB_SS_MULT(p) (1 + ((p) & 0x3)) | 607 | #define USB_SS_MULT(p) (1 + ((p) & 0x3)) |
590 | 608 | ||
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index b78cba466d3..6938a8608cf 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; |
@@ -145,20 +158,8 @@ int usb_function_activate(struct usb_function *); | |||
145 | 158 | ||
146 | int usb_interface_id(struct usb_configuration *, struct usb_function *); | 159 | int usb_interface_id(struct usb_configuration *, struct usb_function *); |
147 | 160 | ||
148 | /** | 161 | int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f, |
149 | * ep_choose - select descriptor endpoint at current device speed | 162 | struct usb_ep *_ep); |
150 | * @g: gadget, connected and running at some speed | ||
151 | * @hs: descriptor to use for high speed operation | ||
152 | * @fs: descriptor to use for full or low speed operation | ||
153 | */ | ||
154 | static inline struct usb_endpoint_descriptor * | ||
155 | ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, | ||
156 | struct usb_endpoint_descriptor *fs) | ||
157 | { | ||
158 | if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) | ||
159 | return hs; | ||
160 | return fs; | ||
161 | } | ||
162 | 163 | ||
163 | #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ | 164 | #define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */ |
164 | 165 | ||
@@ -231,6 +232,7 @@ struct usb_configuration { | |||
231 | struct list_head list; | 232 | struct list_head list; |
232 | struct list_head functions; | 233 | struct list_head functions; |
233 | u8 next_interface_id; | 234 | u8 next_interface_id; |
235 | unsigned superspeed:1; | ||
234 | unsigned highspeed:1; | 236 | unsigned highspeed:1; |
235 | unsigned fullspeed:1; | 237 | unsigned fullspeed:1; |
236 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; | 238 | struct usb_function *interface[MAX_CONFIG_INTERFACES]; |
@@ -240,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *, | |||
240 | struct usb_configuration *, | 242 | struct usb_configuration *, |
241 | int (*)(struct usb_configuration *)); | 243 | int (*)(struct usb_configuration *)); |
242 | 244 | ||
245 | int usb_remove_config(struct usb_composite_dev *, | ||
246 | struct usb_configuration *); | ||
247 | |||
243 | /** | 248 | /** |
244 | * struct usb_composite_driver - groups configurations into a gadget | 249 | * struct usb_composite_driver - groups configurations into a gadget |
245 | * @name: For diagnostics, identifies the driver. | 250 | * @name: For diagnostics, identifies the driver. |
@@ -252,6 +257,7 @@ int usb_add_config(struct usb_composite_dev *, | |||
252 | * identifiers. | 257 | * identifiers. |
253 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 258 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
254 | * and language IDs provided in control requests | 259 | * and language IDs provided in control requests |
260 | * @max_speed: Highest speed the driver supports. | ||
255 | * @needs_serial: set to 1 if the gadget needs userspace to provide | 261 | * @needs_serial: set to 1 if the gadget needs userspace to provide |
256 | * a serial number. If one is not provided, warning will be printed. | 262 | * a serial number. If one is not provided, warning will be printed. |
257 | * @unbind: Reverses bind; called as a side effect of unregistering | 263 | * @unbind: Reverses bind; called as a side effect of unregistering |
@@ -279,6 +285,7 @@ struct usb_composite_driver { | |||
279 | const char *iManufacturer; | 285 | const char *iManufacturer; |
280 | const struct usb_device_descriptor *dev; | 286 | const struct usb_device_descriptor *dev; |
281 | struct usb_gadget_strings **strings; | 287 | struct usb_gadget_strings **strings; |
288 | enum usb_device_speed max_speed; | ||
282 | unsigned needs_serial:1; | 289 | unsigned needs_serial:1; |
283 | 290 | ||
284 | int (*unbind)(struct usb_composite_dev *); | 291 | int (*unbind)(struct usb_composite_dev *); |
diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h new file mode 100644 index 00000000000..5b2dcf9728e --- /dev/null +++ b/include/linux/usb/f_accessory.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * Gadget Function Driver for Android USB accessories | ||
3 | * | ||
4 | * Copyright (C) 2011 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_F_ACCESSORY_H | ||
19 | #define __LINUX_USB_F_ACCESSORY_H | ||
20 | |||
21 | /* Use Google Vendor ID when in accessory mode */ | ||
22 | #define USB_ACCESSORY_VENDOR_ID 0x18D1 | ||
23 | |||
24 | |||
25 | /* Product ID to use when in accessory mode */ | ||
26 | #define USB_ACCESSORY_PRODUCT_ID 0x2D00 | ||
27 | |||
28 | /* Product ID to use when in accessory mode and adb is enabled */ | ||
29 | #define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01 | ||
30 | |||
31 | /* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */ | ||
32 | #define ACCESSORY_STRING_MANUFACTURER 0 | ||
33 | #define ACCESSORY_STRING_MODEL 1 | ||
34 | #define ACCESSORY_STRING_DESCRIPTION 2 | ||
35 | #define ACCESSORY_STRING_VERSION 3 | ||
36 | #define ACCESSORY_STRING_URI 4 | ||
37 | #define ACCESSORY_STRING_SERIAL 5 | ||
38 | |||
39 | /* Control request for retrieving device's protocol version (currently 1) | ||
40 | * | ||
41 | * requestType: USB_DIR_IN | USB_TYPE_VENDOR | ||
42 | * request: ACCESSORY_GET_PROTOCOL | ||
43 | * value: 0 | ||
44 | * index: 0 | ||
45 | * data version number (16 bits little endian) | ||
46 | */ | ||
47 | #define ACCESSORY_GET_PROTOCOL 51 | ||
48 | |||
49 | /* Control request for host to send a string to the device | ||
50 | * | ||
51 | * requestType: USB_DIR_OUT | USB_TYPE_VENDOR | ||
52 | * request: ACCESSORY_SEND_STRING | ||
53 | * value: 0 | ||
54 | * index: string ID | ||
55 | * data zero terminated UTF8 string | ||
56 | * | ||
57 | * The device can later retrieve these strings via the | ||
58 | * ACCESSORY_GET_STRING_* ioctls | ||
59 | */ | ||
60 | #define ACCESSORY_SEND_STRING 52 | ||
61 | |||
62 | /* Control request for starting device in accessory mode. | ||
63 | * The host sends this after setting all its strings to the device. | ||
64 | * | ||
65 | * requestType: USB_DIR_OUT | USB_TYPE_VENDOR | ||
66 | * request: ACCESSORY_START | ||
67 | * value: 0 | ||
68 | * index: 0 | ||
69 | * data none | ||
70 | */ | ||
71 | #define ACCESSORY_START 53 | ||
72 | |||
73 | /* ioctls for retrieving strings set by the host */ | ||
74 | #define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256]) | ||
75 | #define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256]) | ||
76 | #define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256]) | ||
77 | #define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256]) | ||
78 | #define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256]) | ||
79 | #define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256]) | ||
80 | /* returns 1 if there is a start request pending */ | ||
81 | #define ACCESSORY_IS_START_REQUESTED _IO('M', 7) | ||
82 | |||
83 | #endif /* __LINUX_USB_F_ACCESSORY_H */ | ||
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h new file mode 100644 index 00000000000..7422b17c6eb --- /dev/null +++ b/include/linux/usb/f_mtp.h | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Gadget Function Driver for MTP | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Author: Mike Lockwood <lockwood@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_F_MTP_H | ||
19 | #define __LINUX_USB_F_MTP_H | ||
20 | |||
21 | #include <linux/ioctl.h> | ||
22 | |||
23 | #ifdef __KERNEL__ | ||
24 | |||
25 | struct mtp_data_header { | ||
26 | /* length of packet, including this header */ | ||
27 | uint32_t length; | ||
28 | /* container type (2 for data packet) */ | ||
29 | uint16_t type; | ||
30 | /* MTP command code */ | ||
31 | uint16_t command; | ||
32 | /* MTP transaction ID */ | ||
33 | uint32_t transaction_id; | ||
34 | }; | ||
35 | |||
36 | #endif /* __KERNEL__ */ | ||
37 | |||
38 | struct mtp_file_range { | ||
39 | /* file descriptor for file to transfer */ | ||
40 | int fd; | ||
41 | /* offset in file for start of transfer */ | ||
42 | loff_t offset; | ||
43 | /* number of bytes to transfer */ | ||
44 | int64_t length; | ||
45 | /* MTP command ID for data header, | ||
46 | * used only for MTP_SEND_FILE_WITH_HEADER | ||
47 | */ | ||
48 | uint16_t command; | ||
49 | /* MTP transaction ID for data header, | ||
50 | * used only for MTP_SEND_FILE_WITH_HEADER | ||
51 | */ | ||
52 | uint32_t transaction_id; | ||
53 | }; | ||
54 | |||
55 | struct mtp_event { | ||
56 | /* size of the event */ | ||
57 | size_t length; | ||
58 | /* event data to send */ | ||
59 | void *data; | ||
60 | }; | ||
61 | |||
62 | /* Sends the specified file range to the host */ | ||
63 | #define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range) | ||
64 | /* Receives data from the host and writes it to a file. | ||
65 | * The file is created if it does not exist. | ||
66 | */ | ||
67 | #define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range) | ||
68 | /* Sends an event to the host via the interrupt endpoint */ | ||
69 | #define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event) | ||
70 | /* Sends the specified file range to the host, | ||
71 | * with a 12 byte MTP data packet header at the beginning. | ||
72 | */ | ||
73 | #define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range) | ||
74 | |||
75 | #endif /* __LINUX_USB_F_MTP_H */ | ||
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index dd1571db55e..087f4b93183 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
@@ -15,7 +15,13 @@ | |||
15 | #ifndef __LINUX_USB_GADGET_H | 15 | #ifndef __LINUX_USB_GADGET_H |
16 | #define __LINUX_USB_GADGET_H | 16 | #define __LINUX_USB_GADGET_H |
17 | 17 | ||
18 | #include <linux/device.h> | ||
19 | #include <linux/errno.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/list.h> | ||
18 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/types.h> | ||
24 | #include <linux/usb/ch9.h> | ||
19 | 25 | ||
20 | struct usb_ep; | 26 | struct usb_ep; |
21 | 27 | ||
@@ -27,6 +33,7 @@ struct usb_ep; | |||
27 | * field, and the usb controller needs one, it is responsible | 33 | * field, and the usb controller needs one, it is responsible |
28 | * for mapping and unmapping the buffer. | 34 | * for mapping and unmapping the buffer. |
29 | * @length: Length of that data | 35 | * @length: Length of that data |
36 | * @stream_id: The stream id, when USB3.0 bulk streams are being used | ||
30 | * @no_interrupt: If true, hints that no completion irq is needed. | 37 | * @no_interrupt: If true, hints that no completion irq is needed. |
31 | * Helpful sometimes with deep request queues that are handled | 38 | * Helpful sometimes with deep request queues that are handled |
32 | * directly by DMA controllers. | 39 | * directly by DMA controllers. |
@@ -81,6 +88,7 @@ struct usb_request { | |||
81 | unsigned length; | 88 | unsigned length; |
82 | dma_addr_t dma; | 89 | dma_addr_t dma; |
83 | 90 | ||
91 | unsigned stream_id:16; | ||
84 | unsigned no_interrupt:1; | 92 | unsigned no_interrupt:1; |
85 | unsigned zero:1; | 93 | unsigned zero:1; |
86 | unsigned short_not_ok:1; | 94 | unsigned short_not_ok:1; |
@@ -131,8 +139,17 @@ struct usb_ep_ops { | |||
131 | * @maxpacket:The maximum packet size used on this endpoint. The initial | 139 | * @maxpacket:The maximum packet size used on this endpoint. The initial |
132 | * value can sometimes be reduced (hardware allowing), according to | 140 | * value can sometimes be reduced (hardware allowing), according to |
133 | * the endpoint descriptor used to configure the endpoint. | 141 | * the endpoint descriptor used to configure the endpoint. |
134 | * @driver_data:for use by the gadget driver. all other fields are | 142 | * @max_streams: The maximum number of streams supported |
135 | * read-only to gadget drivers. | 143 | * by this EP (0 - 16, actual number is 2^n) |
144 | * @mult: multiplier, 'mult' value for SS Isoc EPs | ||
145 | * @maxburst: the maximum number of bursts supported by this EP (for usb3) | ||
146 | * @driver_data:for use by the gadget driver. | ||
147 | * @address: used to identify the endpoint when finding descriptor that | ||
148 | * matches connection speed | ||
149 | * @desc: endpoint descriptor. This pointer is set before the endpoint is | ||
150 | * enabled and remains valid until the endpoint is disabled. | ||
151 | * @comp_desc: In case of SuperSpeed support, this is the endpoint companion | ||
152 | * descriptor that is used to configure the endpoint | ||
136 | * | 153 | * |
137 | * the bus controller driver lists all the general purpose endpoints in | 154 | * the bus controller driver lists all the general purpose endpoints in |
138 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, | 155 | * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, |
@@ -145,6 +162,12 @@ struct usb_ep { | |||
145 | const struct usb_ep_ops *ops; | 162 | const struct usb_ep_ops *ops; |
146 | struct list_head ep_list; | 163 | struct list_head ep_list; |
147 | unsigned maxpacket:16; | 164 | unsigned maxpacket:16; |
165 | unsigned max_streams:16; | ||
166 | unsigned mult:2; | ||
167 | unsigned maxburst:4; | ||
168 | u8 address; | ||
169 | const struct usb_endpoint_descriptor *desc; | ||
170 | const struct usb_ss_ep_comp_descriptor *comp_desc; | ||
148 | }; | 171 | }; |
149 | 172 | ||
150 | /*-------------------------------------------------------------------------*/ | 173 | /*-------------------------------------------------------------------------*/ |
@@ -153,11 +176,8 @@ struct usb_ep { | |||
153 | * usb_ep_enable - configure endpoint, making it usable | 176 | * usb_ep_enable - configure endpoint, making it usable |
154 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". | 177 | * @ep:the endpoint being configured. may not be the endpoint named "ep0". |
155 | * drivers discover endpoints through the ep_list of a usb_gadget. | 178 | * drivers discover endpoints through the ep_list of a usb_gadget. |
156 | * @desc:descriptor for desired behavior. caller guarantees this pointer | ||
157 | * remains valid until the endpoint is disabled; the data byte order | ||
158 | * is little-endian (usb-standard). | ||
159 | * | 179 | * |
160 | * when configurations are set, or when interface settings change, the driver | 180 | * When configurations are set, or when interface settings change, the driver |
161 | * will enable or disable the relevant endpoints. while it is enabled, an | 181 | * will enable or disable the relevant endpoints. while it is enabled, an |
162 | * endpoint may be used for i/o until the driver receives a disconnect() from | 182 | * endpoint may be used for i/o until the driver receives a disconnect() from |
163 | * the host or until the endpoint is disabled. | 183 | * the host or until the endpoint is disabled. |
@@ -172,10 +192,9 @@ struct usb_ep { | |||
172 | * | 192 | * |
173 | * returns zero, or a negative error code. | 193 | * returns zero, or a negative error code. |
174 | */ | 194 | */ |
175 | static inline int usb_ep_enable(struct usb_ep *ep, | 195 | static inline int usb_ep_enable(struct usb_ep *ep) |
176 | const struct usb_endpoint_descriptor *desc) | ||
177 | { | 196 | { |
178 | return ep->ops->enable(ep, desc); | 197 | return ep->ops->enable(ep, ep->desc); |
179 | } | 198 | } |
180 | 199 | ||
181 | /** | 200 | /** |
@@ -416,7 +435,16 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep) | |||
416 | 435 | ||
417 | /*-------------------------------------------------------------------------*/ | 436 | /*-------------------------------------------------------------------------*/ |
418 | 437 | ||
438 | struct usb_dcd_config_params { | ||
439 | __u8 bU1devExitLat; /* U1 Device exit Latency */ | ||
440 | #define USB_DEFULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */ | ||
441 | __le16 bU2DevExitLat; /* U2 Device exit Latency */ | ||
442 | #define USB_DEFULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */ | ||
443 | }; | ||
444 | |||
445 | |||
419 | struct usb_gadget; | 446 | struct usb_gadget; |
447 | struct usb_gadget_driver; | ||
420 | 448 | ||
421 | /* the rest of the api to the controller hardware: device operations, | 449 | /* the rest of the api to the controller hardware: device operations, |
422 | * which don't involve endpoints (or i/o). | 450 | * which don't involve endpoints (or i/o). |
@@ -430,6 +458,16 @@ struct usb_gadget_ops { | |||
430 | int (*pullup) (struct usb_gadget *, int is_on); | 458 | int (*pullup) (struct usb_gadget *, int is_on); |
431 | int (*ioctl)(struct usb_gadget *, | 459 | int (*ioctl)(struct usb_gadget *, |
432 | unsigned code, unsigned long param); | 460 | unsigned code, unsigned long param); |
461 | void (*get_config_params)(struct usb_dcd_config_params *); | ||
462 | int (*udc_start)(struct usb_gadget *, | ||
463 | struct usb_gadget_driver *); | ||
464 | int (*udc_stop)(struct usb_gadget *, | ||
465 | struct usb_gadget_driver *); | ||
466 | |||
467 | /* Those two are deprecated */ | ||
468 | int (*start)(struct usb_gadget_driver *, | ||
469 | int (*bind)(struct usb_gadget *)); | ||
470 | int (*stop)(struct usb_gadget_driver *); | ||
433 | }; | 471 | }; |
434 | 472 | ||
435 | /** | 473 | /** |
@@ -521,6 +559,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g) | |||
521 | } | 559 | } |
522 | 560 | ||
523 | /** | 561 | /** |
562 | * gadget_is_superspeed() - return true if the hardware handles | ||
563 | * supperspeed | ||
564 | * @g: controller that might support supper speed | ||
565 | */ | ||
566 | static inline int gadget_is_superspeed(struct usb_gadget *g) | ||
567 | { | ||
568 | #ifdef CONFIG_USB_GADGET_SUPERSPEED | ||
569 | /* | ||
570 | * runtime test would check "g->is_superspeed" ... that might be | ||
571 | * useful to work around hardware bugs, but is mostly pointless | ||
572 | */ | ||
573 | return 1; | ||
574 | #else | ||
575 | return 0; | ||
576 | #endif | ||
577 | } | ||
578 | |||
579 | /** | ||
524 | * gadget_is_otg - return true iff the hardware is OTG-ready | 580 | * gadget_is_otg - return true iff the hardware is OTG-ready |
525 | * @g: controller that might have a Mini-AB connector | 581 | * @g: controller that might have a Mini-AB connector |
526 | * | 582 | * |
@@ -821,6 +877,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
821 | */ | 877 | */ |
822 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); | 878 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); |
823 | 879 | ||
880 | extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget); | ||
881 | extern void usb_del_gadget_udc(struct usb_gadget *gadget); | ||
882 | |||
824 | /*-------------------------------------------------------------------------*/ | 883 | /*-------------------------------------------------------------------------*/ |
825 | 884 | ||
826 | /* utility to simplify dealing with string descriptors */ | 885 | /* utility to simplify dealing with string descriptors */ |
@@ -870,12 +929,6 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config, | |||
870 | struct usb_descriptor_header **usb_copy_descriptors( | 929 | struct usb_descriptor_header **usb_copy_descriptors( |
871 | struct usb_descriptor_header **); | 930 | struct usb_descriptor_header **); |
872 | 931 | ||
873 | /* return copy of endpoint descriptor given original descriptor set */ | ||
874 | struct usb_endpoint_descriptor *usb_find_endpoint( | ||
875 | struct usb_descriptor_header **src, | ||
876 | struct usb_descriptor_header **copy, | ||
877 | struct usb_endpoint_descriptor *match); | ||
878 | |||
879 | /** | 932 | /** |
880 | * usb_free_descriptors - free descriptors returned by usb_copy_descriptors() | 933 | * usb_free_descriptors - free descriptors returned by usb_copy_descriptors() |
881 | * @v: vector of descriptors | 934 | * @v: vector of descriptors |
@@ -892,6 +945,11 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v) | |||
892 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, | 945 | extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, |
893 | struct usb_endpoint_descriptor *); | 946 | struct usb_endpoint_descriptor *); |
894 | 947 | ||
948 | |||
949 | extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *, | ||
950 | struct usb_endpoint_descriptor *, | ||
951 | struct usb_ss_ep_comp_descriptor *); | ||
952 | |||
895 | extern void usb_ep_autoconfig_reset(struct usb_gadget *); | 953 | extern void usb_ep_autoconfig_reset(struct usb_gadget *); |
896 | 954 | ||
897 | #endif /* __LINUX_USB_GADGET_H */ | 955 | #endif /* __LINUX_USB_GADGET_H */ |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 0097136ba45..c0ecc5a2ef9 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -178,7 +178,7 @@ struct usb_hcd { | |||
178 | * this structure. | 178 | * this structure. |
179 | */ | 179 | */ |
180 | unsigned long hcd_priv[0] | 180 | unsigned long hcd_priv[0] |
181 | __attribute__ ((aligned(sizeof(unsigned long)))); | 181 | __attribute__ ((aligned(sizeof(s64)))); |
182 | }; | 182 | }; |
183 | 183 | ||
184 | /* 2.4 does this a bit differently ... */ | 184 | /* 2.4 does this a bit differently ... */ |
diff --git a/include/linux/usb/m66592.h b/include/linux/usb/m66592.h index cda9625e7df..a4ba31ab2fe 100644 --- a/include/linux/usb/m66592.h +++ b/include/linux/usb/m66592.h | |||
@@ -38,6 +38,8 @@ struct m66592_platdata { | |||
38 | /* (external controller only) one = 3.3V, zero = 1.5V */ | 38 | /* (external controller only) one = 3.3V, zero = 1.5V */ |
39 | unsigned vif:1; | 39 | unsigned vif:1; |
40 | 40 | ||
41 | /* (external controller only) set one = WR0_N shorted to WR1_N */ | ||
42 | unsigned wr0_shorted_to_wr1:1; | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | #endif /* __LINUX_USB_M66592_H */ | 45 | #endif /* __LINUX_USB_M66592_H */ |
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h new file mode 100644 index 00000000000..f9f5189a73b --- /dev/null +++ b/include/linux/usb/otg_id.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Google, Inc. | ||
3 | * | ||
4 | * Author: | ||
5 | * Colin Cross <ccross@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
17 | |||
18 | #ifndef __LINUX_USB_OTG_ID_H | ||
19 | #define __LINUX_USB_OTG_ID_H | ||
20 | |||
21 | #include <linux/notifier.h> | ||
22 | #include <linux/plist.h> | ||
23 | |||
24 | /** | ||
25 | * otg_id_notifier_block | ||
26 | * | ||
27 | * @priority: Order the notifications will be called in. Higher numbers | ||
28 | * get called first. | ||
29 | * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable | ||
30 | * has been identified | ||
31 | * @proxy_wait: Called during otg_id_notify if a previous handler returns | ||
32 | * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify. | ||
33 | * This is used when a handler knows what's connected but can't detect | ||
34 | * the change itself. | ||
35 | * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to | ||
36 | * release detection resources to allow a new identification to occur. | ||
37 | */ | ||
38 | |||
39 | struct otg_id_notifier_block { | ||
40 | int priority; | ||
41 | int (*detect)(struct otg_id_notifier_block *otg_id_nb); | ||
42 | int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb); | ||
43 | void (*cancel)(struct otg_id_notifier_block *otg_id_nb); | ||
44 | struct plist_node p; | ||
45 | }; | ||
46 | |||
47 | #define OTG_ID_PROXY_WAIT 2 | ||
48 | #define OTG_ID_HANDLED 1 | ||
49 | #define OTG_ID_UNHANDLED 0 | ||
50 | |||
51 | int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
52 | void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb); | ||
53 | |||
54 | void otg_id_notify(void); | ||
55 | int otg_id_suspend(void); | ||
56 | void otg_id_resume(void); | ||
57 | |||
58 | #endif /* __LINUX_USB_OTG_ID_H */ | ||
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h index 26d21673405..b6b8660d0c6 100644 --- a/include/linux/usb/r8a66597.h +++ b/include/linux/usb/r8a66597.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 2009 Renesas Solutions Corp. | 4 | * Copyright (C) 2009 Renesas Solutions Corp. |
5 | * | 5 | * |
6 | * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | 6 | * Author : Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
@@ -31,6 +31,9 @@ struct r8a66597_platdata { | |||
31 | /* This callback can control port power instead of DVSTCTR register. */ | 31 | /* This callback can control port power instead of DVSTCTR register. */ |
32 | void (*port_power)(int port, int power); | 32 | void (*port_power)(int port, int power); |
33 | 33 | ||
34 | /* This parameter is for BUSWAIT */ | ||
35 | u16 buswait; | ||
36 | |||
34 | /* set one = on chip controller, set zero = external controller */ | 37 | /* set one = on chip controller, set zero = external controller */ |
35 | unsigned on_chip:1; | 38 | unsigned on_chip:1; |
36 | 39 | ||
@@ -42,6 +45,9 @@ struct r8a66597_platdata { | |||
42 | 45 | ||
43 | /* set one = big endian, set zero = little endian */ | 46 | /* set one = big endian, set zero = little endian */ |
44 | unsigned endian:1; | 47 | unsigned endian:1; |
48 | |||
49 | /* (external controller only) set one = WR0_N shorted to WR1_N */ | ||
50 | unsigned wr0_shorted_to_wr1:1; | ||
45 | }; | 51 | }; |
46 | 52 | ||
47 | /* Register definitions */ | 53 | /* Register definitions */ |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 3a7f1d982dd..8977431259c 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
@@ -110,6 +110,23 @@ struct renesas_usbhs_driver_param { | |||
110 | * delay time from notify_hotplug callback | 110 | * delay time from notify_hotplug callback |
111 | */ | 111 | */ |
112 | int detection_delay; | 112 | int detection_delay; |
113 | |||
114 | /* | ||
115 | * option: | ||
116 | * | ||
117 | * dma id for dmaengine | ||
118 | */ | ||
119 | int d0_tx_id; | ||
120 | int d0_rx_id; | ||
121 | int d1_tx_id; | ||
122 | int d1_rx_id; | ||
123 | |||
124 | /* | ||
125 | * option: | ||
126 | * | ||
127 | * pio <--> dma border. | ||
128 | */ | ||
129 | int pio_dma_border; /* default is 64byte */ | ||
113 | }; | 130 | }; |
114 | 131 | ||
115 | /* | 132 | /* |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 605b0aa8d85..6939637e787 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -98,7 +98,7 @@ struct driver_info { | |||
98 | 98 | ||
99 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ | 99 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ |
100 | 100 | ||
101 | #define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ | 101 | #define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Indicates to usbnet, that USB driver accumulates multiple IP packets. | 104 | * Indicates to usbnet, that USB driver accumulates multiple IP packets. |
@@ -106,6 +106,7 @@ struct driver_info { | |||
106 | */ | 106 | */ |
107 | #define FLAG_MULTI_PACKET 0x2000 | 107 | #define FLAG_MULTI_PACKET 0x2000 |
108 | #define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ | 108 | #define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ |
109 | #define FLAG_RMNET 0x8000 /* use "rmnet%d" names */ | ||
109 | 110 | ||
110 | /* init device ... can sleep, or cause probe() failure */ | 111 | /* init device ... can sleep, or cause probe() failure */ |
111 | int (*bind)(struct usbnet *, struct usb_interface *); | 112 | int (*bind)(struct usbnet *, struct usb_interface *); |