aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/Kbuild1
-rw-r--r--include/linux/usb/cdc.h102
-rw-r--r--include/linux/usb/ch11.h93
-rw-r--r--include/linux/usb/ch9.h84
-rw-r--r--include/linux/usb/composite.h58
-rw-r--r--include/linux/usb/ehci_def.h21
-rw-r--r--include/linux/usb/functionfs.h4
-rw-r--r--include/linux/usb/gadget.h28
-rw-r--r--include/linux/usb/hcd.h46
-rw-r--r--include/linux/usb/intel_mid_otg.h180
-rw-r--r--include/linux/usb/langwell_otg.h139
-rw-r--r--include/linux/usb/midi.h2
-rw-r--r--include/linux/usb/msm_hsusb.h185
-rw-r--r--include/linux/usb/msm_hsusb_hw.h57
-rw-r--r--include/linux/usb/musb.h10
-rw-r--r--include/linux/usb/ncm.h114
-rw-r--r--include/linux/usb/otg.h26
-rw-r--r--include/linux/usb/renesas_usbhs.h156
-rw-r--r--include/linux/usb/rndis_host.h2
-rw-r--r--include/linux/usb/serial.h14
-rw-r--r--include/linux/usb/storage.h48
-rw-r--r--include/linux/usb/ulpi.h5
-rw-r--r--include/linux/usb/usbnet.h12
-rw-r--r--include/linux/usb/wusb.h2
24 files changed, 1180 insertions, 209 deletions
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 51410e0200cf..ed91fb62674b 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -2,6 +2,7 @@ header-y += audio.h
2header-y += cdc.h 2header-y += cdc.h
3header-y += ch9.h 3header-y += ch9.h
4header-y += ch11.h 4header-y += ch11.h
5header-y += functionfs.h
5header-y += gadgetfs.h 6header-y += gadgetfs.h
6header-y += midi.h 7header-y += midi.h
7header-y += g_printer.h 8header-y += g_printer.h
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index c117a68d04a7..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -32,6 +32,8 @@
32 32
33#define USB_CDC_PROTO_EEM 7 33#define USB_CDC_PROTO_EEM 7
34 34
35#define USB_CDC_NCM_PROTO_NTB 1
36
35/*-------------------------------------------------------------------------*/ 37/*-------------------------------------------------------------------------*/
36 38
37/* 39/*
@@ -87,7 +89,7 @@ struct usb_cdc_acm_descriptor {
87 89
88#define USB_CDC_COMM_FEATURE 0x01 90#define USB_CDC_COMM_FEATURE 0x01
89#define USB_CDC_CAP_LINE 0x02 91#define USB_CDC_CAP_LINE 0x02
90#define USB_CDC_CAP_BRK 0x04 92#define USB_CDC_CAP_BRK 0x04
91#define USB_CDC_CAP_NOTIFY 0x08 93#define USB_CDC_CAP_NOTIFY 0x08
92 94
93/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */ 95/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
@@ -269,18 +271,23 @@ struct usb_cdc_notification {
269 __le16 wLength; 271 __le16 wLength;
270} __attribute__ ((packed)); 272} __attribute__ ((packed));
271 273
274struct usb_cdc_speed_change {
275 __le32 DLBitRRate; /* contains the downlink bit rate (IN pipe) */
276 __le32 ULBitRate; /* contains the uplink bit rate (OUT pipe) */
277} __attribute__ ((packed));
278
272/*-------------------------------------------------------------------------*/ 279/*-------------------------------------------------------------------------*/
273 280
274/* 281/*
275 * Class Specific structures and constants 282 * Class Specific structures and constants
276 * 283 *
277 * CDC NCM parameter structure, CDC NCM subclass 6.2.1 284 * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1
278 * 285 *
279 */ 286 */
280 287
281struct usb_cdc_ncm_ntb_parameter { 288struct usb_cdc_ncm_ntb_parameters {
282 __le16 wLength; 289 __le16 wLength;
283 __le16 bmNtbFormatSupported; 290 __le16 bmNtbFormatsSupported;
284 __le32 dwNtbInMaxSize; 291 __le32 dwNtbInMaxSize;
285 __le16 wNdpInDivisor; 292 __le16 wNdpInDivisor;
286 __le16 wNdpInPayloadRemainder; 293 __le16 wNdpInPayloadRemainder;
@@ -290,22 +297,22 @@ struct usb_cdc_ncm_ntb_parameter {
290 __le16 wNdpOutDivisor; 297 __le16 wNdpOutDivisor;
291 __le16 wNdpOutPayloadRemainder; 298 __le16 wNdpOutPayloadRemainder;
292 __le16 wNdpOutAlignment; 299 __le16 wNdpOutAlignment;
293 __le16 wPadding2; 300 __le16 wNtbOutMaxDatagrams;
294} __attribute__ ((packed)); 301} __attribute__ ((packed));
295 302
296/* 303/*
297 * CDC NCM transfer headers, CDC NCM subclass 3.2 304 * CDC NCM transfer headers, CDC NCM subclass 3.2
298 */ 305 */
299 306
300#define NCM_NTH16_SIGN 0x484D434E /* NCMH */ 307#define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */
301#define NCM_NTH32_SIGN 0x686D636E /* ncmh */ 308#define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */
302 309
303struct usb_cdc_ncm_nth16 { 310struct usb_cdc_ncm_nth16 {
304 __le32 dwSignature; 311 __le32 dwSignature;
305 __le16 wHeaderLength; 312 __le16 wHeaderLength;
306 __le16 wSequence; 313 __le16 wSequence;
307 __le16 wBlockLength; 314 __le16 wBlockLength;
308 __le16 wFpIndex; 315 __le16 wNdpIndex;
309} __attribute__ ((packed)); 316} __attribute__ ((packed));
310 317
311struct usb_cdc_ncm_nth32 { 318struct usb_cdc_ncm_nth32 {
@@ -313,32 +320,93 @@ struct usb_cdc_ncm_nth32 {
313 __le16 wHeaderLength; 320 __le16 wHeaderLength;
314 __le16 wSequence; 321 __le16 wSequence;
315 __le32 dwBlockLength; 322 __le32 dwBlockLength;
316 __le32 dwFpIndex; 323 __le32 dwNdpIndex;
317} __attribute__ ((packed)); 324} __attribute__ ((packed));
318 325
319/* 326/*
320 * CDC NCM datagram pointers, CDC NCM subclass 3.3 327 * CDC NCM datagram pointers, CDC NCM subclass 3.3
321 */ 328 */
322 329
323#define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ 330#define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */
324#define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ 331#define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */
325#define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ 332#define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */
326#define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ 333#define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */
327 334
335/* 16-bit NCM Datagram Pointer Entry */
336struct usb_cdc_ncm_dpe16 {
337 __le16 wDatagramIndex;
338 __le16 wDatagramLength;
339} __attribute__((__packed__));
340
341/* 16-bit NCM Datagram Pointer Table */
328struct usb_cdc_ncm_ndp16 { 342struct usb_cdc_ncm_ndp16 {
329 __le32 dwSignature; 343 __le32 dwSignature;
330 __le16 wLength; 344 __le16 wLength;
331 __le16 wNextFpIndex; 345 __le16 wNextNdpIndex;
332 __u8 data[0]; 346 struct usb_cdc_ncm_dpe16 dpe16[0];
333} __attribute__ ((packed)); 347} __attribute__ ((packed));
334 348
349/* 32-bit NCM Datagram Pointer Entry */
350struct usb_cdc_ncm_dpe32 {
351 __le32 dwDatagramIndex;
352 __le32 dwDatagramLength;
353} __attribute__((__packed__));
354
355/* 32-bit NCM Datagram Pointer Table */
335struct usb_cdc_ncm_ndp32 { 356struct usb_cdc_ncm_ndp32 {
336 __le32 dwSignature; 357 __le32 dwSignature;
337 __le16 wLength; 358 __le16 wLength;
338 __le16 wReserved6; 359 __le16 wReserved6;
339 __le32 dwNextFpIndex; 360 __le32 dwNextNdpIndex;
340 __le32 dwReserved12; 361 __le32 dwReserved12;
341 __u8 data[0]; 362 struct usb_cdc_ncm_dpe32 dpe32[0];
342} __attribute__ ((packed)); 363} __attribute__ ((packed));
343 364
365/* CDC NCM subclass 3.2.1 and 3.2.2 */
366#define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C
367#define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010
368
369/* CDC NCM subclass 3.3.3 Datagram Formatting */
370#define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30
371#define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31
372
373/* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */
374#define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00
375#define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE
376
377/* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */
378#define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0)
379#define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1)
380#define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2)
381#define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3)
382#define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4)
383#define USB_CDC_NCM_NCAP_NTB_INPUT_SIZE (1 << 5)
384
385/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
386#define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0)
387#define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1)
388
389/* CDC NCM subclass Table 6-3: NTB Parameter Structure */
390#define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04
391#define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C
392
393/* CDC NCM subclass 6.2.5 SetNtbFormat */
394#define USB_CDC_NCM_NTB16_FORMAT 0x00
395#define USB_CDC_NCM_NTB32_FORMAT 0x01
396
397/* CDC NCM subclass 6.2.7 SetNtbInputSize */
398#define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048
399#define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048
400
401/* NTB Input Size Structure */
402struct usb_cdc_ncm_ndp_input_size {
403 __le32 dwNtbInMaxSize;
404 __le16 wNtbInMaxDatagrams;
405 __le16 wReserved;
406} __attribute__ ((packed));
407
408/* CDC NCM subclass 6.2.11 SetCrcMode */
409#define USB_CDC_NCM_CRC_NOT_APPENDED 0x00
410#define USB_CDC_NCM_CRC_APPENDED 0x01
411
344#endif /* __LINUX_USB_CDC_H */ 412#endif /* __LINUX_USB_CDC_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 119194c85d10..4ebaf0824179 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -26,6 +26,14 @@
26#define HUB_RESET_TT 9 26#define HUB_RESET_TT 9
27#define HUB_GET_TT_STATE 10 27#define HUB_GET_TT_STATE 10
28#define HUB_STOP_TT 11 28#define HUB_STOP_TT 11
29#define HUB_SET_DEPTH 12
30
31/*
32 * Hub class additional requests defined by USB 3.0 spec
33 * See USB 3.0 spec Table 10-6
34 */
35#define HUB_SET_DEPTH 12
36#define HUB_GET_PORT_ERR_COUNT 13
29 37
30/* 38/*
31 * Hub Class feature numbers 39 * Hub Class feature numbers
@@ -54,6 +62,26 @@
54#define USB_PORT_FEAT_TEST 21 62#define USB_PORT_FEAT_TEST 21
55#define USB_PORT_FEAT_INDICATOR 22 63#define USB_PORT_FEAT_INDICATOR 22
56#define USB_PORT_FEAT_C_PORT_L1 23 64#define USB_PORT_FEAT_C_PORT_L1 23
65#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
66#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
67#define USB_PORT_FEAT_PORT_REMOTE_WAKE_MASK 27
68#define USB_PORT_FEAT_BH_PORT_RESET 28
69#define USB_PORT_FEAT_C_BH_PORT_RESET 29
70#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
71
72/*
73 * Port feature selectors added by USB 3.0 spec.
74 * See USB 3.0 spec Table 10-7
75 */
76#define USB_PORT_FEAT_LINK_STATE 5
77#define USB_PORT_FEAT_U1_TIMEOUT 23
78#define USB_PORT_FEAT_U2_TIMEOUT 24
79#define USB_PORT_FEAT_C_LINK_STATE 25
80#define USB_PORT_FEAT_C_CONFIG_ERR 26
81#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
82#define USB_PORT_FEAT_BH_PORT_RESET 28
83#define USB_PORT_FEAT_C_BH_PORT_RESET 29
84#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
57 85
58/* 86/*
59 * Hub Status and Hub Change results 87 * Hub Status and Hub Change results
@@ -81,12 +109,43 @@ struct usb_port_status {
81#define USB_PORT_STAT_TEST 0x0800 109#define USB_PORT_STAT_TEST 0x0800
82#define USB_PORT_STAT_INDICATOR 0x1000 110#define USB_PORT_STAT_INDICATOR 0x1000
83/* bits 13 to 15 are reserved */ 111/* bits 13 to 15 are reserved */
84#define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */ 112
113/*
114 * Additions to wPortStatus bit field from USB 3.0
115 * See USB 3.0 spec Table 10-10
116 */
117#define USB_PORT_STAT_LINK_STATE 0x01e0
118#define USB_SS_PORT_STAT_POWER 0x0200
119#define USB_SS_PORT_STAT_SPEED 0x1c00
120#define USB_PORT_STAT_SPEED_5GBPS 0x0000
121/* Valid only if port is enabled */
122/* Bits that are the same from USB 2.0 */
123#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
124 USB_PORT_STAT_ENABLE | \
125 USB_PORT_STAT_OVERCURRENT | \
126 USB_PORT_STAT_RESET)
127
128/*
129 * Definitions for PORT_LINK_STATE values
130 * (bits 5-8) in wPortStatus
131 */
132#define USB_SS_PORT_LS_U0 0x0000
133#define USB_SS_PORT_LS_U1 0x0020
134#define USB_SS_PORT_LS_U2 0x0040
135#define USB_SS_PORT_LS_U3 0x0060
136#define USB_SS_PORT_LS_SS_DISABLED 0x0080
137#define USB_SS_PORT_LS_RX_DETECT 0x00a0
138#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
139#define USB_SS_PORT_LS_POLLING 0x00e0
140#define USB_SS_PORT_LS_RECOVERY 0x0100
141#define USB_SS_PORT_LS_HOT_RESET 0x0120
142#define USB_SS_PORT_LS_COMP_MOD 0x0140
143#define USB_SS_PORT_LS_LOOPBACK 0x0160
85 144
86/* 145/*
87 * wPortChange bit field 146 * wPortChange bit field
88 * See USB 2.0 spec Table 11-22 147 * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
89 * Bits 0 to 4 shown, bits 5 to 15 are reserved 148 * Bits 0 to 5 shown, bits 6 to 15 are reserved
90 */ 149 */
91#define USB_PORT_STAT_C_CONNECTION 0x0001 150#define USB_PORT_STAT_C_CONNECTION 0x0001
92#define USB_PORT_STAT_C_ENABLE 0x0002 151#define USB_PORT_STAT_C_ENABLE 0x0002
@@ -94,6 +153,13 @@ struct usb_port_status {
94#define USB_PORT_STAT_C_OVERCURRENT 0x0008 153#define USB_PORT_STAT_C_OVERCURRENT 0x0008
95#define USB_PORT_STAT_C_RESET 0x0010 154#define USB_PORT_STAT_C_RESET 0x0010
96#define USB_PORT_STAT_C_L1 0x0020 155#define USB_PORT_STAT_C_L1 0x0020
156/*
157 * USB 3.0 wPortChange bit fields
158 * See USB 3.0 spec Table 10-11
159 */
160#define USB_PORT_STAT_C_BH_RESET 0x0020
161#define USB_PORT_STAT_C_LINK_STATE 0x0040
162#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
97 163
98/* 164/*
99 * wHubCharacteristics (masks) 165 * wHubCharacteristics (masks)
@@ -128,7 +194,9 @@ struct usb_hub_status {
128 */ 194 */
129 195
130#define USB_DT_HUB (USB_TYPE_CLASS | 0x09) 196#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
197#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
131#define USB_DT_HUB_NONVAR_SIZE 7 198#define USB_DT_HUB_NONVAR_SIZE 7
199#define USB_DT_SS_HUB_SIZE 12
132 200
133struct usb_hub_descriptor { 201struct usb_hub_descriptor {
134 __u8 bDescLength; 202 __u8 bDescLength;
@@ -137,11 +205,22 @@ struct usb_hub_descriptor {
137 __le16 wHubCharacteristics; 205 __le16 wHubCharacteristics;
138 __u8 bPwrOn2PwrGood; 206 __u8 bPwrOn2PwrGood;
139 __u8 bHubContrCurrent; 207 __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 208
209 /* 2.0 and 3.0 hubs differ here */
210 union {
211 struct {
212 /* add 1 bit for hub status change; round to bytes */
213 __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
214 __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
215 } __attribute__ ((packed)) hs;
216
217 struct {
218 __u8 bHubHdrDecLat;
219 __u16 wHubDelay;
220 __u16 DeviceRemovable;
221 } __attribute__ ((packed)) ss;
222 } u;
223} __attribute__ ((packed));
145 224
146/* port indicator status selectors, tables 11-7 and 11-25 */ 225/* port indicator status selectors, tables 11-7 and 11-25 */
147#define HUB_LED_AUTO 0 226#define HUB_LED_AUTO 0
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index da2ed77d3e8d..0fd3fbdd8283 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -123,8 +123,33 @@
123#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ 123#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
124#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ 124#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
125 125
126/*
127 * Test Mode Selectors
128 * See USB 2.0 spec Table 9-7
129 */
130#define TEST_J 1
131#define TEST_K 2
132#define TEST_SE0_NAK 3
133#define TEST_PACKET 4
134#define TEST_FORCE_EN 5
135
136/*
137 * New Feature Selectors as added by USB 3.0
138 * See USB 3.0 spec Table 9-6
139 */
140#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
141#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
142#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
143#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
144
145#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
146
126#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ 147#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
127 148
149/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
150#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
151#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
152#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
128 153
129/** 154/**
130 * struct usb_ctrlrequest - SETUP data for a USB device control request 155 * struct usb_ctrlrequest - SETUP data for a USB device control request
@@ -554,12 +579,14 @@ struct usb_ss_ep_comp_descriptor {
554 579
555 __u8 bMaxBurst; 580 __u8 bMaxBurst;
556 __u8 bmAttributes; 581 __u8 bmAttributes;
557 __u16 wBytesPerInterval; 582 __le16 wBytesPerInterval;
558} __attribute__ ((packed)); 583} __attribute__ ((packed));
559 584
560#define USB_DT_SS_EP_COMP_SIZE 6 585#define USB_DT_SS_EP_COMP_SIZE 6
561/* Bits 4:0 of bmAttributes if this is a bulk endpoint */ 586/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
562#define USB_SS_MAX_STREAMS(p) (1 << (p & 0x1f)) 587#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
588/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
589#define USB_SS_MULT(p) (1 + ((p) & 0x3))
563 590
564/*-------------------------------------------------------------------------*/ 591/*-------------------------------------------------------------------------*/
565 592
@@ -675,6 +702,7 @@ struct usb_bos_descriptor {
675 __u8 bNumDeviceCaps; 702 __u8 bNumDeviceCaps;
676} __attribute__((packed)); 703} __attribute__((packed));
677 704
705#define USB_DT_BOS_SIZE 5
678/*-------------------------------------------------------------------------*/ 706/*-------------------------------------------------------------------------*/
679 707
680/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ 708/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
@@ -712,16 +740,56 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
712 __u8 bReserved; 740 __u8 bReserved;
713} __attribute__((packed)); 741} __attribute__((packed));
714 742
743/* USB 2.0 Extension descriptor */
715#define USB_CAP_TYPE_EXT 2 744#define USB_CAP_TYPE_EXT 2
716 745
717struct usb_ext_cap_descriptor { /* Link Power Management */ 746struct usb_ext_cap_descriptor { /* Link Power Management */
718 __u8 bLength; 747 __u8 bLength;
719 __u8 bDescriptorType; 748 __u8 bDescriptorType;
720 __u8 bDevCapabilityType; 749 __u8 bDevCapabilityType;
721 __u8 bmAttributes; 750 __le32 bmAttributes;
722#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ 751#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
723} __attribute__((packed)); 752} __attribute__((packed));
724 753
754#define USB_DT_USB_EXT_CAP_SIZE 7
755
756/*
757 * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
758 * specific device level capabilities
759 */
760#define USB_SS_CAP_TYPE 3
761struct usb_ss_cap_descriptor { /* Link Power Management */
762 __u8 bLength;
763 __u8 bDescriptorType;
764 __u8 bDevCapabilityType;
765 __u8 bmAttributes;
766#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
767 __le16 wSpeedSupported;
768#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
769#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
770#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
771#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
772 __u8 bFunctionalitySupport;
773 __u8 bU1devExitLat;
774 __le16 bU2DevExitLat;
775} __attribute__((packed));
776
777#define USB_DT_USB_SS_CAP_SIZE 10
778
779/*
780 * Container ID Capability descriptor: Defines the instance unique ID used to
781 * identify the instance across all operating modes
782 */
783#define CONTAINER_ID_TYPE 4
784struct usb_ss_container_id_descriptor {
785 __u8 bLength;
786 __u8 bDescriptorType;
787 __u8 bDevCapabilityType;
788 __u8 bReserved;
789 __u8 ContainerID[16]; /* 128-bit number */
790} __attribute__((packed));
791
792#define USB_DT_USB_SS_CONTN_ID_SIZE 20
725/*-------------------------------------------------------------------------*/ 793/*-------------------------------------------------------------------------*/
726 794
727/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with 795/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
@@ -808,4 +876,14 @@ enum usb_device_state {
808 */ 876 */
809}; 877};
810 878
879/*-------------------------------------------------------------------------*/
880
881/*
882 * As per USB compliance update, a device that is actively drawing
883 * more than 100mA from USB must report itself as bus-powered in
884 * the GetStatus(DEVICE) call.
885 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
886 */
887#define USB_SELF_POWER_VBUS_MAX_DRAW 100
888
811#endif /* __LINUX_USB_CH9_H */ 889#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 617068134ae8..b78cba466d3d 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -37,6 +37,14 @@
37#include <linux/usb/ch9.h> 37#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h> 38#include <linux/usb/gadget.h>
39 39
40/*
41 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
42 * wish to delay the data/status stages of the control transfer till they
43 * are ready. The control transfer will then be kept from completing till
44 * all the function drivers that requested for USB_GADGET_DELAYED_STAUS
45 * invoke usb_composite_setup_continue().
46 */
47#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
40 48
41struct usb_configuration; 49struct usb_configuration;
42 50
@@ -161,8 +169,6 @@ ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
161 * and by language IDs provided in control requests. 169 * and by language IDs provided in control requests.
162 * @descriptors: Table of descriptors preceding all function descriptors. 170 * @descriptors: Table of descriptors preceding all function descriptors.
163 * Examples include OTG and vendor-specific descriptors. 171 * Examples include OTG and vendor-specific descriptors.
164 * @bind: Called from @usb_add_config() to allocate resources unique to this
165 * configuration and to call @usb_add_function() for each function used.
166 * @unbind: Reverses @bind; called as a side effect of unregistering the 172 * @unbind: Reverses @bind; called as a side effect of unregistering the
167 * driver which added this configuration. 173 * driver which added this configuration.
168 * @setup: Used to delegate control requests that aren't handled by standard 174 * @setup: Used to delegate control requests that aren't handled by standard
@@ -190,7 +196,7 @@ ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs,
190 * @bind() method is then used to initialize all the functions and then 196 * @bind() method is then used to initialize all the functions and then
191 * call @usb_add_function() for them. 197 * call @usb_add_function() for them.
192 * 198 *
193 * Those functions would normally be independant of each other, but that's 199 * Those functions would normally be independent of each other, but that's
194 * not mandatory. CDC WMC devices are an example where functions often 200 * not mandatory. CDC WMC devices are an example where functions often
195 * depend on other functions, with some functions subsidiary to others. 201 * depend on other functions, with some functions subsidiary to others.
196 * Such interdependency may be managed in any way, so long as all of the 202 * Such interdependency may be managed in any way, so long as all of the
@@ -207,8 +213,7 @@ struct usb_configuration {
207 * we can't restructure things to avoid mismatching... 213 * we can't restructure things to avoid mismatching...
208 */ 214 */
209 215
210 /* configuration management: bind/unbind */ 216 /* configuration management: unbind/setup */
211 int (*bind)(struct usb_configuration *);
212 void (*unbind)(struct usb_configuration *); 217 void (*unbind)(struct usb_configuration *);
213 int (*setup)(struct usb_configuration *, 218 int (*setup)(struct usb_configuration *,
214 const struct usb_ctrlrequest *); 219 const struct usb_ctrlrequest *);
@@ -232,20 +237,24 @@ struct usb_configuration {
232}; 237};
233 238
234int usb_add_config(struct usb_composite_dev *, 239int usb_add_config(struct usb_composite_dev *,
235 struct usb_configuration *); 240 struct usb_configuration *,
241 int (*)(struct usb_configuration *));
236 242
237/** 243/**
238 * struct usb_composite_driver - groups configurations into a gadget 244 * struct usb_composite_driver - groups configurations into a gadget
239 * @name: For diagnostics, identifies the driver. 245 * @name: For diagnostics, identifies the driver.
246 * @iProduct: Used as iProduct override if @dev->iProduct is not set.
247 * If NULL value of @name is taken.
248 * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is
249 * not set. If NULL a default "<system> <release> with <udc>" value
250 * will be used.
240 * @dev: Template descriptor for the device, including default device 251 * @dev: Template descriptor for the device, including default device
241 * identifiers. 252 * identifiers.
242 * @strings: tables of strings, keyed by identifiers assigned during bind() 253 * @strings: tables of strings, keyed by identifiers assigned during bind()
243 * and language IDs provided in control requests 254 * and language IDs provided in control requests
244 * @bind: (REQUIRED) Used to allocate resources that are shared across the 255 * @needs_serial: set to 1 if the gadget needs userspace to provide
245 * whole device, such as string IDs, and add its configurations using 256 * a serial number. If one is not provided, warning will be printed.
246 * @usb_add_config(). This may fail by returning a negative errno 257 * @unbind: Reverses bind; called as a side effect of unregistering
247 * value; it should return zero on successful initialization.
248 * @unbind: Reverses @bind(); called as a side effect of unregistering
249 * this driver. 258 * this driver.
250 * @disconnect: optional driver disconnect method 259 * @disconnect: optional driver disconnect method
251 * @suspend: Notifies when the host stops sending USB traffic, 260 * @suspend: Notifies when the host stops sending USB traffic,
@@ -256,7 +265,7 @@ int usb_add_config(struct usb_composite_dev *,
256 * Devices default to reporting self powered operation. Devices which rely 265 * Devices default to reporting self powered operation. Devices which rely
257 * on bus powered operation should report this in their @bind() method. 266 * on bus powered operation should report this in their @bind() method.
258 * 267 *
259 * Before returning from @bind, various fields in the template descriptor 268 * Before returning from bind, various fields in the template descriptor
260 * may be overridden. These include the idVendor/idProduct/bcdDevice values 269 * may be overridden. These include the idVendor/idProduct/bcdDevice values
261 * normally to bind the appropriate host side driver, and the three strings 270 * normally to bind the appropriate host side driver, and the three strings
262 * (iManufacturer, iProduct, iSerialNumber) normally used to provide user 271 * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
@@ -266,15 +275,12 @@ int usb_add_config(struct usb_composite_dev *,
266 */ 275 */
267struct usb_composite_driver { 276struct usb_composite_driver {
268 const char *name; 277 const char *name;
278 const char *iProduct;
279 const char *iManufacturer;
269 const struct usb_device_descriptor *dev; 280 const struct usb_device_descriptor *dev;
270 struct usb_gadget_strings **strings; 281 struct usb_gadget_strings **strings;
282 unsigned needs_serial:1;
271 283
272 /* REVISIT: bind() functions can be marked __init, which
273 * makes trouble for section mismatch analysis. See if
274 * we can't restructure things to avoid mismatching...
275 */
276
277 int (*bind)(struct usb_composite_dev *);
278 int (*unbind)(struct usb_composite_dev *); 284 int (*unbind)(struct usb_composite_dev *);
279 285
280 void (*disconnect)(struct usb_composite_dev *); 286 void (*disconnect)(struct usb_composite_dev *);
@@ -284,8 +290,10 @@ struct usb_composite_driver {
284 void (*resume)(struct usb_composite_dev *); 290 void (*resume)(struct usb_composite_dev *);
285}; 291};
286 292
287extern int usb_composite_register(struct usb_composite_driver *); 293extern int usb_composite_probe(struct usb_composite_driver *driver,
288extern void usb_composite_unregister(struct usb_composite_driver *); 294 int (*bind)(struct usb_composite_dev *cdev));
295extern void usb_composite_unregister(struct usb_composite_driver *driver);
296extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
289 297
290 298
291/** 299/**
@@ -334,13 +342,21 @@ struct usb_composite_dev {
334 struct list_head configs; 342 struct list_head configs;
335 struct usb_composite_driver *driver; 343 struct usb_composite_driver *driver;
336 u8 next_string_id; 344 u8 next_string_id;
345 u8 manufacturer_override;
346 u8 product_override;
347 u8 serial_override;
337 348
338 /* the gadget driver won't enable the data pullup 349 /* the gadget driver won't enable the data pullup
339 * while the deactivation count is nonzero. 350 * while the deactivation count is nonzero.
340 */ 351 */
341 unsigned deactivations; 352 unsigned deactivations;
342 353
343 /* protects at least deactivation count */ 354 /* the composite driver won't complete the control transfer's
355 * data/status stages till delayed_status is zero.
356 */
357 int delayed_status;
358
359 /* protects deactivations and delayed_status counts*/
344 spinlock_t lock; 360 spinlock_t lock;
345}; 361};
346 362
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 2e262cb15425..7cc95ee3606b 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -25,10 +25,15 @@
25struct ehci_caps { 25struct ehci_caps {
26 /* these fields are specified as 8 and 16 bit registers, 26 /* these fields are specified as 8 and 16 bit registers,
27 * but some hosts can't perform 8 or 16 bit PCI accesses. 27 * but some hosts can't perform 8 or 16 bit PCI accesses.
28 * some hosts treat caplength and hciversion as parts of a 32-bit
29 * register, others treat them as two separate registers, this
30 * affects the memory map for big endian controllers.
28 */ 31 */
29 u32 hc_capbase; 32 u32 hc_capbase;
30#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */ 33#define HC_LENGTH(ehci, p) (0x00ff&((p) >> /* bits 7:0 / offset 00h */ \
31#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */ 34 (ehci_big_endian_capbase(ehci) ? 24 : 0)))
35#define HC_VERSION(ehci, p) (0xffff&((p) >> /* bits 31:16 / offset 02h */ \
36 (ehci_big_endian_capbase(ehci) ? 0 : 16)))
32 u32 hcs_params; /* HCSPARAMS - offset 0x4 */ 37 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
33#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */ 38#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
34#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */ 39#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
@@ -52,7 +57,7 @@ struct ehci_caps {
52#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/ 57#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
53#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */ 58#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
54 u8 portroute[8]; /* nibbles for routing - offset 0xC */ 59 u8 portroute[8]; /* nibbles for routing - offset 0xC */
55} __attribute__ ((packed)); 60};
56 61
57 62
58/* Section 2.3 Host Controller Operational Registers */ 63/* Section 2.3 Host Controller Operational Registers */
@@ -127,7 +132,9 @@ struct ehci_regs {
127#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ 132#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
128#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 133#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
129/* 19:16 for port testing */ 134/* 19:16 for port testing */
130#define PORT_TEST_PKT (0x4<<16) /* Port Test Control - packet test */ 135#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
136#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
137#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
131#define PORT_LED_OFF (0<<14) 138#define PORT_LED_OFF (0<<14)
132#define PORT_LED_AMBER (1<<14) 139#define PORT_LED_AMBER (1<<14)
133#define PORT_LED_GREEN (2<<14) 140#define PORT_LED_GREEN (2<<14)
@@ -148,7 +155,7 @@ struct ehci_regs {
148#define PORT_CSC (1<<1) /* connect status change */ 155#define PORT_CSC (1<<1) /* connect status change */
149#define PORT_CONNECT (1<<0) /* device connected */ 156#define PORT_CONNECT (1<<0) /* device connected */
150#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC) 157#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
151} __attribute__ ((packed)); 158};
152 159
153#define USBMODE 0x68 /* USB Device mode */ 160#define USBMODE 0x68 /* USB Device mode */
154#define USBMODE_SDIS (1<<3) /* Stream disable */ 161#define USBMODE_SDIS (1<<3) /* Stream disable */
@@ -157,7 +164,7 @@ struct ehci_regs {
157#define USBMODE_CM_IDLE (0<<0) /* idle state */ 164#define USBMODE_CM_IDLE (0<<0) /* idle state */
158 165
159/* Moorestown has some non-standard registers, partially due to the fact that 166/* Moorestown has some non-standard registers, partially due to the fact that
160 * its EHCI controller has both TT and LPM support. HOSTPCx are extentions to 167 * its EHCI controller has both TT and LPM support. HOSTPCx are extensions to
161 * PORTSCx 168 * PORTSCx
162 */ 169 */
163#define HOSTPC0 0x84 /* HOSTPC extension */ 170#define HOSTPC0 0x84 /* HOSTPC extension */
@@ -192,7 +199,7 @@ struct ehci_dbg_port {
192 u32 data47; 199 u32 data47;
193 u32 address; 200 u32 address;
194#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep)) 201#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
195} __attribute__ ((packed)); 202};
196 203
197#ifdef CONFIG_EARLY_PRINTK_DBGP 204#ifdef CONFIG_EARLY_PRINTK_DBGP
198#include <linux/init.h> 205#include <linux/init.h>
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 6f649c13193b..7587ef934ba8 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -45,7 +45,7 @@ struct usb_functionfs_descs_head {
45 * | off | name | type | description | 45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------| 46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC | 47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | lenght | LE32 | length of the whole data chunk | 48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors | 49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors | 50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors | 51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
@@ -86,7 +86,7 @@ struct usb_functionfs_strings_head {
86 * | 0 | lang | LE16 | language code | 86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language | 87 * | 2 | strings | String[str_count] | array of strings in given language |
88 * 88 *
89 * For each string ther is one strings entry (ie. there are str_count 89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in 90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8. 91 * UTF-8.
92 */ 92 */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index d3ef42d7d2f0..dd1571db55e7 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -72,7 +72,7 @@ struct usb_ep;
72 * Bulk endpoints can use any size buffers, and can also be used for interrupt 72 * Bulk endpoints can use any size buffers, and can also be used for interrupt
73 * transfers. interrupt-only endpoints can be much less functional. 73 * transfers. interrupt-only endpoints can be much less functional.
74 * 74 *
75 * NOTE: this is analagous to 'struct urb' on the host side, except that 75 * NOTE: this is analogous to 'struct urb' on the host side, except that
76 * it's thinner and promotes more pre-allocation. 76 * it's thinner and promotes more pre-allocation.
77 */ 77 */
78 78
@@ -269,7 +269,7 @@ static inline void usb_ep_free_request(struct usb_ep *ep,
269 * 269 *
270 * Control endpoints ... after getting a setup() callback, the driver queues 270 * Control endpoints ... after getting a setup() callback, the driver queues
271 * one response (even if it would be zero length). That enables the 271 * one response (even if it would be zero length). That enables the
272 * status ack, after transfering data as specified in the response. Setup 272 * status ack, after transferring data as specified in the response. Setup
273 * functions may return negative error codes to generate protocol stalls. 273 * functions may return negative error codes to generate protocol stalls.
274 * (Note that some USB device controllers disallow protocol stall responses 274 * (Note that some USB device controllers disallow protocol stall responses
275 * in some cases.) When control responses are deferred (the response is 275 * in some cases.) When control responses are deferred (the response is
@@ -705,11 +705,6 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
705 * struct usb_gadget_driver - driver for usb 'slave' devices 705 * struct usb_gadget_driver - driver for usb 'slave' devices
706 * @function: String describing the gadget's function 706 * @function: String describing the gadget's function
707 * @speed: Highest speed the driver handles. 707 * @speed: Highest speed the driver handles.
708 * @bind: Invoked when the driver is bound to a gadget, usually
709 * after registering the driver.
710 * At that point, ep0 is fully initialized, and ep_list holds
711 * the currently-available endpoints.
712 * Called in a context that permits sleeping.
713 * @setup: Invoked for ep0 control requests that aren't handled by 708 * @setup: Invoked for ep0 control requests that aren't handled by
714 * the hardware level driver. Most calls must be handled by 709 * the hardware level driver. Most calls must be handled by
715 * the gadget driver, including descriptor and configuration 710 * the gadget driver, including descriptor and configuration
@@ -774,7 +769,6 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
774struct usb_gadget_driver { 769struct usb_gadget_driver {
775 char *function; 770 char *function;
776 enum usb_device_speed speed; 771 enum usb_device_speed speed;
777 int (*bind)(struct usb_gadget *);
778 void (*unbind)(struct usb_gadget *); 772 void (*unbind)(struct usb_gadget *);
779 int (*setup)(struct usb_gadget *, 773 int (*setup)(struct usb_gadget *,
780 const struct usb_ctrlrequest *); 774 const struct usb_ctrlrequest *);
@@ -798,17 +792,19 @@ struct usb_gadget_driver {
798 */ 792 */
799 793
800/** 794/**
801 * usb_gadget_register_driver - register a gadget driver 795 * usb_gadget_probe_driver - probe a gadget driver
802 * @driver:the driver being registered 796 * @driver: the driver being registered
797 * @bind: the driver's bind callback
803 * Context: can sleep 798 * Context: can sleep
804 * 799 *
805 * Call this in your gadget driver's module initialization function, 800 * Call this in your gadget driver's module initialization function,
806 * to tell the underlying usb controller driver about your driver. 801 * to tell the underlying usb controller driver about your driver.
807 * The driver's bind() function will be called to bind it to a 802 * The @bind() function will be called to bind it to a gadget before this
808 * gadget before this registration call returns. It's expected that 803 * registration call returns. It's expected that the @bind() function will
809 * the bind() functions will be in init sections. 804 * be in init sections.
810 */ 805 */
811int usb_gadget_register_driver(struct usb_gadget_driver *driver); 806int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
807 int (*bind)(struct usb_gadget *));
812 808
813/** 809/**
814 * usb_gadget_unregister_driver - unregister a gadget driver 810 * usb_gadget_unregister_driver - unregister a gadget driver
@@ -894,8 +890,8 @@ static inline void usb_free_descriptors(struct usb_descriptor_header **v)
894/* utility wrapping a simple endpoint selection policy */ 890/* utility wrapping a simple endpoint selection policy */
895 891
896extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, 892extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
897 struct usb_endpoint_descriptor *) __devinit; 893 struct usb_endpoint_descriptor *);
898 894
899extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit; 895extern void usb_ep_autoconfig_reset(struct usb_gadget *);
900 896
901#endif /* __LINUX_USB_GADGET_H */ 897#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 3b571f1ffbb3..0097136ba45d 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -76,6 +76,10 @@ struct usb_hcd {
76 struct kref kref; /* reference counter */ 76 struct kref kref; /* reference counter */
77 77
78 const char *product_desc; /* product/vendor string */ 78 const char *product_desc; /* product/vendor string */
79 int speed; /* Speed for this roothub.
80 * May be different from
81 * hcd->driver->flags & HCD_MASK
82 */
79 char irq_descr[24]; /* driver + bus # */ 83 char irq_descr[24]; /* driver + bus # */
80 84
81 struct timer_list rh_timer; /* drives root-hub polling */ 85 struct timer_list rh_timer; /* drives root-hub polling */
@@ -99,6 +103,8 @@ struct usb_hcd {
99#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ 103#define HCD_FLAG_POLL_RH 2 /* poll for rh status? */
100#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ 104#define HCD_FLAG_POLL_PENDING 3 /* status has changed? */
101#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ 105#define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */
106#define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */
107#define HCD_FLAG_DEAD 6 /* controller has died? */
102 108
103 /* The flags can be tested using these macros; they are likely to 109 /* The flags can be tested using these macros; they are likely to
104 * be slightly faster than test_bit(). 110 * be slightly faster than test_bit().
@@ -108,10 +114,13 @@ struct usb_hcd {
108#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) 114#define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH))
109#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) 115#define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING))
110#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) 116#define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING))
117#define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING))
118#define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD))
111 119
112 /* Flags that get set only during HCD registration or removal. */ 120 /* Flags that get set only during HCD registration or removal. */
113 unsigned rh_registered:1;/* is root hub registered? */ 121 unsigned rh_registered:1;/* is root hub registered? */
114 unsigned rh_pollable:1; /* may we poll the root hub? */ 122 unsigned rh_pollable:1; /* may we poll the root hub? */
123 unsigned msix_enabled:1; /* driver has MSI-X enabled? */
115 124
116 /* The next flag is a stopgap, to be removed when all the HCDs 125 /* The next flag is a stopgap, to be removed when all the HCDs
117 * support the new root-hub polling mechanism. */ 126 * support the new root-hub polling mechanism. */
@@ -137,7 +146,9 @@ struct usb_hcd {
137 * bandwidth_mutex should be dropped after a successful control message 146 * bandwidth_mutex should be dropped after a successful control message
138 * to the device, or resetting the bandwidth after a failed attempt. 147 * to the device, or resetting the bandwidth after a failed attempt.
139 */ 148 */
140 struct mutex bandwidth_mutex; 149 struct mutex *bandwidth_mutex;
150 struct usb_hcd *shared_hcd;
151 struct usb_hcd *primary_hcd;
141 152
142 153
143#define HCD_BUFFER_POOLS 4 154#define HCD_BUFFER_POOLS 4
@@ -200,6 +211,7 @@ struct hc_driver {
200 int flags; 211 int flags;
201#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */ 212#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
202#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */ 213#define HCD_LOCAL_MEM 0x0002 /* HC needs local memory */
214#define HCD_SHARED 0x0004 /* Two (or more) usb_hcds share HW */
203#define HCD_USB11 0x0010 /* USB 1.1 */ 215#define HCD_USB11 0x0010 /* USB 1.1 */
204#define HCD_USB2 0x0020 /* USB 2.0 */ 216#define HCD_USB2 0x0020 /* USB 2.0 */
205#define HCD_USB3 0x0040 /* USB 3.0 */ 217#define HCD_USB3 0x0040 /* USB 3.0 */
@@ -233,6 +245,19 @@ struct hc_driver {
233 int (*urb_dequeue)(struct usb_hcd *hcd, 245 int (*urb_dequeue)(struct usb_hcd *hcd,
234 struct urb *urb, int status); 246 struct urb *urb, int status);
235 247
248 /*
249 * (optional) these hooks allow an HCD to override the default DMA
250 * mapping and unmapping routines. In general, they shouldn't be
251 * necessary unless the host controller has special DMA requirements,
252 * such as alignment contraints. If these are not specified, the
253 * general usb_hcd_(un)?map_urb_for_dma functions will be used instead
254 * (and it may be a good idea to call these functions in your HCD
255 * implementation)
256 */
257 int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
258 gfp_t mem_flags);
259 void (*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
260
236 /* hw synch, freeing endpoint resources that urb_dequeue can't */ 261 /* hw synch, freeing endpoint resources that urb_dequeue can't */
237 void (*endpoint_disable)(struct usb_hcd *hcd, 262 void (*endpoint_disable)(struct usb_hcd *hcd,
238 struct usb_host_endpoint *ep); 263 struct usb_host_endpoint *ep);
@@ -329,6 +354,10 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags);
329extern int usb_hcd_unlink_urb(struct urb *urb, int status); 354extern int usb_hcd_unlink_urb(struct urb *urb, int status);
330extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, 355extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb,
331 int status); 356 int status);
357extern int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
358 gfp_t mem_flags);
359extern void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *);
360extern void usb_hcd_unmap_urb_for_dma(struct usb_hcd *, struct urb *);
332extern void usb_hcd_flush_endpoint(struct usb_device *udev, 361extern void usb_hcd_flush_endpoint(struct usb_device *udev,
333 struct usb_host_endpoint *ep); 362 struct usb_host_endpoint *ep);
334extern void usb_hcd_disable_endpoint(struct usb_device *udev, 363extern void usb_hcd_disable_endpoint(struct usb_device *udev,
@@ -344,8 +373,12 @@ extern int usb_hcd_get_frame_number(struct usb_device *udev);
344 373
345extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver, 374extern struct usb_hcd *usb_create_hcd(const struct hc_driver *driver,
346 struct device *dev, const char *bus_name); 375 struct device *dev, const char *bus_name);
376extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
377 struct device *dev, const char *bus_name,
378 struct usb_hcd *shared_hcd);
347extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd); 379extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
348extern void usb_put_hcd(struct usb_hcd *hcd); 380extern void usb_put_hcd(struct usb_hcd *hcd);
381extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
349extern int usb_add_hcd(struct usb_hcd *hcd, 382extern int usb_add_hcd(struct usb_hcd *hcd,
350 unsigned int irqnum, unsigned long irqflags); 383 unsigned int irqnum, unsigned long irqflags);
351extern void usb_remove_hcd(struct usb_hcd *hcd); 384extern void usb_remove_hcd(struct usb_hcd *hcd);
@@ -469,6 +502,10 @@ extern void usb_ep0_reinit(struct usb_device *);
469 502
470/*-------------------------------------------------------------------------*/ 503/*-------------------------------------------------------------------------*/
471 504
505/* class requests from USB 3.0 hub spec, table 10-5 */
506#define SetHubDepth (0x3000 | HUB_SET_DEPTH)
507#define GetPortErrorCount (0x8000 | HUB_GET_PORT_ERR_COUNT)
508
472/* 509/*
473 * Generic bandwidth allocation constants/support 510 * Generic bandwidth allocation constants/support
474 */ 511 */
@@ -615,13 +652,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb,
615 652
616/*-------------------------------------------------------------------------*/ 653/*-------------------------------------------------------------------------*/
617 654
618/* hub.h ... DeviceRemovable in 2.4.2-ac11, gone in 2.4.10 */
619/* bleech -- resurfaced in 2.4.11 or 2.4.12 */
620#define bitmap DeviceRemovable
621
622
623/*-------------------------------------------------------------------------*/
624
625/* random stuff */ 655/* random stuff */
626 656
627#define RUN_CONTEXT (in_irq() ? "in_irq" \ 657#define RUN_CONTEXT (in_irq() ? "in_irq" \
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
new file mode 100644
index 000000000000..a0ccf795f362
--- /dev/null
+++ b/include/linux/usb/intel_mid_otg.h
@@ -0,0 +1,180 @@
1/*
2 * Intel MID (Langwell/Penwell) USB OTG Transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __INTEL_MID_OTG_H
21#define __INTEL_MID_OTG_H
22
23#include <linux/pm.h>
24#include <linux/usb/otg.h>
25#include <linux/notifier.h>
26
27struct intel_mid_otg_xceiv;
28
29/* This is a common data structure for Intel MID platform to
30 * save values of the OTG state machine */
31struct otg_hsm {
32 /* Input */
33 int a_bus_resume;
34 int a_bus_suspend;
35 int a_conn;
36 int a_sess_vld;
37 int a_srp_det;
38 int a_vbus_vld;
39 int b_bus_resume;
40 int b_bus_suspend;
41 int b_conn;
42 int b_se0_srp;
43 int b_ssend_srp;
44 int b_sess_end;
45 int b_sess_vld;
46 int id;
47/* id values */
48#define ID_B 0x05
49#define ID_A 0x04
50#define ID_ACA_C 0x03
51#define ID_ACA_B 0x02
52#define ID_ACA_A 0x01
53 int power_up;
54 int adp_change;
55 int test_device;
56
57 /* Internal variables */
58 int a_set_b_hnp_en;
59 int b_srp_done;
60 int b_hnp_enable;
61 int hnp_poll_enable;
62
63 /* Timeout indicator for timers */
64 int a_wait_vrise_tmout;
65 int a_wait_bcon_tmout;
66 int a_aidl_bdis_tmout;
67 int a_bidl_adis_tmout;
68 int a_bidl_adis_tmr;
69 int a_wait_vfall_tmout;
70 int b_ase0_brst_tmout;
71 int b_bus_suspend_tmout;
72 int b_srp_init_tmout;
73 int b_srp_fail_tmout;
74 int b_srp_fail_tmr;
75 int b_adp_sense_tmout;
76
77 /* Informative variables */
78 int a_bus_drop;
79 int a_bus_req;
80 int a_clr_err;
81 int b_bus_req;
82 int a_suspend_req;
83 int b_bus_suspend_vld;
84
85 /* Output */
86 int drv_vbus;
87 int loc_conn;
88 int loc_sof;
89
90 /* Others */
91 int vbus_srp_up;
92};
93
94/* must provide ULPI access function to read/write registers implemented in
95 * ULPI address space */
96struct iotg_ulpi_access_ops {
97 int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val);
98 int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val);
99};
100
101#define OTG_A_DEVICE 0x0
102#define OTG_B_DEVICE 0x1
103
104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on otg_transceiver data structure for this
108 * purpose.
109 */
110struct intel_mid_otg_xceiv {
111 struct otg_transceiver otg;
112 struct otg_hsm hsm;
113
114 /* base address */
115 void __iomem *base;
116
117 /* ops to access ulpi */
118 struct iotg_ulpi_access_ops ulpi_ops;
119
120 /* atomic notifier for interrupt context */
121 struct atomic_notifier_head iotg_notifier;
122
123 /* start/stop USB Host function */
124 int (*start_host)(struct intel_mid_otg_xceiv *iotg);
125 int (*stop_host)(struct intel_mid_otg_xceiv *iotg);
126
127 /* start/stop USB Peripheral function */
128 int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg);
129 int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg);
130
131 /* start/stop ADP sense/probe function */
132 int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg,
133 bool enabled, int dev);
134 int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg,
135 bool enabled);
136
137#ifdef CONFIG_PM
138 /* suspend/resume USB host function */
139 int (*suspend_host)(struct intel_mid_otg_xceiv *iotg,
140 pm_message_t message);
141 int (*resume_host)(struct intel_mid_otg_xceiv *iotg);
142
143 int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg,
144 pm_message_t message);
145 int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg);
146#endif
147
148};
149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg)
151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153}
154
155#define MID_OTG_NOTIFY_CONNECT 0x0001
156#define MID_OTG_NOTIFY_DISCONN 0x0002
157#define MID_OTG_NOTIFY_HSUSPEND 0x0003
158#define MID_OTG_NOTIFY_HRESUME 0x0004
159#define MID_OTG_NOTIFY_CSUSPEND 0x0005
160#define MID_OTG_NOTIFY_CRESUME 0x0006
161#define MID_OTG_NOTIFY_HOSTADD 0x0007
162#define MID_OTG_NOTIFY_HOSTREMOVE 0x0008
163#define MID_OTG_NOTIFY_CLIENTADD 0x0009
164#define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a
165
166static inline int
167intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg,
168 struct notifier_block *nb)
169{
170 return atomic_notifier_chain_register(&iotg->iotg_notifier, nb);
171}
172
173static inline void
174intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg,
175 struct notifier_block *nb)
176{
177 atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb);
178}
179
180#endif /* __INTEL_MID_OTG_H */
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
new file mode 100644
index 000000000000..51f17b16d312
--- /dev/null
+++ b/include/linux/usb/langwell_otg.h
@@ -0,0 +1,139 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H
21#define __LANGWELL_OTG_H
22
23#include <linux/usb/intel_mid_otg.h>
24
25#define CI_USBCMD 0x30
26# define USBCMD_RST BIT(1)
27# define USBCMD_RS BIT(0)
28#define CI_USBSTS 0x34
29# define USBSTS_SLI BIT(8)
30# define USBSTS_URI BIT(6)
31# define USBSTS_PCI BIT(2)
32#define CI_PORTSC1 0x74
33# define PORTSC_PP BIT(12)
34# define PORTSC_LS (BIT(11) | BIT(10))
35# define PORTSC_SUSP BIT(7)
36# define PORTSC_CCS BIT(0)
37#define CI_HOSTPC1 0xb4
38# define HOSTPC1_PHCD BIT(22)
39#define CI_OTGSC 0xf4
40# define OTGSC_DPIE BIT(30)
41# define OTGSC_1MSE BIT(29)
42# define OTGSC_BSEIE BIT(28)
43# define OTGSC_BSVIE BIT(27)
44# define OTGSC_ASVIE BIT(26)
45# define OTGSC_AVVIE BIT(25)
46# define OTGSC_IDIE BIT(24)
47# define OTGSC_DPIS BIT(22)
48# define OTGSC_1MSS BIT(21)
49# define OTGSC_BSEIS BIT(20)
50# define OTGSC_BSVIS BIT(19)
51# define OTGSC_ASVIS BIT(18)
52# define OTGSC_AVVIS BIT(17)
53# define OTGSC_IDIS BIT(16)
54# define OTGSC_DPS BIT(14)
55# define OTGSC_1MST BIT(13)
56# define OTGSC_BSE BIT(12)
57# define OTGSC_BSV BIT(11)
58# define OTGSC_ASV BIT(10)
59# define OTGSC_AVV BIT(9)
60# define OTGSC_ID BIT(8)
61# define OTGSC_HABA BIT(7)
62# define OTGSC_HADP BIT(6)
63# define OTGSC_IDPU BIT(5)
64# define OTGSC_DP BIT(4)
65# define OTGSC_OT BIT(3)
66# define OTGSC_HAAR BIT(2)
67# define OTGSC_VC BIT(1)
68# define OTGSC_VD BIT(0)
69# define OTGSC_INTEN_MASK (0x7f << 24)
70# define OTGSC_INT_MASK (0x5f << 24)
71# define OTGSC_INTSTS_MASK (0x7f << 16)
72#define CI_USBMODE 0xf8
73# define USBMODE_CM (BIT(1) | BIT(0))
74# define USBMODE_IDLE 0
75# define USBMODE_DEVICE 0x2
76# define USBMODE_HOST 0x3
77#define USBCFG_ADDR 0xff10801c
78#define USBCFG_LEN 4
79# define USBCFG_VBUSVAL BIT(14)
80# define USBCFG_AVALID BIT(13)
81# define USBCFG_BVALID BIT(12)
82# define USBCFG_SESEND BIT(11)
83
84#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
85
86enum langwell_otg_timer_type {
87 TA_WAIT_VRISE_TMR,
88 TA_WAIT_BCON_TMR,
89 TA_AIDL_BDIS_TMR,
90 TB_ASE0_BRST_TMR,
91 TB_SE0_SRP_TMR,
92 TB_SRP_INIT_TMR,
93 TB_SRP_FAIL_TMR,
94 TB_BUS_SUSPEND_TMR
95};
96
97#define TA_WAIT_VRISE 100
98#define TA_WAIT_BCON 30000
99#define TA_AIDL_BDIS 15000
100#define TB_ASE0_BRST 5000
101#define TB_SE0_SRP 2
102#define TB_SRP_INIT 100
103#define TB_SRP_FAIL 5500
104#define TB_BUS_SUSPEND 500
105
106struct langwell_otg_timer {
107 unsigned long expires; /* Number of count increase to timeout */
108 unsigned long count; /* Tick counter */
109 void (*function)(unsigned long); /* Timeout function */
110 unsigned long data; /* Data passed to function */
111 struct list_head list;
112};
113
114struct langwell_otg {
115 struct intel_mid_otg_xceiv iotg;
116 struct device *dev;
117
118 void __iomem *usbcfg; /* SCCBUSB config Reg */
119
120 unsigned region;
121 unsigned cfg_region;
122
123 struct work_struct work;
124 struct workqueue_struct *qwork;
125 struct timer_list hsm_timer;
126
127 spinlock_t lock;
128 spinlock_t wq_lock;
129
130 struct notifier_block iotg_notifier;
131};
132
133static inline
134struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg)
135{
136 return container_of(iotg, struct langwell_otg, iotg);
137}
138
139#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 1d1040865661..c8c52e3c91de 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -70,7 +70,7 @@ struct usb_midi_out_jack_descriptor {
70 __u8 bJackID; 70 __u8 bJackID;
71 __u8 bNrInputPins; /* p */ 71 __u8 bNrInputPins; /* p */
72 struct usb_midi_source_pin pins[]; /* [p] */ 72 struct usb_midi_source_pin pins[]; /* [p] */
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */ 73 /*__u8 iJack; -- omitted due to variable-sized pins[] */
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p)) 76#define USB_DT_MIDI_OUT_SIZE(p) (7 + 2 * (p))
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
new file mode 100644
index 000000000000..00311fe9d0df
--- /dev/null
+++ b/include/linux/usb/msm_hsusb.h
@@ -0,0 +1,185 @@
1/* linux/include/asm-arm/arch-msm/hsusb.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
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 __ASM_ARCH_MSM_HSUSB_H
19#define __ASM_ARCH_MSM_HSUSB_H
20
21#include <linux/types.h>
22#include <linux/usb/otg.h>
23
24/**
25 * Supported USB modes
26 *
27 * USB_PERIPHERAL Only peripheral mode is supported.
28 * USB_HOST Only host mode is supported.
29 * USB_OTG OTG mode is supported.
30 *
31 */
32enum usb_mode_type {
33 USB_NONE = 0,
34 USB_PERIPHERAL,
35 USB_HOST,
36 USB_OTG,
37};
38
39/**
40 * OTG control
41 *
42 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
43 * only configuration.
44 * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
45 * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
46 * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
47 *
48 */
49enum otg_control_type {
50 OTG_NO_CONTROL = 0,
51 OTG_PHY_CONTROL,
52 OTG_PMIC_CONTROL,
53 OTG_USER_CONTROL,
54};
55
56/**
57 * PHY used in
58 *
59 * INVALID_PHY Unsupported PHY
60 * CI_45NM_INTEGRATED_PHY Chipidea 45nm integrated PHY
61 * SNPS_28NM_INTEGRATED_PHY Synopsis 28nm integrated PHY
62 *
63 */
64enum msm_usb_phy_type {
65 INVALID_PHY = 0,
66 CI_45NM_INTEGRATED_PHY,
67 SNPS_28NM_INTEGRATED_PHY,
68};
69
70#define IDEV_CHG_MAX 1500
71#define IUNIT 100
72
73/**
74 * Different states involved in USB charger detection.
75 *
76 * USB_CHG_STATE_UNDEFINED USB charger is not connected or detection
77 * process is not yet started.
78 * USB_CHG_STATE_WAIT_FOR_DCD Waiting for Data pins contact.
79 * USB_CHG_STATE_DCD_DONE Data pin contact is detected.
80 * USB_CHG_STATE_PRIMARY_DONE Primary detection is completed (Detects
81 * between SDP and DCP/CDP).
82 * USB_CHG_STATE_SECONDARY_DONE Secondary detection is completed (Detects
83 * between DCP and CDP).
84 * USB_CHG_STATE_DETECTED USB charger type is determined.
85 *
86 */
87enum usb_chg_state {
88 USB_CHG_STATE_UNDEFINED = 0,
89 USB_CHG_STATE_WAIT_FOR_DCD,
90 USB_CHG_STATE_DCD_DONE,
91 USB_CHG_STATE_PRIMARY_DONE,
92 USB_CHG_STATE_SECONDARY_DONE,
93 USB_CHG_STATE_DETECTED,
94};
95
96/**
97 * USB charger types
98 *
99 * USB_INVALID_CHARGER Invalid USB charger.
100 * USB_SDP_CHARGER Standard downstream port. Refers to a downstream port
101 * on USB2.0 compliant host/hub.
102 * USB_DCP_CHARGER Dedicated charger port (AC charger/ Wall charger).
103 * USB_CDP_CHARGER Charging downstream port. Enumeration can happen and
104 * IDEV_CHG_MAX can be drawn irrespective of USB state.
105 *
106 */
107enum usb_chg_type {
108 USB_INVALID_CHARGER = 0,
109 USB_SDP_CHARGER,
110 USB_DCP_CHARGER,
111 USB_CDP_CHARGER,
112};
113
114/**
115 * struct msm_otg_platform_data - platform device data
116 * for msm_otg driver.
117 * @phy_init_seq: PHY configuration sequence. val, reg pairs
118 * terminated by -1.
119 * @vbus_power: VBUS power on/off routine.
120 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
121 * @mode: Supported mode (OTG/peripheral/host).
122 * @otg_control: OTG switch controlled by user/Id pin
123 * @default_mode: Default operational mode. Applicable only if
124 * OTG switch is controller by user.
125 * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k
126 * dfab_usb_hs_clk in case of 8660 and 8960.
127 */
128struct msm_otg_platform_data {
129 int *phy_init_seq;
130 void (*vbus_power)(bool on);
131 unsigned power_budget;
132 enum usb_mode_type mode;
133 enum otg_control_type otg_control;
134 enum usb_mode_type default_mode;
135 enum msm_usb_phy_type phy_type;
136 void (*setup_gpio)(enum usb_otg_state state);
137 char *pclk_src_name;
138};
139
140/**
141 * struct msm_otg: OTG driver data. Shared by HCD and DCD.
142 * @otg: USB OTG Transceiver structure.
143 * @pdata: otg device platform data.
144 * @irq: IRQ number assigned for HSUSB controller.
145 * @clk: clock struct of usb_hs_clk.
146 * @pclk: clock struct of usb_hs_pclk.
147 * @pclk_src: pclk source for voting.
148 * @phy_reset_clk: clock struct of usb_phy_clk.
149 * @core_clk: clock struct of usb_hs_core_clk.
150 * @regs: ioremapped register base address.
151 * @inputs: OTG state machine inputs(Id, SessValid etc).
152 * @sm_work: OTG state machine work.
153 * @in_lpm: indicates low power mode (LPM) state.
154 * @async_int: Async interrupt arrived.
155 * @cur_power: The amount of mA available from downstream port.
156 * @chg_work: Charger detection work.
157 * @chg_state: The state of charger detection process.
158 * @chg_type: The type of charger attached.
159 * @dcd_retires: The retry count used to track Data contact
160 * detection process.
161 */
162struct msm_otg {
163 struct otg_transceiver otg;
164 struct msm_otg_platform_data *pdata;
165 int irq;
166 struct clk *clk;
167 struct clk *pclk;
168 struct clk *pclk_src;
169 struct clk *phy_reset_clk;
170 struct clk *core_clk;
171 void __iomem *regs;
172#define ID 0
173#define B_SESS_VLD 1
174 unsigned long inputs;
175 struct work_struct sm_work;
176 atomic_t in_lpm;
177 int async_int;
178 unsigned cur_power;
179 struct delayed_work chg_work;
180 enum usb_chg_state chg_state;
181 enum usb_chg_type chg_type;
182 u8 dcd_retries;
183};
184
185#endif
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
new file mode 100644
index 000000000000..6e97a2d3d39f
--- /dev/null
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Author: Brian Swetland <swetland@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18
19#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
20#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
21#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
22
23#define USB_USBCMD (MSM_USB_BASE + 0x0140)
24#define USB_PORTSC (MSM_USB_BASE + 0x0184)
25#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
26#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
27#define USB_PHY_CTRL (MSM_USB_BASE + 0x0240)
28
29#define USBCMD_RESET 2
30#define USB_USBINTR (MSM_USB_BASE + 0x0148)
31
32#define PORTSC_PHCD (1 << 23) /* phy suspend mode */
33#define PORTSC_PTS_MASK (3 << 30)
34#define PORTSC_PTS_ULPI (3 << 30)
35
36#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
37#define ULPI_RUN (1 << 30)
38#define ULPI_WRITE (1 << 29)
39#define ULPI_READ (0 << 29)
40#define ULPI_ADDR(n) (((n) & 255) << 16)
41#define ULPI_DATA(n) ((n) & 255)
42#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
43
44#define ASYNC_INTR_CTRL (1 << 29) /* Enable async interrupt */
45#define ULPI_STP_CTRL (1 << 30) /* Block communication with PHY */
46#define PHY_RETEN (1 << 1) /* PHY retention enable/disable */
47
48/* OTG definitions */
49#define OTGSC_INTSTS_MASK (0x7f << 16)
50#define OTGSC_ID (1 << 8)
51#define OTGSC_BSV (1 << 11)
52#define OTGSC_IDIS (1 << 16)
53#define OTGSC_BSVIS (1 << 19)
54#define OTGSC_IDIE (1 << 24)
55#define OTGSC_BSVIE (1 << 27)
56
57#endif /* __LINUX_USB_GADGET_MSM72K_UDC_H__ */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index ee2dd1d506ed..eb505250940a 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -3,7 +3,7 @@
3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC. 3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
4 * 4 *
5 * Board initialization should put one of these into dev->platform_data, 5 * Board initialization should put one of these into dev->platform_data,
6 * probably on some platform_device named "musb_hdrc". It encapsulates 6 * probably on some platform_device named "musb-hdrc". It encapsulates
7 * key configuration differences between boards. 7 * key configuration differences between boards.
8 */ 8 */
9 9
@@ -89,6 +89,8 @@ struct musb_hdrc_config {
89 /* A GPIO controlling VRSEL in Blackfin */ 89 /* A GPIO controlling VRSEL in Blackfin */
90 unsigned int gpio_vrsel; 90 unsigned int gpio_vrsel;
91 unsigned int gpio_vrsel_active; 91 unsigned int gpio_vrsel_active;
92 /* musb CLKIN in Blackfin in MHZ */
93 unsigned char clkin;
92#endif 94#endif
93 95
94}; 96};
@@ -118,14 +120,14 @@ struct musb_hdrc_platform_data {
118 /* Power the device on or off */ 120 /* Power the device on or off */
119 int (*set_power)(int state); 121 int (*set_power)(int state);
120 122
121 /* Turn device clock on or off */
122 int (*set_clock)(struct clk *clock, int is_on);
123
124 /* MUSB configuration-specific details */ 123 /* MUSB configuration-specific details */
125 struct musb_hdrc_config *config; 124 struct musb_hdrc_config *config;
126 125
127 /* Architecture specific board data */ 126 /* Architecture specific board data */
128 void *board_data; 127 void *board_data;
128
129 /* Platform specific struct musb_ops pointer */
130 const void *platform_ops;
129}; 131};
130 132
131 133
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h
deleted file mode 100644
index 006d1064c8b2..000000000000
--- a/include/linux/usb/ncm.h
+++ /dev/null
@@ -1,114 +0,0 @@
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
34struct 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
78static 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
95static 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/otg.h b/include/linux/usb/otg.h
index 545cba73ccaf..d87f44f5b04e 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -66,6 +66,7 @@ struct otg_transceiver {
66 66
67 u8 default_a; 67 u8 default_a;
68 enum usb_otg_state state; 68 enum usb_otg_state state;
69 enum usb_xceiv_events last_event;
69 70
70 struct usb_bus *host; 71 struct usb_bus *host;
71 struct usb_gadget *gadget; 72 struct usb_gadget *gadget;
@@ -74,7 +75,7 @@ struct otg_transceiver {
74 void __iomem *io_priv; 75 void __iomem *io_priv;
75 76
76 /* for notification of usb_xceiv_events */ 77 /* for notification of usb_xceiv_events */
77 struct blocking_notifier_head notifier; 78 struct atomic_notifier_head notifier;
78 79
79 /* to pass extra port status to the root hub */ 80 /* to pass extra port status to the root hub */
80 u16 port_status; 81 u16 port_status;
@@ -116,7 +117,7 @@ struct otg_transceiver {
116/* for board-specific init logic */ 117/* for board-specific init logic */
117extern int otg_set_transceiver(struct otg_transceiver *); 118extern int otg_set_transceiver(struct otg_transceiver *);
118 119
119#if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE) 120#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
120/* sometimes transceivers are accessed only through e.g. ULPI */ 121/* sometimes transceivers are accessed only through e.g. ULPI */
121extern void usb_nop_xceiv_register(void); 122extern void usb_nop_xceiv_register(void);
122extern void usb_nop_xceiv_unregister(void); 123extern void usb_nop_xceiv_unregister(void);
@@ -164,8 +165,25 @@ otg_shutdown(struct otg_transceiver *otg)
164} 165}
165 166
166/* for usb host and peripheral controller drivers */ 167/* for usb host and peripheral controller drivers */
168#ifdef CONFIG_USB_OTG_UTILS
167extern struct otg_transceiver *otg_get_transceiver(void); 169extern struct otg_transceiver *otg_get_transceiver(void);
168extern void otg_put_transceiver(struct otg_transceiver *); 170extern void otg_put_transceiver(struct otg_transceiver *);
171extern const char *otg_state_string(enum usb_otg_state state);
172#else
173static inline struct otg_transceiver *otg_get_transceiver(void)
174{
175 return NULL;
176}
177
178static inline void otg_put_transceiver(struct otg_transceiver *x)
179{
180}
181
182static inline const char *otg_state_string(enum usb_otg_state state)
183{
184 return NULL;
185}
186#endif
169 187
170/* Context: can sleep */ 188/* Context: can sleep */
171static inline int 189static inline int
@@ -223,13 +241,13 @@ otg_start_srp(struct otg_transceiver *otg)
223static inline int 241static inline int
224otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 242otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
225{ 243{
226 return blocking_notifier_chain_register(&otg->notifier, nb); 244 return atomic_notifier_chain_register(&otg->notifier, nb);
227} 245}
228 246
229static inline void 247static inline void
230otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) 248otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
231{ 249{
232 blocking_notifier_chain_unregister(&otg->notifier, nb); 250 atomic_notifier_chain_unregister(&otg->notifier, nb);
233} 251}
234 252
235/* for OTG controller drivers (and maybe other stuff) */ 253/* for OTG controller drivers (and maybe other stuff) */
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h
new file mode 100644
index 000000000000..3a7f1d982dd6
--- /dev/null
+++ b/include/linux/usb/renesas_usbhs.h
@@ -0,0 +1,156 @@
1/*
2 * Renesas USB
3 *
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 */
17#ifndef RENESAS_USB_H
18#define RENESAS_USB_H
19#include <linux/platform_device.h>
20#include <linux/usb/ch9.h>
21
22/*
23 * module type
24 *
25 * it will be return value from get_id
26 */
27enum {
28 USBHS_HOST = 0,
29 USBHS_GADGET,
30 USBHS_MAX,
31};
32
33/*
34 * callback functions table for driver
35 *
36 * These functions are called from platform for driver.
37 * Callback function's pointer will be set before
38 * renesas_usbhs_platform_callback :: hardware_init was called
39 */
40struct renesas_usbhs_driver_callback {
41 int (*notify_hotplug)(struct platform_device *pdev);
42};
43
44/*
45 * callback functions for platform
46 *
47 * These functions are called from driver for platform
48 */
49struct renesas_usbhs_platform_callback {
50
51 /*
52 * option:
53 *
54 * Hardware init function for platform.
55 * it is called when driver was probed.
56 */
57 int (*hardware_init)(struct platform_device *pdev);
58
59 /*
60 * option:
61 *
62 * Hardware exit function for platform.
63 * it is called when driver was removed
64 */
65 void (*hardware_exit)(struct platform_device *pdev);
66
67 /*
68 * option:
69 *
70 * Phy reset for platform
71 */
72 void (*phy_reset)(struct platform_device *pdev);
73
74 /*
75 * get USB ID function
76 * - USBHS_HOST
77 * - USBHS_GADGET
78 */
79 int (*get_id)(struct platform_device *pdev);
80
81 /*
82 * get VBUS status function.
83 */
84 int (*get_vbus)(struct platform_device *pdev);
85};
86
87/*
88 * parameters for renesas usbhs
89 *
90 * some register needs USB chip specific parameters.
91 * This struct show it to driver
92 */
93struct renesas_usbhs_driver_param {
94 /*
95 * pipe settings
96 */
97 u32 *pipe_type; /* array of USB_ENDPOINT_XFER_xxx (from ep0) */
98 int pipe_size; /* pipe_type array size */
99
100 /*
101 * option:
102 *
103 * for BUSWAIT :: BWAIT
104 * */
105 int buswait_bwait;
106
107 /*
108 * option:
109 *
110 * delay time from notify_hotplug callback
111 */
112 int detection_delay;
113};
114
115/*
116 * option:
117 *
118 * platform information for renesas_usbhs driver.
119 */
120struct renesas_usbhs_platform_info {
121 /*
122 * option:
123 *
124 * platform set these functions before
125 * call platform_add_devices if needed
126 */
127 struct renesas_usbhs_platform_callback platform_callback;
128
129 /*
130 * driver set these callback functions pointer.
131 * platform can use it on callback functions
132 */
133 struct renesas_usbhs_driver_callback driver_callback;
134
135 /*
136 * option:
137 *
138 * driver use these param for some register
139 */
140 struct renesas_usbhs_driver_param driver_param;
141};
142
143/*
144 * macro for platform
145 */
146#define renesas_usbhs_get_info(pdev)\
147 ((struct renesas_usbhs_platform_info *)(pdev)->dev.platform_data)
148
149#define renesas_usbhs_call_notify_hotplug(pdev) \
150 ({ \
151 struct renesas_usbhs_driver_callback *dc; \
152 dc = &(renesas_usbhs_get_info(pdev)->driver_callback); \
153 if (dc && dc->notify_hotplug) \
154 dc->notify_hotplug(pdev); \
155 })
156#endif /* RENESAS_USB_H */
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
index 05ef52861988..88fceb718c77 100644
--- a/include/linux/usb/rndis_host.h
+++ b/include/linux/usb/rndis_host.h
@@ -256,6 +256,8 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */
256#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001 256#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001
257#define FLAG_RNDIS_PHYM_WIRELESS 0x0002 257#define FLAG_RNDIS_PHYM_WIRELESS 0x0002
258 258
259/* Flags for driver_info::data */
260#define RNDIS_DRIVER_DATA_POLL_STATUS 1 /* poll status before control */
259 261
260extern void rndis_status(struct usbnet *dev, struct urb *urb); 262extern void rndis_status(struct usbnet *dev, struct urb *urb);
261extern int 263extern int
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 55675b1efb28..b29f70b2ecae 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -191,7 +191,8 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
191 * @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
192 * of the devices this structure can support. 192 * of the devices this structure can support.
193 * @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) 194 * @bulk_in_size: minimum number of bytes to allocate for bulk-in buffer
195 * (0 = end-point size)
195 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size) 196 * @bulk_out_size: bytes to allocate for bulk-out buffer (0 = end-point size)
196 * @calc_num_ports: pointer to a function to determine how many ports this 197 * @calc_num_ports: pointer to a function to determine how many ports this
197 * device has dynamically. It will be called after the probe() 198 * device has dynamically. It will be called after the probe()
@@ -260,7 +261,7 @@ struct usb_serial_driver {
260 const unsigned char *buf, int count); 261 const unsigned char *buf, int count);
261 /* Called only by the tty layer */ 262 /* Called only by the tty layer */
262 int (*write_room)(struct tty_struct *tty); 263 int (*write_room)(struct tty_struct *tty);
263 int (*ioctl)(struct tty_struct *tty, struct file *file, 264 int (*ioctl)(struct tty_struct *tty,
264 unsigned int cmd, unsigned long arg); 265 unsigned int cmd, unsigned long arg);
265 void (*set_termios)(struct tty_struct *tty, 266 void (*set_termios)(struct tty_struct *tty,
266 struct usb_serial_port *port, struct ktermios *old); 267 struct usb_serial_port *port, struct ktermios *old);
@@ -268,9 +269,11 @@ struct usb_serial_driver {
268 int (*chars_in_buffer)(struct tty_struct *tty); 269 int (*chars_in_buffer)(struct tty_struct *tty);
269 void (*throttle)(struct tty_struct *tty); 270 void (*throttle)(struct tty_struct *tty);
270 void (*unthrottle)(struct tty_struct *tty); 271 void (*unthrottle)(struct tty_struct *tty);
271 int (*tiocmget)(struct tty_struct *tty, struct file *file); 272 int (*tiocmget)(struct tty_struct *tty);
272 int (*tiocmset)(struct tty_struct *tty, struct file *file, 273 int (*tiocmset)(struct tty_struct *tty,
273 unsigned int set, unsigned int clear); 274 unsigned int set, unsigned int clear);
275 int (*get_icount)(struct tty_struct *tty,
276 struct serial_icounter_struct *icount);
274 /* Called by the tty layer for port level work. There may or may not 277 /* Called by the tty layer for port level work. There may or may not
275 be an attached tty at this point */ 278 be an attached tty at this point */
276 void (*dtr_rts)(struct usb_serial_port *port, int on); 279 void (*dtr_rts)(struct usb_serial_port *port, int on);
@@ -345,6 +348,9 @@ extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
345extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, 348extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
346 unsigned int ch); 349 unsigned int ch);
347extern int usb_serial_handle_break(struct usb_serial_port *port); 350extern int usb_serial_handle_break(struct usb_serial_port *port);
351extern void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
352 struct tty_struct *tty,
353 unsigned int status);
348 354
349 355
350extern int usb_serial_bus_register(struct usb_serial_driver *device); 356extern int usb_serial_bus_register(struct usb_serial_driver *device);
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h
new file mode 100644
index 000000000000..d7fc910f1dc4
--- /dev/null
+++ b/include/linux/usb/storage.h
@@ -0,0 +1,48 @@
1#ifndef __LINUX_USB_STORAGE_H
2#define __LINUX_USB_STORAGE_H
3
4/*
5 * linux/usb/storage.h
6 *
7 * Copyright Matthew Wilcox for Intel Corp, 2010
8 *
9 * This file contains definitions taken from the
10 * USB Mass Storage Class Specification Overview
11 *
12 * Distributed under the terms of the GNU GPL, version two.
13 */
14
15/* Storage subclass codes */
16
17#define USB_SC_RBC 0x01 /* Typically, flash devices */
18#define USB_SC_8020 0x02 /* CD-ROM */
19#define USB_SC_QIC 0x03 /* QIC-157 Tapes */
20#define USB_SC_UFI 0x04 /* Floppy */
21#define USB_SC_8070 0x05 /* Removable media */
22#define USB_SC_SCSI 0x06 /* Transparent */
23#define USB_SC_LOCKABLE 0x07 /* Password-protected */
24
25#define USB_SC_ISD200 0xf0 /* ISD200 ATA */
26#define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
27#define USB_SC_DEVICE 0xff /* Use device's value */
28
29/* Storage protocol codes */
30
31#define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */
32#define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */
33#define USB_PR_BULK 0x50 /* bulk only */
34#define USB_PR_UAS 0x62 /* USB Attached SCSI */
35
36#define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */
37#define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
38#define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */
39#define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
40#define USB_PR_FREECOM 0xf1 /* Freecom */
41#define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */
42#define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
43#define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */
44#define USB_PR_KARMA 0xf5 /* Rio Karma */
45
46#define USB_PR_DEVICE 0xff /* Use device's value */
47
48#endif
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
index 82b1507f4735..9595796d62ed 100644
--- a/include/linux/usb/ulpi.h
+++ b/include/linux/usb/ulpi.h
@@ -184,4 +184,9 @@
184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, 184struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
185 unsigned int flags); 185 unsigned int flags);
186 186
187#ifdef CONFIG_USB_ULPI_VIEWPORT
188/* access ops for controllers with a viewport register */
189extern struct otg_io_access_ops ulpi_viewport_access_ops;
190#endif
191
187#endif /* __LINUX_USB_ULPI_H */ 192#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 7ae27a473818..605b0aa8d852 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -68,6 +68,7 @@ struct usbnet {
68# define EVENT_RX_PAUSED 5 68# define EVENT_RX_PAUSED 5
69# define EVENT_DEV_WAKING 6 69# define EVENT_DEV_WAKING 6
70# define EVENT_DEV_ASLEEP 7 70# define EVENT_DEV_ASLEEP 7
71# define EVENT_DEV_OPEN 8
71}; 72};
72 73
73static inline struct usb_driver *driver_of(struct usb_interface *intf) 74static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -97,6 +98,15 @@ struct driver_info {
97 98
98#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ 99#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
99 100
101#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */
102
103/*
104 * Indicates to usbnet, that USB driver accumulates multiple IP packets.
105 * Affects statistic (counters) and short packet handling.
106 */
107#define FLAG_MULTI_PACKET 0x2000
108#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */
109
100 /* init device ... can sleep, or cause probe() failure */ 110 /* init device ... can sleep, or cause probe() failure */
101 int (*bind)(struct usbnet *, struct usb_interface *); 111 int (*bind)(struct usbnet *, struct usb_interface *);
102 112
@@ -166,7 +176,9 @@ struct cdc_state {
166}; 176};
167 177
168extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); 178extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *);
179extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *);
169extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); 180extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *);
181extern void usbnet_cdc_status(struct usbnet *, struct urb *);
170 182
171/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ 183/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
172#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ 184#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 63ebdcc5dda6..0c4d4ca370ec 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -126,7 +126,7 @@ enum {
126/** 126/**
127 * WUSB IE: Channel Stop (WUSB1.0[7.5.8]) 127 * WUSB IE: Channel Stop (WUSB1.0[7.5.8])
128 * 128 *
129 * Tells devices the host is going to stop sending MMCs and will dissapear. 129 * Tells devices the host is going to stop sending MMCs and will disappear.
130 */ 130 */
131struct wuie_channel_stop { 131struct wuie_channel_stop {
132 struct wuie_hdr hdr; 132 struct wuie_hdr hdr;