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/atmel_usba_udc.h1
-rw-r--r--include/linux/usb/audio.h120
-rw-r--r--include/linux/usb/ch9.h2
-rw-r--r--include/linux/usb/composite.h1
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--include/linux/usb/musb.h26
-rw-r--r--include/linux/usb/otg.h103
-rw-r--r--include/linux/usb/quirks.h3
-rw-r--r--include/linux/usb/serial.h19
-rw-r--r--include/linux/usb/ulpi.h7
-rw-r--r--include/linux/usb/usbnet.h29
-rw-r--r--include/linux/usb/vstusb.h71
-rw-r--r--include/linux/usb/wusb.h2
14 files changed, 263 insertions, 124 deletions
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 54c446309a2a..29fd73b0bffc 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -5,4 +5,3 @@ header-y += gadgetfs.h
5header-y += midi.h 5header-y += midi.h
6header-y += g_printer.h 6header-y += g_printer.h
7header-y += tmc.h 7header-y += tmc.h
8header-y += vstusb.h
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h
index 6311fa2d9f82..baf41c8616e9 100644
--- a/include/linux/usb/atmel_usba_udc.h
+++ b/include/linux/usb/atmel_usba_udc.h
@@ -15,6 +15,7 @@ struct usba_ep_data {
15 15
16struct usba_platform_data { 16struct usba_platform_data {
17 int vbus_pin; 17 int vbus_pin;
18 int vbus_pin_inverted;
18 int num_ep; 19 int num_ep;
19 struct usba_ep_data ep[0]; 20 struct usba_ep_data ep[0];
20}; 21};
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index eaf9dffe0a01..4d3e450e2b03 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -25,6 +25,9 @@
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27 27
28#define UAC_VERSION_1 0x00
29#define UAC_VERSION_2 0x20
30
28/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ 31/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
29#define UAC_HEADER 0x01 32#define UAC_HEADER 0x01
30#define UAC_INPUT_TERMINAL 0x02 33#define UAC_INPUT_TERMINAL 0x02
@@ -32,8 +35,17 @@
32#define UAC_MIXER_UNIT 0x04 35#define UAC_MIXER_UNIT 0x04
33#define UAC_SELECTOR_UNIT 0x05 36#define UAC_SELECTOR_UNIT 0x05
34#define UAC_FEATURE_UNIT 0x06 37#define UAC_FEATURE_UNIT 0x06
35#define UAC_PROCESSING_UNIT 0x07 38#define UAC_PROCESSING_UNIT_V1 0x07
36#define UAC_EXTENSION_UNIT 0x08 39#define UAC_EXTENSION_UNIT_V1 0x08
40
41/* UAC v2.0 types */
42#define UAC_EFFECT_UNIT 0x07
43#define UAC_PROCESSING_UNIT_V2 0x08
44#define UAC_EXTENSION_UNIT_V2 0x09
45#define UAC_CLOCK_SOURCE 0x0a
46#define UAC_CLOCK_SELECTOR 0x0b
47#define UAC_CLOCK_MULTIPLIER 0x0c
48#define UAC_SAMPLE_RATE_CONVERTER 0x0d
37 49
38/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 50/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
39#define UAC_AS_GENERAL 0x01 51#define UAC_AS_GENERAL 0x01
@@ -66,6 +78,10 @@
66 78
67#define UAC_GET_STAT 0xff 79#define UAC_GET_STAT 0xff
68 80
81/* Audio class v2.0 handles all the parameter calls differently */
82#define UAC2_CS_CUR 0x01
83#define UAC2_CS_RANGE 0x02
84
69/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ 85/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
70#define UAC_MS_HEADER 0x01 86#define UAC_MS_HEADER 0x01
71#define UAC_MIDI_IN_JACK 0x02 87#define UAC_MIDI_IN_JACK 0x02
@@ -81,7 +97,7 @@
81 97
82/* Terminal Control Selectors */ 98/* Terminal Control Selectors */
83/* 4.3.2 Class-Specific AC Interface Descriptor */ 99/* 4.3.2 Class-Specific AC Interface Descriptor */
84struct uac_ac_header_descriptor { 100struct uac_ac_header_descriptor_v1 {
85 __u8 bLength; /* 8 + n */ 101 __u8 bLength; /* 8 + n */
86 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 102 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
87 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ 103 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
@@ -95,7 +111,7 @@ struct uac_ac_header_descriptor {
95 111
96/* As above, but more useful for defining your own descriptors: */ 112/* As above, but more useful for defining your own descriptors: */
97#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 113#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
98struct uac_ac_header_descriptor_##n { \ 114struct uac_ac_header_descriptor_v1_##n { \
99 __u8 bLength; \ 115 __u8 bLength; \
100 __u8 bDescriptorType; \ 116 __u8 bDescriptorType; \
101 __u8 bDescriptorSubtype; \ 117 __u8 bDescriptorSubtype; \
@@ -130,8 +146,12 @@ struct uac_input_terminal_descriptor {
130#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 146#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
131#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 147#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
132 148
149/* Terminals - control selectors */
150
151#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
152
133/* 4.3.2.2 Output Terminal Descriptor */ 153/* 4.3.2.2 Output Terminal Descriptor */
134struct uac_output_terminal_descriptor { 154struct uac_output_terminal_descriptor_v1 {
135 __u8 bLength; /* in bytes: 9 */ 155 __u8 bLength; /* in bytes: 9 */
136 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 156 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
137 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ 157 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
@@ -171,7 +191,7 @@ struct uac_feature_unit_descriptor_##ch { \
171} __attribute__ ((packed)) 191} __attribute__ ((packed))
172 192
173/* 4.5.2 Class-Specific AS Interface Descriptor */ 193/* 4.5.2 Class-Specific AS Interface Descriptor */
174struct uac_as_header_descriptor { 194struct uac_as_header_descriptor_v1 {
175 __u8 bLength; /* in bytes: 7 */ 195 __u8 bLength; /* in bytes: 7 */
176 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 196 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
177 __u8 bDescriptorSubtype; /* AS_GENERAL */ 197 __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -180,6 +200,19 @@ struct uac_as_header_descriptor {
180 __le16 wFormatTag; /* The Audio Data Format */ 200 __le16 wFormatTag; /* The Audio Data Format */
181} __attribute__ ((packed)); 201} __attribute__ ((packed));
182 202
203struct uac_as_header_descriptor_v2 {
204 __u8 bLength;
205 __u8 bDescriptorType;
206 __u8 bDescriptorSubtype;
207 __u8 bTerminalLink;
208 __u8 bmControls;
209 __u8 bFormatType;
210 __u32 bmFormats;
211 __u8 bNrChannels;
212 __u32 bmChannelConfig;
213 __u8 iChannelNames;
214} __attribute__((packed));
215
183#define UAC_DT_AS_HEADER_SIZE 7 216#define UAC_DT_AS_HEADER_SIZE 7
184 217
185/* Formats - A.1.1 Audio Data Format Type I Codes */ 218/* Formats - A.1.1 Audio Data Format Type I Codes */
@@ -232,11 +265,62 @@ struct uac_format_type_i_discrete_descriptor_##n { \
232 265
233#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) 266#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
234 267
268struct uac_format_type_i_ext_descriptor {
269 __u8 bLength;
270 __u8 bDescriptorType;
271 __u8 bDescriptorSubtype;
272 __u8 bFormatType;
273 __u8 bSubslotSize;
274 __u8 bBitResolution;
275 __u8 bHeaderLength;
276 __u8 bControlSize;
277 __u8 bSideBandProtocol;
278} __attribute__((packed));
279
280
281/* Formats - Audio Data Format Type I Codes */
282
283#define UAC_FORMAT_TYPE_II_MPEG 0x1001
284#define UAC_FORMAT_TYPE_II_AC3 0x1002
285
286struct uac_format_type_ii_discrete_descriptor {
287 __u8 bLength;
288 __u8 bDescriptorType;
289 __u8 bDescriptorSubtype;
290 __u8 bFormatType;
291 __le16 wMaxBitRate;
292 __le16 wSamplesPerFrame;
293 __u8 bSamFreqType;
294 __u8 tSamFreq[][3];
295} __attribute__((packed));
296
297struct uac_format_type_ii_ext_descriptor {
298 __u8 bLength;
299 __u8 bDescriptorType;
300 __u8 bDescriptorSubtype;
301 __u8 bFormatType;
302 __u16 wMaxBitRate;
303 __u16 wSamplesPerFrame;
304 __u8 bHeaderLength;
305 __u8 bSideBandProtocol;
306} __attribute__((packed));
307
308/* type III */
309#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
310#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
311#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
312#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
313#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
314#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
315
235/* Formats - A.2 Format Type Codes */ 316/* Formats - A.2 Format Type Codes */
236#define UAC_FORMAT_TYPE_UNDEFINED 0x0 317#define UAC_FORMAT_TYPE_UNDEFINED 0x0
237#define UAC_FORMAT_TYPE_I 0x1 318#define UAC_FORMAT_TYPE_I 0x1
238#define UAC_FORMAT_TYPE_II 0x2 319#define UAC_FORMAT_TYPE_II 0x2
239#define UAC_FORMAT_TYPE_III 0x3 320#define UAC_FORMAT_TYPE_III 0x3
321#define UAC_EXT_FORMAT_TYPE_I 0x81
322#define UAC_EXT_FORMAT_TYPE_II 0x82
323#define UAC_EXT_FORMAT_TYPE_III 0x83
240 324
241struct uac_iso_endpoint_descriptor { 325struct uac_iso_endpoint_descriptor {
242 __u8 bLength; /* in bytes: 7 */ 326 __u8 bLength; /* in bytes: 7 */
@@ -252,7 +336,31 @@ struct uac_iso_endpoint_descriptor {
252#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 336#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
253#define UAC_EP_CS_ATTR_FILL_MAX 0x80 337#define UAC_EP_CS_ATTR_FILL_MAX 0x80
254 338
339/* Audio class v2.0: CLOCK_SOURCE descriptor */
340
341struct uac_clock_source_descriptor {
342 __u8 bLength;
343 __u8 bDescriptorType;
344 __u8 bDescriptorSubtype;
345 __u8 bClockID;
346 __u8 bmAttributes;
347 __u8 bmControls;
348 __u8 bAssocTerminal;
349 __u8 iClockSource;
350} __attribute__((packed));
351
255/* A.10.2 Feature Unit Control Selectors */ 352/* A.10.2 Feature Unit Control Selectors */
353
354struct uac_feature_unit_descriptor {
355 __u8 bLength;
356 __u8 bDescriptorType;
357 __u8 bDescriptorSubtype;
358 __u8 bUnitID;
359 __u8 bSourceID;
360 __u8 bControlSize;
361 __u8 controls[0]; /* variable length */
362} __attribute__((packed));
363
256#define UAC_FU_CONTROL_UNDEFINED 0x00 364#define UAC_FU_CONTROL_UNDEFINED 0x00
257#define UAC_MUTE_CONTROL 0x01 365#define UAC_MUTE_CONTROL 0x01
258#define UAC_VOLUME_CONTROL 0x02 366#define UAC_VOLUME_CONTROL 0x02
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 94012e649d86..e58369ff8168 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -775,7 +775,7 @@ enum usb_device_speed {
775 USB_SPEED_UNKNOWN = 0, /* enumerating */ 775 USB_SPEED_UNKNOWN = 0, /* enumerating */
776 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 776 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
777 USB_SPEED_HIGH, /* usb 2.0 */ 777 USB_SPEED_HIGH, /* usb 2.0 */
778 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ 778 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
779 USB_SPEED_SUPER, /* usb 3.0 */ 779 USB_SPEED_SUPER, /* usb 3.0 */
780}; 780};
781 781
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4f6bb3d2160e..738ea1a691cb 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -127,6 +127,7 @@ struct usb_function {
127 /* private: */ 127 /* private: */
128 /* internals */ 128 /* internals */
129 struct list_head list; 129 struct list_head list;
130 DECLARE_BITMAP(endpoints, 32);
130}; 131};
131 132
132int usb_add_function(struct usb_configuration *, struct usb_function *); 133int usb_add_function(struct usb_configuration *, struct usb_function *);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index bbf45d500b6d..f4b7ca516cdd 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,6 +15,8 @@
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/slab.h>
19
18struct usb_ep; 20struct usb_ep;
19 21
20/** 22/**
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index d43755669261..7acef0234c0e 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -30,26 +30,26 @@ struct musb_hdrc_eps_bits {
30struct musb_hdrc_config { 30struct musb_hdrc_config {
31 /* MUSB configuration-specific details */ 31 /* MUSB configuration-specific details */
32 unsigned multipoint:1; /* multipoint device */ 32 unsigned multipoint:1; /* multipoint device */
33 unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ 33 unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
34 unsigned soft_con:1; /* soft connect required */ 34 unsigned soft_con:1 __deprecated; /* soft connect required */
35 unsigned utm_16:1; /* utm data witdh is 16 bits */ 35 unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
36 unsigned big_endian:1; /* true if CPU uses big-endian */ 36 unsigned big_endian:1; /* true if CPU uses big-endian */
37 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ 37 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
38 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ 38 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
39 unsigned high_iso_tx:1; /* Tx ep required for HB iso */ 39 unsigned high_iso_tx:1; /* Tx ep required for HB iso */
40 unsigned high_iso_rx:1; /* Rx ep required for HD iso */ 40 unsigned high_iso_rx:1; /* Rx ep required for HD iso */
41 unsigned dma:1; /* supports DMA */ 41 unsigned dma:1 __deprecated; /* supports DMA */
42 unsigned vendor_req:1; /* vendor registers required */ 42 unsigned vendor_req:1 __deprecated; /* vendor registers required */
43 43
44 u8 num_eps; /* number of endpoints _with_ ep0 */ 44 u8 num_eps; /* number of endpoints _with_ ep0 */
45 u8 dma_channels; /* number of dma channels */ 45 u8 dma_channels __deprecated; /* number of dma channels */
46 u8 dyn_fifo_size; /* dynamic size in bytes */ 46 u8 dyn_fifo_size; /* dynamic size in bytes */
47 u8 vendor_ctrl; /* vendor control reg width */ 47 u8 vendor_ctrl __deprecated; /* vendor control reg width */
48 u8 vendor_stat; /* vendor status reg witdh */ 48 u8 vendor_stat __deprecated; /* vendor status reg witdh */
49 u8 dma_req_chan; /* bitmask for required dma channels */ 49 u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
50 u8 ram_bits; /* ram address size */ 50 u8 ram_bits; /* ram address size */
51 51
52 struct musb_hdrc_eps_bits *eps_bits; 52 struct musb_hdrc_eps_bits *eps_bits __deprecated;
53#ifdef CONFIG_BLACKFIN 53#ifdef CONFIG_BLACKFIN
54 /* A GPIO controlling VRSEL in Blackfin */ 54 /* A GPIO controlling VRSEL in Blackfin */
55 unsigned int gpio_vrsel; 55 unsigned int gpio_vrsel;
@@ -76,6 +76,9 @@ struct musb_hdrc_platform_data {
76 /* (HOST or OTG) msec/2 after VBUS on till power good */ 76 /* (HOST or OTG) msec/2 after VBUS on till power good */
77 u8 potpgt; 77 u8 potpgt;
78 78
79 /* (HOST or OTG) program PHY for external Vbus */
80 unsigned extvbus:1;
81
79 /* Power the device on or off */ 82 /* Power the device on or off */
80 int (*set_power)(int state); 83 int (*set_power)(int state);
81 84
@@ -84,6 +87,9 @@ struct musb_hdrc_platform_data {
84 87
85 /* MUSB configuration-specific details */ 88 /* MUSB configuration-specific details */
86 struct musb_hdrc_config *config; 89 struct musb_hdrc_config *config;
90
91 /* Architecture specific board data */
92 void *board_data;
87}; 93};
88 94
89 95
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 2443c0e7a80c..f8302d036a76 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -9,6 +9,8 @@
9#ifndef __LINUX_USB_OTG_H 9#ifndef __LINUX_USB_OTG_H
10#define __LINUX_USB_OTG_H 10#define __LINUX_USB_OTG_H
11 11
12#include <linux/notifier.h>
13
12/* OTG defines lots of enumeration states before device reset */ 14/* OTG defines lots of enumeration states before device reset */
13enum usb_otg_state { 15enum usb_otg_state {
14 OTG_STATE_UNDEFINED = 0, 16 OTG_STATE_UNDEFINED = 0,
@@ -33,6 +35,31 @@ enum usb_otg_state {
33 OTG_STATE_A_VBUS_ERR, 35 OTG_STATE_A_VBUS_ERR,
34}; 36};
35 37
38enum usb_xceiv_events {
39 USB_EVENT_NONE, /* no events or cable disconnected */
40 USB_EVENT_VBUS, /* vbus valid event */
41 USB_EVENT_ID, /* id was grounded */
42 USB_EVENT_CHARGER, /* usb dedicated charger */
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44};
45
46#define USB_OTG_PULLUP_ID (1 << 0)
47#define USB_OTG_PULLDOWN_DP (1 << 1)
48#define USB_OTG_PULLDOWN_DM (1 << 2)
49#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
50#define USB_OTG_DRV_VBUS (1 << 4)
51#define USB_OTG_DRV_VBUS_EXT (1 << 5)
52
53struct otg_transceiver;
54
55/* for transceivers connected thru an ULPI interface, the user must
56 * provide access ops
57 */
58struct otg_io_access_ops {
59 int (*read)(struct otg_transceiver *otg, u32 reg);
60 int (*write)(struct otg_transceiver *otg, u32 val, u32 reg);
61};
62
36/* 63/*
37 * the otg driver needs to interact with both device side and host side 64 * the otg driver needs to interact with both device side and host side
38 * usb controllers. it decides which controller is active at a given 65 * usb controllers. it decides which controller is active at a given
@@ -42,6 +69,7 @@ enum usb_otg_state {
42struct otg_transceiver { 69struct otg_transceiver {
43 struct device *dev; 70 struct device *dev;
44 const char *label; 71 const char *label;
72 unsigned int flags;
45 73
46 u8 default_a; 74 u8 default_a;
47 enum usb_otg_state state; 75 enum usb_otg_state state;
@@ -49,10 +77,20 @@ struct otg_transceiver {
49 struct usb_bus *host; 77 struct usb_bus *host;
50 struct usb_gadget *gadget; 78 struct usb_gadget *gadget;
51 79
80 struct otg_io_access_ops *io_ops;
81 void __iomem *io_priv;
82
83 /* for notification of usb_xceiv_events */
84 struct blocking_notifier_head notifier;
85
52 /* to pass extra port status to the root hub */ 86 /* to pass extra port status to the root hub */
53 u16 port_status; 87 u16 port_status;
54 u16 port_change; 88 u16 port_change;
55 89
90 /* initialize/shutdown the OTG controller */
91 int (*init)(struct otg_transceiver *otg);
92 void (*shutdown)(struct otg_transceiver *otg);
93
56 /* bind/unbind the host controller */ 94 /* bind/unbind the host controller */
57 int (*set_host)(struct otg_transceiver *otg, 95 int (*set_host)(struct otg_transceiver *otg,
58 struct usb_bus *host); 96 struct usb_bus *host);
@@ -65,6 +103,10 @@ struct otg_transceiver {
65 int (*set_power)(struct otg_transceiver *otg, 103 int (*set_power)(struct otg_transceiver *otg,
66 unsigned mA); 104 unsigned mA);
67 105
106 /* effective for A-peripheral, ignored for B devices */
107 int (*set_vbus)(struct otg_transceiver *otg,
108 bool enabled);
109
68 /* for non-OTG B devices: set transceiver into suspend mode */ 110 /* for non-OTG B devices: set transceiver into suspend mode */
69 int (*set_suspend)(struct otg_transceiver *otg, 111 int (*set_suspend)(struct otg_transceiver *otg,
70 int suspend); 112 int suspend);
@@ -81,10 +123,52 @@ struct otg_transceiver {
81/* for board-specific init logic */ 123/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 124extern int otg_set_transceiver(struct otg_transceiver *);
83 125
126#if defined(CONFIG_NOP_USB_XCEIV) || defined(CONFIG_NOP_USB_XCEIV_MODULE)
84/* sometimes transceivers are accessed only through e.g. ULPI */ 127/* sometimes transceivers are accessed only through e.g. ULPI */
85extern void usb_nop_xceiv_register(void); 128extern void usb_nop_xceiv_register(void);
86extern void usb_nop_xceiv_unregister(void); 129extern void usb_nop_xceiv_unregister(void);
130#else
131static inline void usb_nop_xceiv_register(void)
132{
133}
134
135static inline void usb_nop_xceiv_unregister(void)
136{
137}
138#endif
87 139
140/* helpers for direct access thru low-level io interface */
141static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
142{
143 if (otg->io_ops && otg->io_ops->read)
144 return otg->io_ops->read(otg, reg);
145
146 return -EINVAL;
147}
148
149static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val)
150{
151 if (otg->io_ops && otg->io_ops->write)
152 return otg->io_ops->write(otg, reg, val);
153
154 return -EINVAL;
155}
156
157static inline int
158otg_init(struct otg_transceiver *otg)
159{
160 if (otg->init)
161 return otg->init(otg);
162
163 return 0;
164}
165
166static inline void
167otg_shutdown(struct otg_transceiver *otg)
168{
169 if (otg->shutdown)
170 otg->shutdown(otg);
171}
88 172
89/* for usb host and peripheral controller drivers */ 173/* for usb host and peripheral controller drivers */
90extern struct otg_transceiver *otg_get_transceiver(void); 174extern struct otg_transceiver *otg_get_transceiver(void);
@@ -97,6 +181,12 @@ otg_start_hnp(struct otg_transceiver *otg)
97 return otg->start_hnp(otg); 181 return otg->start_hnp(otg);
98} 182}
99 183
184/* Context: can sleep */
185static inline int
186otg_set_vbus(struct otg_transceiver *otg, bool enabled)
187{
188 return otg->set_vbus(otg, enabled);
189}
100 190
101/* for HCDs */ 191/* for HCDs */
102static inline int 192static inline int
@@ -105,7 +195,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
105 return otg->set_host(otg, host); 195 return otg->set_host(otg, host);
106} 196}
107 197
108
109/* for usb peripheral controller drivers */ 198/* for usb peripheral controller drivers */
110 199
111/* Context: can sleep */ 200/* Context: can sleep */
@@ -137,6 +226,18 @@ otg_start_srp(struct otg_transceiver *otg)
137 return otg->start_srp(otg); 226 return otg->start_srp(otg);
138} 227}
139 228
229/* notifiers */
230static inline int
231otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
232{
233 return blocking_notifier_chain_register(&otg->notifier, nb);
234}
235
236static inline void
237otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb)
238{
239 blocking_notifier_chain_unregister(&otg->notifier, nb);
240}
140 241
141/* for OTG controller drivers (and maybe other stuff) */ 242/* for OTG controller drivers (and maybe other stuff) */
142extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 243extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 2526f3bbd273..0a555dd131fc 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -19,4 +19,7 @@
19/* device can't handle its Configuration or Interface strings */ 19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21 21
22/*device will morph if reset, don't use reset for handling errors */
23#define USB_QUIRK_RESET_MORPHS 0x00000010
24
22#endif /* __LINUX_USB_QUIRKS_H */ 25#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index ce911ebf91e8..0a458b861933 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -16,6 +16,7 @@
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/sysrq.h> 18#include <linux/sysrq.h>
19#include <linux/kfifo.h>
19 20
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 21#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ 22#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -39,8 +40,6 @@ enum port_dev_state {
39 * @serial: pointer back to the struct usb_serial owner of this port. 40 * @serial: pointer back to the struct usb_serial owner of this port.
40 * @port: pointer to the corresponding tty_port for this port. 41 * @port: pointer to the corresponding tty_port for this port.
41 * @lock: spinlock to grab when updating portions of this structure. 42 * @lock: spinlock to grab when updating portions of this structure.
42 * @mutex: mutex used to synchronize serial_open() and serial_close()
43 * access for this port.
44 * @number: the number of the port (the minor number). 43 * @number: the number of the port (the minor number).
45 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. 44 * @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
46 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. 45 * @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
@@ -77,7 +76,6 @@ struct usb_serial_port {
77 struct usb_serial *serial; 76 struct usb_serial *serial;
78 struct tty_port port; 77 struct tty_port port;
79 spinlock_t lock; 78 spinlock_t lock;
80 struct mutex mutex;
81 unsigned char number; 79 unsigned char number;
82 80
83 unsigned char *interrupt_in_buffer; 81 unsigned char *interrupt_in_buffer;
@@ -97,7 +95,7 @@ struct usb_serial_port {
97 unsigned char *bulk_out_buffer; 95 unsigned char *bulk_out_buffer;
98 int bulk_out_size; 96 int bulk_out_size;
99 struct urb *write_urb; 97 struct urb *write_urb;
100 struct kfifo *write_fifo; 98 struct kfifo write_fifo;
101 int write_urb_busy; 99 int write_urb_busy;
102 __u8 bulk_out_endpointAddress; 100 __u8 bulk_out_endpointAddress;
103 101
@@ -353,14 +351,11 @@ static inline void usb_serial_debug_data(int debug,
353 351
354/* Use our own dbg macro */ 352/* Use our own dbg macro */
355#undef dbg 353#undef dbg
356#define dbg(format, arg...) \ 354#define dbg(format, arg...) \
357 do { \ 355do { \
358 if (debug) \ 356 if (debug) \
359 printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ 357 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
360 ## arg); \ 358} while (0)
361 } while (0)
362
363
364 359
365#endif /* __LINUX_USB_SERIAL_H */ 360#endif /* __LINUX_USB_SERIAL_H */
366 361
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
new file mode 100644
index 000000000000..20675c6ebc4d
--- /dev/null
+++ b/include/linux/usb/ulpi.h
@@ -0,0 +1,7 @@
1#ifndef __LINUX_USB_ULPI_H
2#define __LINUX_USB_ULPI_H
3
4struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
5 unsigned int flags);
6
7#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f81473052059..df1e83dd9a54 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -55,6 +55,7 @@ struct usbnet {
55 struct sk_buff_head done; 55 struct sk_buff_head done;
56 struct sk_buff_head rxq_pause; 56 struct sk_buff_head rxq_pause;
57 struct urb *interrupt; 57 struct urb *interrupt;
58 struct usb_anchor deferred;
58 struct tasklet_struct bh; 59 struct tasklet_struct bh;
59 60
60 struct work_struct kevent; 61 struct work_struct kevent;
@@ -65,6 +66,8 @@ struct usbnet {
65# define EVENT_STS_SPLIT 3 66# define EVENT_STS_SPLIT 3
66# define EVENT_LINK_RESET 4 67# define EVENT_LINK_RESET 4
67# define EVENT_RX_PAUSED 5 68# define EVENT_RX_PAUSED 5
69# define EVENT_DEV_WAKING 6
70# define EVENT_DEV_ASLEEP 7
68}; 71};
69 72
70static inline struct usb_driver *driver_of(struct usb_interface *intf) 73static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -90,7 +93,9 @@ struct driver_info {
90#define FLAG_WLAN 0x0080 /* use "wlan%d" names */ 93#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
91#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ 94#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
92#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ 95#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
96#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
93 97
98#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
94 99
95 /* init device ... can sleep, or cause probe() failure */ 100 /* init device ... can sleep, or cause probe() failure */
96 int (*bind)(struct usbnet *, struct usb_interface *); 101 int (*bind)(struct usbnet *, struct usb_interface *);
@@ -107,6 +112,9 @@ struct driver_info {
107 /* see if peer is connected ... can sleep */ 112 /* see if peer is connected ... can sleep */
108 int (*check_connect)(struct usbnet *); 113 int (*check_connect)(struct usbnet *);
109 114
115 /* (dis)activate runtime power management */
116 int (*manage_power)(struct usbnet *, int);
117
110 /* for status polling */ 118 /* for status polling */
111 void (*status)(struct usbnet *, struct urb *); 119 void (*status)(struct usbnet *, struct urb *);
112 120
@@ -206,25 +214,4 @@ extern void usbnet_set_msglevel (struct net_device *, u32);
206extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *); 214extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
207extern int usbnet_nway_reset(struct net_device *net); 215extern int usbnet_nway_reset(struct net_device *net);
208 216
209/* messaging support includes the interface name, so it must not be
210 * used before it has one ... notably, in minidriver bind() calls.
211 */
212#ifdef DEBUG
213#define devdbg(usbnet, fmt, arg...) \
214 printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
215#else
216#define devdbg(usbnet, fmt, arg...) \
217 ({ if (0) printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , \
218 ## arg); 0; })
219#endif
220
221#define deverr(usbnet, fmt, arg...) \
222 printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
223#define devwarn(usbnet, fmt, arg...) \
224 printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
225
226#define devinfo(usbnet, fmt, arg...) \
227 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
228
229
230#endif /* __LINUX_USB_USBNET_H */ 217#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h
deleted file mode 100644
index 1cfac67191ff..000000000000
--- a/include/linux/usb/vstusb.h
+++ /dev/null
@@ -1,71 +0,0 @@
1/*****************************************************************************
2 * File: drivers/usb/misc/vstusb.h
3 *
4 * Purpose: Support for the bulk USB Vernier Spectrophotometers
5 *
6 * Author: EQware Engineering, Inc.
7 * Oregon City, OR, USA 97045
8 *
9 * Copyright: 2007, 2008
10 * Vernier Software & Technology
11 * Beaverton, OR, USA 97005
12 *
13 * Web: www.vernier.com
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18 *
19 *****************************************************************************/
20/*****************************************************************************
21 *
22 * The vstusb module is a standard usb 'client' driver running on top of the
23 * standard usb host controller stack.
24 *
25 * In general, vstusb supports standard bulk usb pipes. It supports multiple
26 * devices and multiple pipes per device.
27 *
28 * The vstusb driver supports two interfaces:
29 * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg
30 * interface to any pipe with timeout support;
31 * 2 - standard read/write with ioctl config - offers standard read/write
32 * interface with ioctl configured pipes and timeouts.
33 *
34 * Both interfaces can be signal from other process and will abort its i/o
35 * operation.
36 *
37 * A timeout of 0 means NO timeout. The user can still terminate the read via
38 * signal.
39 *
40 * If using multiple threads with this driver, the user should ensure that
41 * any reads, writes, or ioctls are complete before closing the device.
42 * Changing read/write timeouts or pipes takes effect on next read/write.
43 *
44 *****************************************************************************/
45
46struct vstusb_args {
47 union {
48 /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, *
49 * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */
50 struct {
51 void __user *buffer;
52 size_t count;
53 unsigned int timeout_ms;
54 int pipe;
55 };
56
57 /* this one is used for IOCTL_VSTUSB_CONFIG_RW */
58 struct {
59 int rd_pipe;
60 int rd_timeout_ms;
61 int wr_pipe;
62 int wr_timeout_ms;
63 };
64 };
65};
66
67#define VST_IOC_MAGIC 'L'
68#define VST_IOC_FIRST 0x20
69#define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST)
70#define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1)
71#define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2)
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 429c631d2aad..63ebdcc5dda6 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -74,7 +74,7 @@ enum {
74 * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of 74 * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of
75 * data. In order to avoid confusion and enforce types, we wrap it. 75 * data. In order to avoid confusion and enforce types, we wrap it.
76 * 76 *
77 * Make it packed, as we use it in some hw defintions. 77 * Make it packed, as we use it in some hw definitions.
78 */ 78 */
79struct wusb_ckhdid { 79struct wusb_ckhdid {
80 u8 data[16]; 80 u8 data[16];