diff options
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/audio.h | 265 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 17 | ||||
-rw-r--r-- | include/linux/usb/composite.h | 3 | ||||
-rw-r--r-- | include/linux/usb/langwell_otg.h | 177 | ||||
-rw-r--r-- | include/linux/usb/langwell_udc.h | 310 | ||||
-rw-r--r-- | include/linux/usb/otg.h | 4 | ||||
-rw-r--r-- | include/linux/usb/r8a66597.h | 44 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 42 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 1 |
9 files changed, 851 insertions, 12 deletions
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 8cb025fef634..b5744bc218ab 100644 --- a/include/linux/usb/audio.h +++ b/include/linux/usb/audio.h | |||
@@ -24,10 +24,75 @@ | |||
24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 | 24 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 |
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 | #define USB_SUBCLASS_VENDOR_SPEC 0xff | ||
27 | 28 | ||
29 | /* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/ | ||
30 | #define HEADER 0x01 | ||
31 | #define INPUT_TERMINAL 0x02 | ||
32 | #define OUTPUT_TERMINAL 0x03 | ||
33 | #define MIXER_UNIT 0x04 | ||
34 | #define SELECTOR_UNIT 0x05 | ||
35 | #define FEATURE_UNIT 0x06 | ||
36 | #define PROCESSING_UNIT 0x07 | ||
37 | #define EXTENSION_UNIT 0x08 | ||
38 | |||
39 | #define AS_GENERAL 0x01 | ||
40 | #define FORMAT_TYPE 0x02 | ||
41 | #define FORMAT_SPECIFIC 0x03 | ||
42 | |||
43 | #define EP_GENERAL 0x01 | ||
44 | |||
45 | #define MS_GENERAL 0x01 | ||
46 | #define MIDI_IN_JACK 0x02 | ||
47 | #define MIDI_OUT_JACK 0x03 | ||
48 | |||
49 | /* endpoint attributes */ | ||
50 | #define EP_ATTR_MASK 0x0c | ||
51 | #define EP_ATTR_ASYNC 0x04 | ||
52 | #define EP_ATTR_ADAPTIVE 0x08 | ||
53 | #define EP_ATTR_SYNC 0x0c | ||
54 | |||
55 | /* cs endpoint attributes */ | ||
56 | #define EP_CS_ATTR_SAMPLE_RATE 0x01 | ||
57 | #define EP_CS_ATTR_PITCH_CONTROL 0x02 | ||
58 | #define EP_CS_ATTR_FILL_MAX 0x80 | ||
59 | |||
60 | /* Audio Class specific Request Codes */ | ||
61 | #define USB_AUDIO_SET_INTF 0x21 | ||
62 | #define USB_AUDIO_SET_ENDPOINT 0x22 | ||
63 | #define USB_AUDIO_GET_INTF 0xa1 | ||
64 | #define USB_AUDIO_GET_ENDPOINT 0xa2 | ||
65 | |||
66 | #define SET_ 0x00 | ||
67 | #define GET_ 0x80 | ||
68 | |||
69 | #define _CUR 0x1 | ||
70 | #define _MIN 0x2 | ||
71 | #define _MAX 0x3 | ||
72 | #define _RES 0x4 | ||
73 | #define _MEM 0x5 | ||
74 | |||
75 | #define SET_CUR (SET_ | _CUR) | ||
76 | #define GET_CUR (GET_ | _CUR) | ||
77 | #define SET_MIN (SET_ | _MIN) | ||
78 | #define GET_MIN (GET_ | _MIN) | ||
79 | #define SET_MAX (SET_ | _MAX) | ||
80 | #define GET_MAX (GET_ | _MAX) | ||
81 | #define SET_RES (SET_ | _RES) | ||
82 | #define GET_RES (GET_ | _RES) | ||
83 | #define SET_MEM (SET_ | _MEM) | ||
84 | #define GET_MEM (GET_ | _MEM) | ||
85 | |||
86 | #define GET_STAT 0xff | ||
87 | |||
88 | #define USB_AC_TERMINAL_UNDEFINED 0x100 | ||
89 | #define USB_AC_TERMINAL_STREAMING 0x101 | ||
90 | #define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF | ||
91 | |||
92 | /* Terminal Control Selectors */ | ||
28 | /* 4.3.2 Class-Specific AC Interface Descriptor */ | 93 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
29 | struct usb_ac_header_descriptor { | 94 | struct usb_ac_header_descriptor { |
30 | __u8 bLength; /* 8+n */ | 95 | __u8 bLength; /* 8 + n */ |
31 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | 96 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
32 | __u8 bDescriptorSubtype; /* USB_MS_HEADER */ | 97 | __u8 bDescriptorSubtype; /* USB_MS_HEADER */ |
33 | __le16 bcdADC; /* 0x0100 */ | 98 | __le16 bcdADC; /* 0x0100 */ |
@@ -36,7 +101,7 @@ struct usb_ac_header_descriptor { | |||
36 | __u8 baInterfaceNr[]; /* [n] */ | 101 | __u8 baInterfaceNr[]; /* [n] */ |
37 | } __attribute__ ((packed)); | 102 | } __attribute__ ((packed)); |
38 | 103 | ||
39 | #define USB_DT_AC_HEADER_SIZE(n) (8+(n)) | 104 | #define USB_DT_AC_HEADER_SIZE(n) (8 + (n)) |
40 | 105 | ||
41 | /* As above, but more useful for defining your own descriptors: */ | 106 | /* As above, but more useful for defining your own descriptors: */ |
42 | #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ | 107 | #define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ |
@@ -50,4 +115,200 @@ struct usb_ac_header_descriptor_##n { \ | |||
50 | __u8 baInterfaceNr[n]; \ | 115 | __u8 baInterfaceNr[n]; \ |
51 | } __attribute__ ((packed)) | 116 | } __attribute__ ((packed)) |
52 | 117 | ||
118 | /* 4.3.2.1 Input Terminal Descriptor */ | ||
119 | struct usb_input_terminal_descriptor { | ||
120 | __u8 bLength; /* in bytes: 12 */ | ||
121 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | ||
122 | __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ | ||
123 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | ||
124 | __le16 wTerminalType; /* USB Audio Terminal Types */ | ||
125 | __u8 bAssocTerminal; /* ID of the Output Terminal associated */ | ||
126 | __u8 bNrChannels; /* Number of logical output channels */ | ||
127 | __le16 wChannelConfig; | ||
128 | __u8 iChannelNames; | ||
129 | __u8 iTerminal; | ||
130 | } __attribute__ ((packed)); | ||
131 | |||
132 | #define USB_DT_AC_INPUT_TERMINAL_SIZE 12 | ||
133 | |||
134 | #define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200 | ||
135 | #define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201 | ||
136 | #define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 | ||
137 | #define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 | ||
138 | #define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 | ||
139 | #define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 | ||
140 | #define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 | ||
141 | |||
142 | /* 4.3.2.2 Output Terminal Descriptor */ | ||
143 | struct usb_output_terminal_descriptor { | ||
144 | __u8 bLength; /* in bytes: 9 */ | ||
145 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | ||
146 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ | ||
147 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | ||
148 | __le16 wTerminalType; /* USB Audio Terminal Types */ | ||
149 | __u8 bAssocTerminal; /* ID of the Input Terminal associated */ | ||
150 | __u8 bSourceID; /* ID of the connected Unit or Terminal*/ | ||
151 | __u8 iTerminal; | ||
152 | } __attribute__ ((packed)); | ||
153 | |||
154 | #define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9 | ||
155 | |||
156 | #define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300 | ||
157 | #define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301 | ||
158 | #define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302 | ||
159 | #define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 | ||
160 | #define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 | ||
161 | #define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 | ||
162 | #define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 | ||
163 | #define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 | ||
164 | |||
165 | /* Set bControlSize = 2 as default setting */ | ||
166 | #define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) | ||
167 | |||
168 | /* As above, but more useful for defining your own descriptors: */ | ||
169 | #define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \ | ||
170 | struct usb_ac_feature_unit_descriptor_##ch { \ | ||
171 | __u8 bLength; \ | ||
172 | __u8 bDescriptorType; \ | ||
173 | __u8 bDescriptorSubtype; \ | ||
174 | __u8 bUnitID; \ | ||
175 | __u8 bSourceID; \ | ||
176 | __u8 bControlSize; \ | ||
177 | __le16 bmaControls[ch + 1]; \ | ||
178 | __u8 iFeature; \ | ||
179 | } __attribute__ ((packed)) | ||
180 | |||
181 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | ||
182 | struct usb_as_header_descriptor { | ||
183 | __u8 bLength; /* in bytes: 7 */ | ||
184 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
185 | __u8 bDescriptorSubtype; /* AS_GENERAL */ | ||
186 | __u8 bTerminalLink; /* Terminal ID of connected Terminal */ | ||
187 | __u8 bDelay; /* Delay introduced by the data path */ | ||
188 | __le16 wFormatTag; /* The Audio Data Format */ | ||
189 | } __attribute__ ((packed)); | ||
190 | |||
191 | #define USB_DT_AS_HEADER_SIZE 7 | ||
192 | |||
193 | #define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0 | ||
194 | #define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1 | ||
195 | #define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2 | ||
196 | #define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3 | ||
197 | #define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4 | ||
198 | #define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5 | ||
199 | |||
200 | struct usb_as_format_type_i_continuous_descriptor { | ||
201 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ | ||
202 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
203 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
204 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
205 | __u8 bNrChannels; /* physical channels in the stream */ | ||
206 | __u8 bSubframeSize; /* */ | ||
207 | __u8 bBitResolution; | ||
208 | __u8 bSamFreqType; | ||
209 | __u8 tLowerSamFreq[3]; | ||
210 | __u8 tUpperSamFreq[3]; | ||
211 | } __attribute__ ((packed)); | ||
212 | |||
213 | #define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 | ||
214 | |||
215 | struct usb_as_formate_type_i_discrete_descriptor { | ||
216 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ | ||
217 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | ||
218 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | ||
219 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | ||
220 | __u8 bNrChannels; /* physical channels in the stream */ | ||
221 | __u8 bSubframeSize; /* */ | ||
222 | __u8 bBitResolution; | ||
223 | __u8 bSamFreqType; | ||
224 | __u8 tSamFreq[][3]; | ||
225 | } __attribute__ ((packed)); | ||
226 | |||
227 | #define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \ | ||
228 | struct usb_as_formate_type_i_discrete_descriptor_##n { \ | ||
229 | __u8 bLength; \ | ||
230 | __u8 bDescriptorType; \ | ||
231 | __u8 bDescriptorSubtype; \ | ||
232 | __u8 bFormatType; \ | ||
233 | __u8 bNrChannels; \ | ||
234 | __u8 bSubframeSize; \ | ||
235 | __u8 bBitResolution; \ | ||
236 | __u8 bSamFreqType; \ | ||
237 | __u8 tSamFreq[n][3]; \ | ||
238 | } __attribute__ ((packed)) | ||
239 | |||
240 | #define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) | ||
241 | |||
242 | #define USB_AS_FORMAT_TYPE_UNDEFINED 0x0 | ||
243 | #define USB_AS_FORMAT_TYPE_I 0x1 | ||
244 | #define USB_AS_FORMAT_TYPE_II 0x2 | ||
245 | #define USB_AS_FORMAT_TYPE_III 0x3 | ||
246 | |||
247 | #define USB_AS_ENDPOINT_ASYNC (1 << 2) | ||
248 | #define USB_AS_ENDPOINT_ADAPTIVE (2 << 2) | ||
249 | #define USB_AS_ENDPOINT_SYNC (3 << 2) | ||
250 | |||
251 | struct usb_as_iso_endpoint_descriptor { | ||
252 | __u8 bLength; /* in bytes: 7 */ | ||
253 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ | ||
254 | __u8 bDescriptorSubtype; /* EP_GENERAL */ | ||
255 | __u8 bmAttributes; | ||
256 | __u8 bLockDelayUnits; | ||
257 | __le16 wLockDelay; | ||
258 | }; | ||
259 | #define USB_AS_ISO_ENDPOINT_DESC_SIZE 7 | ||
260 | |||
261 | #define FU_CONTROL_UNDEFINED 0x00 | ||
262 | #define MUTE_CONTROL 0x01 | ||
263 | #define VOLUME_CONTROL 0x02 | ||
264 | #define BASS_CONTROL 0x03 | ||
265 | #define MID_CONTROL 0x04 | ||
266 | #define TREBLE_CONTROL 0x05 | ||
267 | #define GRAPHIC_EQUALIZER_CONTROL 0x06 | ||
268 | #define AUTOMATIC_GAIN_CONTROL 0x07 | ||
269 | #define DELAY_CONTROL 0x08 | ||
270 | #define BASS_BOOST_CONTROL 0x09 | ||
271 | #define LOUDNESS_CONTROL 0x0a | ||
272 | |||
273 | #define FU_MUTE (1 << (MUTE_CONTROL - 1)) | ||
274 | #define FU_VOLUME (1 << (VOLUME_CONTROL - 1)) | ||
275 | #define FU_BASS (1 << (BASS_CONTROL - 1)) | ||
276 | #define FU_MID (1 << (MID_CONTROL - 1)) | ||
277 | #define FU_TREBLE (1 << (TREBLE_CONTROL - 1)) | ||
278 | #define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1)) | ||
279 | #define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1)) | ||
280 | #define FU_DELAY (1 << (DELAY_CONTROL - 1)) | ||
281 | #define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1)) | ||
282 | #define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1)) | ||
283 | |||
284 | struct usb_audio_control { | ||
285 | struct list_head list; | ||
286 | const char *name; | ||
287 | u8 type; | ||
288 | int data[5]; | ||
289 | int (*set)(struct usb_audio_control *con, u8 cmd, int value); | ||
290 | int (*get)(struct usb_audio_control *con, u8 cmd); | ||
291 | }; | ||
292 | |||
293 | static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) | ||
294 | { | ||
295 | con->data[cmd] = value; | ||
296 | |||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd) | ||
301 | { | ||
302 | return con->data[cmd]; | ||
303 | } | ||
304 | |||
305 | struct usb_audio_control_selector { | ||
306 | struct list_head list; | ||
307 | struct list_head control; | ||
308 | u8 id; | ||
309 | const char *name; | ||
310 | u8 type; | ||
311 | struct usb_descriptor_header *desc; | ||
312 | }; | ||
313 | |||
53 | #endif /* __LINUX_USB_AUDIO_H */ | 314 | #endif /* __LINUX_USB_AUDIO_H */ |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index b145119a90da..93223638f702 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -191,6 +191,8 @@ struct usb_ctrlrequest { | |||
191 | #define USB_DT_WIRE_ADAPTER 0x21 | 191 | #define USB_DT_WIRE_ADAPTER 0x21 |
192 | #define USB_DT_RPIPE 0x22 | 192 | #define USB_DT_RPIPE 0x22 |
193 | #define USB_DT_CS_RADIO_CONTROL 0x23 | 193 | #define USB_DT_CS_RADIO_CONTROL 0x23 |
194 | /* From the USB 3.0 spec */ | ||
195 | #define USB_DT_SS_ENDPOINT_COMP 0x30 | ||
194 | 196 | ||
195 | /* Conventional codes for class-specific descriptors. The convention is | 197 | /* Conventional codes for class-specific descriptors. The convention is |
196 | * defined in the USB "Common Class" Spec (3.11). Individual class specs | 198 | * defined in the USB "Common Class" Spec (3.11). Individual class specs |
@@ -535,6 +537,20 @@ static inline int usb_endpoint_is_isoc_out( | |||
535 | 537 | ||
536 | /*-------------------------------------------------------------------------*/ | 538 | /*-------------------------------------------------------------------------*/ |
537 | 539 | ||
540 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ | ||
541 | struct usb_ss_ep_comp_descriptor { | ||
542 | __u8 bLength; | ||
543 | __u8 bDescriptorType; | ||
544 | |||
545 | __u8 bMaxBurst; | ||
546 | __u8 bmAttributes; | ||
547 | __u16 wBytesPerInterval; | ||
548 | } __attribute__ ((packed)); | ||
549 | |||
550 | #define USB_DT_SS_EP_COMP_SIZE 6 | ||
551 | |||
552 | /*-------------------------------------------------------------------------*/ | ||
553 | |||
538 | /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ | 554 | /* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ |
539 | struct usb_qualifier_descriptor { | 555 | struct usb_qualifier_descriptor { |
540 | __u8 bLength; | 556 | __u8 bLength; |
@@ -752,6 +768,7 @@ enum usb_device_speed { | |||
752 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ | 768 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ |
753 | USB_SPEED_HIGH, /* usb 2.0 */ | 769 | USB_SPEED_HIGH, /* usb 2.0 */ |
754 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ | 770 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ |
771 | USB_SPEED_SUPER, /* usb 3.0 */ | ||
755 | }; | 772 | }; |
756 | 773 | ||
757 | enum usb_device_state { | 774 | enum usb_device_state { |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index acd7b0f06c8a..4f6bb3d2160e 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -124,6 +124,7 @@ struct usb_function { | |||
124 | void (*suspend)(struct usb_function *); | 124 | void (*suspend)(struct usb_function *); |
125 | void (*resume)(struct usb_function *); | 125 | void (*resume)(struct usb_function *); |
126 | 126 | ||
127 | /* private: */ | ||
127 | /* internals */ | 128 | /* internals */ |
128 | struct list_head list; | 129 | struct list_head list; |
129 | }; | 130 | }; |
@@ -219,6 +220,7 @@ struct usb_configuration { | |||
219 | 220 | ||
220 | struct usb_composite_dev *cdev; | 221 | struct usb_composite_dev *cdev; |
221 | 222 | ||
223 | /* private: */ | ||
222 | /* internals */ | 224 | /* internals */ |
223 | struct list_head list; | 225 | struct list_head list; |
224 | struct list_head functions; | 226 | struct list_head functions; |
@@ -321,6 +323,7 @@ struct usb_composite_dev { | |||
321 | 323 | ||
322 | struct usb_configuration *config; | 324 | struct usb_configuration *config; |
323 | 325 | ||
326 | /* private: */ | ||
324 | /* internals */ | 327 | /* internals */ |
325 | struct usb_device_descriptor desc; | 328 | struct usb_device_descriptor desc; |
326 | struct list_head configs; | 329 | struct list_head configs; |
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h new file mode 100644 index 000000000000..e115ae6df1da --- /dev/null +++ b/include/linux/usb/langwell_otg.h | |||
@@ -0,0 +1,177 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB OTG transceiver driver | ||
3 | * Copyright (C) 2008, 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 | /* notify transceiver driver about OTG events */ | ||
24 | extern void langwell_update_transceiver(void); | ||
25 | /* HCD register bus driver */ | ||
26 | extern int langwell_register_host(struct pci_driver *host_driver); | ||
27 | /* HCD unregister bus driver */ | ||
28 | extern void langwell_unregister_host(struct pci_driver *host_driver); | ||
29 | /* DCD register bus driver */ | ||
30 | extern int langwell_register_peripheral(struct pci_driver *client_driver); | ||
31 | /* DCD unregister bus driver */ | ||
32 | extern void langwell_unregister_peripheral(struct pci_driver *client_driver); | ||
33 | /* No silent failure, output warning message */ | ||
34 | extern void langwell_otg_nsf_msg(unsigned long message); | ||
35 | |||
36 | #define CI_USBCMD 0x30 | ||
37 | # define USBCMD_RST BIT(1) | ||
38 | # define USBCMD_RS BIT(0) | ||
39 | #define CI_USBSTS 0x34 | ||
40 | # define USBSTS_SLI BIT(8) | ||
41 | # define USBSTS_URI BIT(6) | ||
42 | # define USBSTS_PCI BIT(2) | ||
43 | #define CI_PORTSC1 0x74 | ||
44 | # define PORTSC_PP BIT(12) | ||
45 | # define PORTSC_LS (BIT(11) | BIT(10)) | ||
46 | # define PORTSC_SUSP BIT(7) | ||
47 | # define PORTSC_CCS BIT(0) | ||
48 | #define CI_HOSTPC1 0xb4 | ||
49 | # define HOSTPC1_PHCD BIT(22) | ||
50 | #define CI_OTGSC 0xf4 | ||
51 | # define OTGSC_DPIE BIT(30) | ||
52 | # define OTGSC_1MSE BIT(29) | ||
53 | # define OTGSC_BSEIE BIT(28) | ||
54 | # define OTGSC_BSVIE BIT(27) | ||
55 | # define OTGSC_ASVIE BIT(26) | ||
56 | # define OTGSC_AVVIE BIT(25) | ||
57 | # define OTGSC_IDIE BIT(24) | ||
58 | # define OTGSC_DPIS BIT(22) | ||
59 | # define OTGSC_1MSS BIT(21) | ||
60 | # define OTGSC_BSEIS BIT(20) | ||
61 | # define OTGSC_BSVIS BIT(19) | ||
62 | # define OTGSC_ASVIS BIT(18) | ||
63 | # define OTGSC_AVVIS BIT(17) | ||
64 | # define OTGSC_IDIS BIT(16) | ||
65 | # define OTGSC_DPS BIT(14) | ||
66 | # define OTGSC_1MST BIT(13) | ||
67 | # define OTGSC_BSE BIT(12) | ||
68 | # define OTGSC_BSV BIT(11) | ||
69 | # define OTGSC_ASV BIT(10) | ||
70 | # define OTGSC_AVV BIT(9) | ||
71 | # define OTGSC_ID BIT(8) | ||
72 | # define OTGSC_HABA BIT(7) | ||
73 | # define OTGSC_HADP BIT(6) | ||
74 | # define OTGSC_IDPU BIT(5) | ||
75 | # define OTGSC_DP BIT(4) | ||
76 | # define OTGSC_OT BIT(3) | ||
77 | # define OTGSC_HAAR BIT(2) | ||
78 | # define OTGSC_VC BIT(1) | ||
79 | # define OTGSC_VD BIT(0) | ||
80 | # define OTGSC_INTEN_MASK (0x7f << 24) | ||
81 | # define OTGSC_INTSTS_MASK (0x7f << 16) | ||
82 | #define CI_USBMODE 0xf8 | ||
83 | # define USBMODE_CM (BIT(1) | BIT(0)) | ||
84 | # define USBMODE_IDLE 0 | ||
85 | # define USBMODE_DEVICE 0x2 | ||
86 | # define USBMODE_HOST 0x3 | ||
87 | |||
88 | #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) | ||
89 | |||
90 | struct otg_hsm { | ||
91 | /* Input */ | ||
92 | int a_bus_resume; | ||
93 | int a_bus_suspend; | ||
94 | int a_conn; | ||
95 | int a_sess_vld; | ||
96 | int a_srp_det; | ||
97 | int a_vbus_vld; | ||
98 | int b_bus_resume; | ||
99 | int b_bus_suspend; | ||
100 | int b_conn; | ||
101 | int b_se0_srp; | ||
102 | int b_sess_end; | ||
103 | int b_sess_vld; | ||
104 | int id; | ||
105 | |||
106 | /* Internal variables */ | ||
107 | int a_set_b_hnp_en; | ||
108 | int b_srp_done; | ||
109 | int b_hnp_enable; | ||
110 | |||
111 | /* Timeout indicator for timers */ | ||
112 | int a_wait_vrise_tmout; | ||
113 | int a_wait_bcon_tmout; | ||
114 | int a_aidl_bdis_tmout; | ||
115 | int b_ase0_brst_tmout; | ||
116 | int b_bus_suspend_tmout; | ||
117 | int b_srp_res_tmout; | ||
118 | |||
119 | /* Informative variables */ | ||
120 | int a_bus_drop; | ||
121 | int a_bus_req; | ||
122 | int a_clr_err; | ||
123 | int a_suspend_req; | ||
124 | int b_bus_req; | ||
125 | |||
126 | /* Output */ | ||
127 | int drv_vbus; | ||
128 | int loc_conn; | ||
129 | int loc_sof; | ||
130 | |||
131 | /* Others */ | ||
132 | int b_bus_suspend_vld; | ||
133 | }; | ||
134 | |||
135 | #define TA_WAIT_VRISE 100 | ||
136 | #define TA_WAIT_BCON 30000 | ||
137 | #define TA_AIDL_BDIS 15000 | ||
138 | #define TB_ASE0_BRST 5000 | ||
139 | #define TB_SE0_SRP 2 | ||
140 | #define TB_SRP_RES 100 | ||
141 | #define TB_BUS_SUSPEND 500 | ||
142 | |||
143 | struct langwell_otg_timer { | ||
144 | unsigned long expires; /* Number of count increase to timeout */ | ||
145 | unsigned long count; /* Tick counter */ | ||
146 | void (*function)(unsigned long); /* Timeout function */ | ||
147 | unsigned long data; /* Data passed to function */ | ||
148 | struct list_head list; | ||
149 | }; | ||
150 | |||
151 | struct langwell_otg { | ||
152 | struct otg_transceiver otg; | ||
153 | struct otg_hsm hsm; | ||
154 | void __iomem *regs; | ||
155 | unsigned region; | ||
156 | struct pci_driver *host_ops; | ||
157 | struct pci_driver *client_ops; | ||
158 | struct pci_dev *pdev; | ||
159 | struct work_struct work; | ||
160 | struct workqueue_struct *qwork; | ||
161 | spinlock_t lock; | ||
162 | spinlock_t wq_lock; | ||
163 | }; | ||
164 | |||
165 | static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg) | ||
166 | { | ||
167 | return container_of(otg, struct langwell_otg, otg); | ||
168 | } | ||
169 | |||
170 | #ifdef DEBUG | ||
171 | #define otg_dbg(fmt, args...) \ | ||
172 | printk(KERN_DEBUG fmt , ## args) | ||
173 | #else | ||
174 | #define otg_dbg(fmt, args...) \ | ||
175 | do { } while (0) | ||
176 | #endif /* DEBUG */ | ||
177 | #endif /* __LANGWELL_OTG_H__ */ | ||
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h new file mode 100644 index 000000000000..c949178a6530 --- /dev/null +++ b/include/linux/usb/langwell_udc.h | |||
@@ -0,0 +1,310 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB Device Controller driver | ||
3 | * Copyright (C) 2008-2009, 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_UDC_H | ||
21 | #define __LANGWELL_UDC_H | ||
22 | |||
23 | |||
24 | /* MACRO defines */ | ||
25 | #define CAP_REG_OFFSET 0x0 | ||
26 | #define OP_REG_OFFSET 0x28 | ||
27 | |||
28 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | ||
29 | |||
30 | #define DQH_ALIGNMENT 2048 | ||
31 | #define DTD_ALIGNMENT 64 | ||
32 | #define DMA_BOUNDARY 4096 | ||
33 | |||
34 | #define EP0_MAX_PKT_SIZE 64 | ||
35 | #define EP_DIR_IN 1 | ||
36 | #define EP_DIR_OUT 0 | ||
37 | |||
38 | #define FLUSH_TIMEOUT 1000 | ||
39 | #define RESET_TIMEOUT 1000 | ||
40 | #define SETUPSTAT_TIMEOUT 100 | ||
41 | #define PRIME_TIMEOUT 100 | ||
42 | |||
43 | |||
44 | /* device memory space registers */ | ||
45 | |||
46 | /* Capability Registers, BAR0 + CAP_REG_OFFSET */ | ||
47 | struct langwell_cap_regs { | ||
48 | /* offset: 0x0 */ | ||
49 | u8 caplength; /* offset of Operational Register */ | ||
50 | u8 _reserved3; | ||
51 | u16 hciversion; /* H: BCD encoding of host version */ | ||
52 | u32 hcsparams; /* H: host port steering logic capability */ | ||
53 | u32 hccparams; /* H: host multiple mode control capability */ | ||
54 | #define HCC_LEN BIT(17) /* Link power management (LPM) capability */ | ||
55 | u8 _reserved4[0x20-0xc]; | ||
56 | /* offset: 0x20 */ | ||
57 | u16 dciversion; /* BCD encoding of device version */ | ||
58 | u8 _reserved5[0x24-0x22]; | ||
59 | u32 dccparams; /* overall device controller capability */ | ||
60 | #define HOSTCAP BIT(8) /* host capable */ | ||
61 | #define DEVCAP BIT(7) /* device capable */ | ||
62 | #define DEN(d) \ | ||
63 | (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */ | ||
64 | } __attribute__ ((packed)); | ||
65 | |||
66 | |||
67 | /* Operational Registers, BAR0 + OP_REG_OFFSET */ | ||
68 | struct langwell_op_regs { | ||
69 | /* offset: 0x28 */ | ||
70 | u32 extsts; | ||
71 | #define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */ | ||
72 | #define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */ | ||
73 | #define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */ | ||
74 | #define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */ | ||
75 | #define EXTS_TI1NAKI BIT(0) /* NAK interrupt */ | ||
76 | u32 extintr; | ||
77 | #define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */ | ||
78 | #define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */ | ||
79 | #define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */ | ||
80 | #define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */ | ||
81 | #define EXTI_NAKE BIT(0) /* NAK interrupt enable */ | ||
82 | /* offset: 0x30 */ | ||
83 | u32 usbcmd; | ||
84 | #define CMD_HIRD(u) \ | ||
85 | (((u)>>24)&0xf) /* bits 27:24, host init resume duration */ | ||
86 | #define CMD_ITC(u) \ | ||
87 | (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */ | ||
88 | #define CMD_PPE BIT(15) /* per-port change events enable */ | ||
89 | #define CMD_ATDTW BIT(14) /* add dTD tripwire */ | ||
90 | #define CMD_SUTW BIT(13) /* setup tripwire */ | ||
91 | #define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */ | ||
92 | #define CMD_FS2 BIT(10) /* frame list size */ | ||
93 | #define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */ | ||
94 | #define CMD_ASP0 BIT(8) | ||
95 | #define CMD_LR BIT(7) /* light host/device controller reset */ | ||
96 | #define CMD_IAA BIT(6) /* interrupt on async advance doorbell */ | ||
97 | #define CMD_ASE BIT(5) /* asynchronous schedule enable */ | ||
98 | #define CMD_PSE BIT(4) /* periodic schedule enable */ | ||
99 | #define CMD_FS1 BIT(3) | ||
100 | #define CMD_FS0 BIT(2) | ||
101 | #define CMD_RST BIT(1) /* controller reset */ | ||
102 | #define CMD_RUNSTOP BIT(0) /* run/stop */ | ||
103 | u32 usbsts; | ||
104 | #define STS_PPCI(u) \ | ||
105 | (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */ | ||
106 | #define STS_AS BIT(15) /* asynchronous schedule status */ | ||
107 | #define STS_PS BIT(14) /* periodic schedule status */ | ||
108 | #define STS_RCL BIT(13) /* reclamation */ | ||
109 | #define STS_HCH BIT(12) /* HC halted */ | ||
110 | #define STS_ULPII BIT(10) /* ULPI interrupt */ | ||
111 | #define STS_SLI BIT(8) /* DC suspend */ | ||
112 | #define STS_SRI BIT(7) /* SOF received */ | ||
113 | #define STS_URI BIT(6) /* USB reset received */ | ||
114 | #define STS_AAI BIT(5) /* interrupt on async advance */ | ||
115 | #define STS_SEI BIT(4) /* system error */ | ||
116 | #define STS_FRI BIT(3) /* frame list rollover */ | ||
117 | #define STS_PCI BIT(2) /* port change detect */ | ||
118 | #define STS_UEI BIT(1) /* USB error interrupt */ | ||
119 | #define STS_UI BIT(0) /* USB interrupt */ | ||
120 | u32 usbintr; | ||
121 | /* bits 31:16, per-port interrupt enable */ | ||
122 | #define INTR_PPCE(u) (((u)>>16)&0xffff) | ||
123 | #define INTR_ULPIE BIT(10) /* ULPI enable */ | ||
124 | #define INTR_SLE BIT(8) /* DC sleep/suspend enable */ | ||
125 | #define INTR_SRE BIT(7) /* SOF received enable */ | ||
126 | #define INTR_URE BIT(6) /* USB reset enable */ | ||
127 | #define INTR_AAE BIT(5) /* interrupt on async advance enable */ | ||
128 | #define INTR_SEE BIT(4) /* system error enable */ | ||
129 | #define INTR_FRE BIT(3) /* frame list rollover enable */ | ||
130 | #define INTR_PCE BIT(2) /* port change detect enable */ | ||
131 | #define INTR_UEE BIT(1) /* USB error interrupt enable */ | ||
132 | #define INTR_UE BIT(0) /* USB interrupt enable */ | ||
133 | u32 frindex; /* frame index */ | ||
134 | #define FRINDEX_MASK (0x3fff << 0) | ||
135 | u32 ctrldssegment; /* not used */ | ||
136 | u32 deviceaddr; | ||
137 | #define USBADR_SHIFT 25 | ||
138 | #define USBADR(d) \ | ||
139 | (((d)>>25)&0x7f) /* bits 31:25, device address */ | ||
140 | #define USBADR_MASK (0x7f << 25) | ||
141 | #define USBADRA BIT(24) /* device address advance */ | ||
142 | u32 endpointlistaddr;/* endpoint list top memory address */ | ||
143 | /* bits 31:11, endpoint list pointer */ | ||
144 | #define EPBASE(d) (((d)>>11)&0x1fffff) | ||
145 | #define ENDPOINTLISTADDR_MASK (0x1fffff << 11) | ||
146 | u32 ttctrl; /* H: TT operatin, not used */ | ||
147 | /* offset: 0x50 */ | ||
148 | u32 burstsize; /* burst size of data movement */ | ||
149 | #define TXPBURST(b) \ | ||
150 | (((b)>>8)&0xff) /* bits 15:8, TX burst length */ | ||
151 | #define RXPBURST(b) \ | ||
152 | (((b)>>0)&0xff) /* bits 7:0, RX burst length */ | ||
153 | u32 txfilltuning; /* TX tuning */ | ||
154 | u32 txttfilltuning; /* H: TX TT tuning */ | ||
155 | u32 ic_usb; /* control the IC_USB FS/LS transceiver */ | ||
156 | /* offset: 0x60 */ | ||
157 | u32 ulpi_viewport; /* indirect access to ULPI PHY */ | ||
158 | #define ULPIWU BIT(31) /* ULPI wakeup */ | ||
159 | #define ULPIRUN BIT(30) /* ULPI read/write run */ | ||
160 | #define ULPIRW BIT(29) /* ULPI read/write control */ | ||
161 | #define ULPISS BIT(27) /* ULPI sync state */ | ||
162 | #define ULPIPORT(u) \ | ||
163 | (((u)>>24)&7) /* bits 26:24, ULPI port number */ | ||
164 | #define ULPIADDR(u) \ | ||
165 | (((u)>>16)&0xff) /* bits 23:16, ULPI data address */ | ||
166 | #define ULPIDATRD(u) \ | ||
167 | (((u)>>8)&0xff) /* bits 15:8, ULPI data read */ | ||
168 | #define ULPIDATWR(u) \ | ||
169 | (((u)>>0)&0xff) /* bits 7:0, ULPI date write */ | ||
170 | u8 _reserved6[0x70-0x64]; | ||
171 | /* offset: 0x70 */ | ||
172 | u32 configflag; /* H: not used */ | ||
173 | u32 portsc1; /* port status */ | ||
174 | #define DA(p) \ | ||
175 | (((p)>>25)&0x7f) /* bits 31:25, device address */ | ||
176 | #define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */ | ||
177 | #define PORTS_WKOC BIT(22) /* wake on over-current enable */ | ||
178 | #define PORTS_WKDS BIT(21) /* wake on disconnect enable */ | ||
179 | #define PORTS_WKCN BIT(20) /* wake on connect enable */ | ||
180 | #define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */ | ||
181 | #define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */ | ||
182 | #define PORTS_PO BIT(13) /* port owner */ | ||
183 | #define PORTS_PP BIT(12) /* port power */ | ||
184 | #define PORTS_LS (BIT(11) | BIT(10)) /* line status */ | ||
185 | #define PORTS_SLP BIT(9) /* suspend using L1 */ | ||
186 | #define PORTS_PR BIT(8) /* port reset */ | ||
187 | #define PORTS_SUSP BIT(7) /* suspend */ | ||
188 | #define PORTS_FPR BIT(6) /* force port resume */ | ||
189 | #define PORTS_OCC BIT(5) /* over-current change */ | ||
190 | #define PORTS_OCA BIT(4) /* over-current active */ | ||
191 | #define PORTS_PEC BIT(3) /* port enable/disable change */ | ||
192 | #define PORTS_PE BIT(2) /* port enable/disable */ | ||
193 | #define PORTS_CSC BIT(1) /* connect status change */ | ||
194 | #define PORTS_CCS BIT(0) /* current connect status */ | ||
195 | u8 _reserved7[0xb4-0x78]; | ||
196 | /* offset: 0xb4 */ | ||
197 | u32 devlc; /* control LPM and each USB port behavior */ | ||
198 | /* bits 31:29, parallel transceiver select */ | ||
199 | #define LPM_PTS(d) (((d)>>29)&7) | ||
200 | #define LPM_STS BIT(28) /* serial transceiver select */ | ||
201 | #define LPM_PTW BIT(27) /* parallel transceiver width */ | ||
202 | #define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */ | ||
203 | #define LPM_PSPD_MASK (BIT(26) | BIT(25)) | ||
204 | #define LPM_SPEED_FULL 0 | ||
205 | #define LPM_SPEED_LOW 1 | ||
206 | #define LPM_SPEED_HIGH 2 | ||
207 | #define LPM_SRT BIT(24) /* shorten reset time */ | ||
208 | #define LPM_PFSC BIT(23) /* port force full speed connect */ | ||
209 | #define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */ | ||
210 | #define LPM_STL BIT(16) /* STALL reply to LPM token */ | ||
211 | #define LPM_BA(d) \ | ||
212 | (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */ | ||
213 | #define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */ | ||
214 | u8 _reserved8[0xf4-0xb8]; | ||
215 | /* offset: 0xf4 */ | ||
216 | u32 otgsc; /* On-The-Go status and control */ | ||
217 | #define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */ | ||
218 | #define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */ | ||
219 | #define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */ | ||
220 | #define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */ | ||
221 | #define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */ | ||
222 | #define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */ | ||
223 | #define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */ | ||
224 | #define OTGSC_DPIS BIT(22) /* data pulse interrupt status */ | ||
225 | #define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */ | ||
226 | #define OTGSC_BSEIS BIT(20) /* B session end interrupt status */ | ||
227 | #define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */ | ||
228 | #define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */ | ||
229 | #define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */ | ||
230 | #define OTGSC_IDIS BIT(16) /* USB ID interrupt status */ | ||
231 | #define OTGSC_DPS BIT(14) /* data bus pulsing status */ | ||
232 | #define OTGSC_MST BIT(13) /* 1 ms timer toggle */ | ||
233 | #define OTGSC_BSE BIT(12) /* B session end */ | ||
234 | #define OTGSC_BSV BIT(11) /* B session valid */ | ||
235 | #define OTGSC_ASV BIT(10) /* A session valid */ | ||
236 | #define OTGSC_AVV BIT(9) /* A VBUS valid */ | ||
237 | #define OTGSC_USBID BIT(8) /* USB ID */ | ||
238 | #define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */ | ||
239 | #define OTGSC_HADP BIT(6) /* hw assist data pulse */ | ||
240 | #define OTGSC_IDPU BIT(5) /* ID pullup */ | ||
241 | #define OTGSC_DP BIT(4) /* data pulsing */ | ||
242 | #define OTGSC_OT BIT(3) /* OTG termination */ | ||
243 | #define OTGSC_HAAR BIT(2) /* hw assist auto reset */ | ||
244 | #define OTGSC_VC BIT(1) /* VBUS charge */ | ||
245 | #define OTGSC_VD BIT(0) /* VBUS discharge */ | ||
246 | u32 usbmode; | ||
247 | #define MODE_VBPS BIT(5) /* R/W VBUS power select */ | ||
248 | #define MODE_SDIS BIT(4) /* R/W stream disable mode */ | ||
249 | #define MODE_SLOM BIT(3) /* R/W setup lockout mode */ | ||
250 | #define MODE_ENSE BIT(2) /* endian select */ | ||
251 | #define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */ | ||
252 | #define MODE_IDLE 0 | ||
253 | #define MODE_DEVICE 2 | ||
254 | #define MODE_HOST 3 | ||
255 | u8 _reserved9[0x100-0xfc]; | ||
256 | /* offset: 0x100 */ | ||
257 | u32 endptnak; | ||
258 | #define EPTN(e) \ | ||
259 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */ | ||
260 | #define EPRN(e) \ | ||
261 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */ | ||
262 | u32 endptnaken; | ||
263 | #define EPTNE(e) \ | ||
264 | (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */ | ||
265 | #define EPRNE(e) \ | ||
266 | (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */ | ||
267 | u32 endptsetupstat; | ||
268 | #define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */ | ||
269 | #define EP0SETUPSTAT_MASK 1 | ||
270 | u32 endptprime; | ||
271 | /* bits 31:16, prime endpoint transmit buffer */ | ||
272 | #define PETB(e) (((e)>>16)&0xffff) | ||
273 | /* bits 15:0, prime endpoint receive buffer */ | ||
274 | #define PERB(e) (((e)>>0)&0xffff) | ||
275 | /* offset: 0x110 */ | ||
276 | u32 endptflush; | ||
277 | /* bits 31:16, flush endpoint transmit buffer */ | ||
278 | #define FETB(e) (((e)>>16)&0xffff) | ||
279 | /* bits 15:0, flush endpoint receive buffer */ | ||
280 | #define FERB(e) (((e)>>0)&0xffff) | ||
281 | u32 endptstat; | ||
282 | /* bits 31:16, endpoint transmit buffer ready */ | ||
283 | #define ETBR(e) (((e)>>16)&0xffff) | ||
284 | /* bits 15:0, endpoint receive buffer ready */ | ||
285 | #define ERBR(e) (((e)>>0)&0xffff) | ||
286 | u32 endptcomplete; | ||
287 | /* bits 31:16, endpoint transmit complete event */ | ||
288 | #define ETCE(e) (((e)>>16)&0xffff) | ||
289 | /* bits 15:0, endpoint receive complete event */ | ||
290 | #define ERCE(e) (((e)>>0)&0xffff) | ||
291 | /* offset: 0x11c */ | ||
292 | u32 endptctrl[16]; | ||
293 | #define EPCTRL_TXE BIT(23) /* TX endpoint enable */ | ||
294 | #define EPCTRL_TXR BIT(22) /* TX data toggle reset */ | ||
295 | #define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */ | ||
296 | #define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */ | ||
297 | #define EPCTRL_TXT_SHIFT 18 | ||
298 | #define EPCTRL_TXD BIT(17) /* TX endpoint data source */ | ||
299 | #define EPCTRL_TXS BIT(16) /* TX endpoint STALL */ | ||
300 | #define EPCTRL_RXE BIT(7) /* RX endpoint enable */ | ||
301 | #define EPCTRL_RXR BIT(6) /* RX data toggle reset */ | ||
302 | #define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */ | ||
303 | #define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */ | ||
304 | #define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */ | ||
305 | #define EPCTRL_RXD BIT(1) /* RX endpoint data sink */ | ||
306 | #define EPCTRL_RXS BIT(0) /* RX endpoint STALL */ | ||
307 | } __attribute__ ((packed)); | ||
308 | |||
309 | #endif /* __LANGWELL_UDC_H */ | ||
310 | |||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 1aaa826396a1..2443c0e7a80c 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -80,10 +80,10 @@ struct otg_transceiver { | |||
80 | 80 | ||
81 | /* for board-specific init logic */ | 81 | /* for board-specific init logic */ |
82 | extern int otg_set_transceiver(struct otg_transceiver *); | 82 | extern int otg_set_transceiver(struct otg_transceiver *); |
83 | #ifdef CONFIG_NOP_USB_XCEIV | 83 | |
84 | /* sometimes transceivers are accessed only through e.g. ULPI */ | ||
84 | extern void usb_nop_xceiv_register(void); | 85 | extern void usb_nop_xceiv_register(void); |
85 | extern void usb_nop_xceiv_unregister(void); | 86 | extern void usb_nop_xceiv_unregister(void); |
86 | #endif | ||
87 | 87 | ||
88 | 88 | ||
89 | /* for usb host and peripheral controller drivers */ | 89 | /* for usb host and peripheral controller drivers */ |
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h new file mode 100644 index 000000000000..e9f0384fa20c --- /dev/null +++ b/include/linux/usb/r8a66597.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * R8A66597 driver platform data | ||
3 | * | ||
4 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
5 | * | ||
6 | * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; version 2 of the License. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_USB_R8A66597_H | ||
24 | #define __LINUX_USB_R8A66597_H | ||
25 | |||
26 | #define R8A66597_PLATDATA_XTAL_12MHZ 0x01 | ||
27 | #define R8A66597_PLATDATA_XTAL_24MHZ 0x02 | ||
28 | #define R8A66597_PLATDATA_XTAL_48MHZ 0x03 | ||
29 | |||
30 | struct r8a66597_platdata { | ||
31 | /* This ops can controll port power instead of DVSTCTR register. */ | ||
32 | void (*port_power)(int port, int power); | ||
33 | |||
34 | /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ | ||
35 | unsigned xtal:2; | ||
36 | |||
37 | /* set one = 3.3V, set zero = 1.5V */ | ||
38 | unsigned vif:1; | ||
39 | |||
40 | /* set one = big endian, set zero = little endian */ | ||
41 | unsigned endian:1; | ||
42 | }; | ||
43 | #endif | ||
44 | |||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 625e9e4639c6..44801d26a37a 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
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 | 19 | ||
19 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
20 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
@@ -26,6 +27,13 @@ | |||
26 | /* parity check flag */ | 27 | /* parity check flag */ |
27 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | 28 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) |
28 | 29 | ||
30 | enum port_dev_state { | ||
31 | PORT_UNREGISTERED, | ||
32 | PORT_REGISTERING, | ||
33 | PORT_REGISTERED, | ||
34 | PORT_UNREGISTERING, | ||
35 | }; | ||
36 | |||
29 | /** | 37 | /** |
30 | * usb_serial_port: structure for the specific ports of a device. | 38 | * usb_serial_port: structure for the specific ports of a device. |
31 | * @serial: pointer back to the struct usb_serial owner of this port. | 39 | * @serial: pointer back to the struct usb_serial owner of this port. |
@@ -91,12 +99,17 @@ struct usb_serial_port { | |||
91 | int write_urb_busy; | 99 | int write_urb_busy; |
92 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
93 | 101 | ||
102 | int tx_bytes_flight; | ||
103 | int urbs_in_flight; | ||
104 | |||
94 | wait_queue_head_t write_wait; | 105 | wait_queue_head_t write_wait; |
95 | struct work_struct work; | 106 | struct work_struct work; |
96 | char throttled; | 107 | char throttled; |
97 | char throttle_req; | 108 | char throttle_req; |
98 | char console; | 109 | char console; |
110 | unsigned long sysrq; /* sysrq timeout */ | ||
99 | struct device dev; | 111 | struct device dev; |
112 | enum port_dev_state dev_state; | ||
100 | }; | 113 | }; |
101 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) | 114 | #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) |
102 | 115 | ||
@@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data) | |||
181 | * This will be called when the struct usb_serial structure is fully set | 194 | * This will be called when the struct usb_serial structure is fully set |
182 | * set up. Do any local initialization of the device, or any private | 195 | * set up. Do any local initialization of the device, or any private |
183 | * memory structure allocation at this point in time. | 196 | * memory structure allocation at this point in time. |
184 | * @shutdown: pointer to the driver's shutdown function. This will be | 197 | * @disconnect: pointer to the driver's disconnect function. This will be |
185 | * called when the device is removed from the system. | 198 | * called when the device is unplugged or unbound from the driver. |
199 | * @release: pointer to the driver's release function. This will be called | ||
200 | * when the usb_serial data structure is about to be destroyed. | ||
186 | * @usb_driver: pointer to the struct usb_driver that controls this | 201 | * @usb_driver: pointer to the struct usb_driver that controls this |
187 | * device. This is necessary to allow dynamic ids to be added to | 202 | * device. This is necessary to allow dynamic ids to be added to |
188 | * the driver from sysfs. | 203 | * the driver from sysfs. |
@@ -207,12 +222,14 @@ struct usb_serial_driver { | |||
207 | struct device_driver driver; | 222 | struct device_driver driver; |
208 | struct usb_driver *usb_driver; | 223 | struct usb_driver *usb_driver; |
209 | struct usb_dynids dynids; | 224 | struct usb_dynids dynids; |
225 | int max_in_flight_urbs; | ||
210 | 226 | ||
211 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); | 227 | int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); |
212 | int (*attach)(struct usb_serial *serial); | 228 | int (*attach)(struct usb_serial *serial); |
213 | int (*calc_num_ports) (struct usb_serial *serial); | 229 | int (*calc_num_ports) (struct usb_serial *serial); |
214 | 230 | ||
215 | void (*shutdown)(struct usb_serial *serial); | 231 | void (*disconnect)(struct usb_serial *serial); |
232 | void (*release)(struct usb_serial *serial); | ||
216 | 233 | ||
217 | int (*port_probe)(struct usb_serial_port *port); | 234 | int (*port_probe)(struct usb_serial_port *port); |
218 | int (*port_remove)(struct usb_serial_port *port); | 235 | int (*port_remove)(struct usb_serial_port *port); |
@@ -224,8 +241,7 @@ struct usb_serial_driver { | |||
224 | /* Called by console with tty = NULL and by tty */ | 241 | /* Called by console with tty = NULL and by tty */ |
225 | int (*open)(struct tty_struct *tty, | 242 | int (*open)(struct tty_struct *tty, |
226 | struct usb_serial_port *port, struct file *filp); | 243 | struct usb_serial_port *port, struct file *filp); |
227 | void (*close)(struct tty_struct *tty, | 244 | void (*close)(struct usb_serial_port *port); |
228 | struct usb_serial_port *port, struct file *filp); | ||
229 | int (*write)(struct tty_struct *tty, struct usb_serial_port *port, | 245 | int (*write)(struct tty_struct *tty, struct usb_serial_port *port, |
230 | const unsigned char *buf, int count); | 246 | const unsigned char *buf, int count); |
231 | /* Called only by the tty layer */ | 247 | /* Called only by the tty layer */ |
@@ -241,6 +257,10 @@ struct usb_serial_driver { | |||
241 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 257 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
242 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 258 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
243 | unsigned int set, unsigned int clear); | 259 | unsigned int set, unsigned int clear); |
260 | /* Called by the tty layer for port level work. There may or may not | ||
261 | be an attached tty at this point */ | ||
262 | void (*dtr_rts)(struct usb_serial_port *port, int on); | ||
263 | int (*carrier_raised)(struct usb_serial_port *port); | ||
244 | /* USB events */ | 264 | /* USB events */ |
245 | void (*read_int_callback)(struct urb *urb); | 265 | void (*read_int_callback)(struct urb *urb); |
246 | void (*write_int_callback)(struct urb *urb); | 266 | void (*write_int_callback)(struct urb *urb); |
@@ -283,8 +303,7 @@ extern int usb_serial_generic_open(struct tty_struct *tty, | |||
283 | struct usb_serial_port *port, struct file *filp); | 303 | struct usb_serial_port *port, struct file *filp); |
284 | extern int usb_serial_generic_write(struct tty_struct *tty, | 304 | extern int usb_serial_generic_write(struct tty_struct *tty, |
285 | struct usb_serial_port *port, const unsigned char *buf, int count); | 305 | struct usb_serial_port *port, const unsigned char *buf, int count); |
286 | extern void usb_serial_generic_close(struct tty_struct *tty, | 306 | extern void usb_serial_generic_close(struct usb_serial_port *port); |
287 | struct usb_serial_port *port, struct file *filp); | ||
288 | extern int usb_serial_generic_resume(struct usb_serial *serial); | 307 | extern int usb_serial_generic_resume(struct usb_serial *serial); |
289 | extern int usb_serial_generic_write_room(struct tty_struct *tty); | 308 | extern int usb_serial_generic_write_room(struct tty_struct *tty); |
290 | extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); | 309 | extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); |
@@ -292,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb); | |||
292 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); | 311 | extern void usb_serial_generic_write_bulk_callback(struct urb *urb); |
293 | extern void usb_serial_generic_throttle(struct tty_struct *tty); | 312 | extern void usb_serial_generic_throttle(struct tty_struct *tty); |
294 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); | 313 | extern void usb_serial_generic_unthrottle(struct tty_struct *tty); |
295 | extern void usb_serial_generic_shutdown(struct usb_serial *serial); | 314 | extern void usb_serial_generic_disconnect(struct usb_serial *serial); |
315 | extern void usb_serial_generic_release(struct usb_serial *serial); | ||
296 | extern int usb_serial_generic_register(int debug); | 316 | extern int usb_serial_generic_register(int debug); |
297 | extern void usb_serial_generic_deregister(void); | 317 | extern void usb_serial_generic_deregister(void); |
318 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, | ||
319 | gfp_t mem_flags); | ||
320 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | ||
321 | unsigned int ch); | ||
322 | extern int usb_serial_handle_break(struct usb_serial_port *port); | ||
323 | |||
298 | 324 | ||
299 | extern int usb_serial_bus_register(struct usb_serial_driver *device); | 325 | extern int usb_serial_bus_register(struct usb_serial_driver *device); |
300 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); | 326 | extern void usb_serial_bus_deregister(struct usb_serial_driver *device); |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 36fabb95c7d3..5d44059f6d63 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -183,6 +183,7 @@ extern void usbnet_tx_timeout (struct net_device *net); | |||
183 | extern int usbnet_change_mtu (struct net_device *net, int new_mtu); | 183 | extern int usbnet_change_mtu (struct net_device *net, int new_mtu); |
184 | 184 | ||
185 | extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); | 185 | extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); |
186 | extern int usbnet_get_ethernet_addr(struct usbnet *, int); | ||
186 | extern void usbnet_defer_kevent (struct usbnet *, int); | 187 | extern void usbnet_defer_kevent (struct usbnet *, int); |
187 | extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); | 188 | extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); |
188 | extern void usbnet_unlink_rx_urbs(struct usbnet *); | 189 | extern void usbnet_unlink_rx_urbs(struct usbnet *); |