diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/usb_ch9.h | 183 | ||||
-rw-r--r-- | include/linux/usb_gadget.h | 2 | ||||
-rw-r--r-- | include/linux/usb_isp116x.h | 47 |
3 files changed, 224 insertions, 8 deletions
diff --git a/include/linux/usb_ch9.h b/include/linux/usb_ch9.h index f5fe94e09a03..39e7ff4ffd28 100644 --- a/include/linux/usb_ch9.h +++ b/include/linux/usb_ch9.h | |||
@@ -6,11 +6,14 @@ | |||
6 | * | 6 | * |
7 | * - the master/host side Linux-USB kernel driver API; | 7 | * - the master/host side Linux-USB kernel driver API; |
8 | * - the "usbfs" user space API; and | 8 | * - the "usbfs" user space API; and |
9 | * - (eventually) a Linux "gadget" slave/device side driver API. | 9 | * - the Linux "gadget" slave/device/peripheral side driver API. |
10 | * | 10 | * |
11 | * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems | 11 | * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems |
12 | * act either as a USB master/host or as a USB slave/device. That means | 12 | * act either as a USB master/host or as a USB slave/device. That means |
13 | * the master and slave side APIs will benefit from working well together. | 13 | * the master and slave side APIs benefit from working well together. |
14 | * | ||
15 | * There's also "Wireless USB", using low power short range radios for | ||
16 | * peripheral interconnection but otherwise building on the USB framework. | ||
14 | */ | 17 | */ |
15 | 18 | ||
16 | #ifndef __LINUX_USB_CH9_H | 19 | #ifndef __LINUX_USB_CH9_H |
@@ -68,6 +71,18 @@ | |||
68 | #define USB_REQ_SET_INTERFACE 0x0B | 71 | #define USB_REQ_SET_INTERFACE 0x0B |
69 | #define USB_REQ_SYNCH_FRAME 0x0C | 72 | #define USB_REQ_SYNCH_FRAME 0x0C |
70 | 73 | ||
74 | #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ | ||
75 | #define USB_REQ_GET_ENCRYPTION 0x0E | ||
76 | #define USB_REQ_SET_HANDSHAKE 0x0F | ||
77 | #define USB_REQ_GET_HANDSHAKE 0x10 | ||
78 | #define USB_REQ_SET_CONNECTION 0x11 | ||
79 | #define USB_REQ_SET_SECURITY_DATA 0x12 | ||
80 | #define USB_REQ_GET_SECURITY_DATA 0x13 | ||
81 | #define USB_REQ_SET_WUSB_DATA 0x14 | ||
82 | #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 | ||
83 | #define USB_REQ_LOOPBACK_DATA_READ 0x16 | ||
84 | #define USB_REQ_SET_INTERFACE_DS 0x17 | ||
85 | |||
71 | /* | 86 | /* |
72 | * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and | 87 | * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and |
73 | * are read as a bit array returned by USB_REQ_GET_STATUS. (So there | 88 | * are read as a bit array returned by USB_REQ_GET_STATUS. (So there |
@@ -75,10 +90,12 @@ | |||
75 | */ | 90 | */ |
76 | #define USB_DEVICE_SELF_POWERED 0 /* (read only) */ | 91 | #define USB_DEVICE_SELF_POWERED 0 /* (read only) */ |
77 | #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ | 92 | #define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */ |
78 | #define USB_DEVICE_TEST_MODE 2 /* (high speed only) */ | 93 | #define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */ |
79 | #define USB_DEVICE_B_HNP_ENABLE 3 /* dev may initiate HNP */ | 94 | #define USB_DEVICE_BATTERY 2 /* (wireless) */ |
80 | #define USB_DEVICE_A_HNP_SUPPORT 4 /* RH port supports HNP */ | 95 | #define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */ |
81 | #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* other RH port does */ | 96 | #define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/ |
97 | #define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */ | ||
98 | #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ | ||
82 | #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ | 99 | #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ |
83 | 100 | ||
84 | #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ | 101 | #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ |
@@ -135,6 +152,13 @@ struct usb_ctrlrequest { | |||
135 | #define USB_DT_OTG 0x09 | 152 | #define USB_DT_OTG 0x09 |
136 | #define USB_DT_DEBUG 0x0a | 153 | #define USB_DT_DEBUG 0x0a |
137 | #define USB_DT_INTERFACE_ASSOCIATION 0x0b | 154 | #define USB_DT_INTERFACE_ASSOCIATION 0x0b |
155 | /* these are from the Wireless USB spec */ | ||
156 | #define USB_DT_SECURITY 0x0c | ||
157 | #define USB_DT_KEY 0x0d | ||
158 | #define USB_DT_ENCRYPTION_TYPE 0x0e | ||
159 | #define USB_DT_BOS 0x0f | ||
160 | #define USB_DT_DEVICE_CAPABILITY 0x10 | ||
161 | #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 | ||
138 | 162 | ||
139 | /* conventional codes for class-specific descriptors */ | 163 | /* conventional codes for class-specific descriptors */ |
140 | #define USB_DT_CS_DEVICE 0x21 | 164 | #define USB_DT_CS_DEVICE 0x21 |
@@ -192,6 +216,7 @@ struct usb_device_descriptor { | |||
192 | #define USB_CLASS_CSCID 0x0b /* chip+ smart card */ | 216 | #define USB_CLASS_CSCID 0x0b /* chip+ smart card */ |
193 | #define USB_CLASS_CONTENT_SEC 0x0d /* content security */ | 217 | #define USB_CLASS_CONTENT_SEC 0x0d /* content security */ |
194 | #define USB_CLASS_VIDEO 0x0e | 218 | #define USB_CLASS_VIDEO 0x0e |
219 | #define USB_CLASS_WIRELESS_CONTROLLER 0xe0 | ||
195 | #define USB_CLASS_APP_SPEC 0xfe | 220 | #define USB_CLASS_APP_SPEC 0xfe |
196 | #define USB_CLASS_VENDOR_SPEC 0xff | 221 | #define USB_CLASS_VENDOR_SPEC 0xff |
197 | 222 | ||
@@ -223,6 +248,7 @@ struct usb_config_descriptor { | |||
223 | #define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ | 248 | #define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */ |
224 | #define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ | 249 | #define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */ |
225 | #define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ | 250 | #define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */ |
251 | #define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */ | ||
226 | 252 | ||
227 | /*-------------------------------------------------------------------------*/ | 253 | /*-------------------------------------------------------------------------*/ |
228 | 254 | ||
@@ -289,6 +315,7 @@ struct usb_endpoint_descriptor { | |||
289 | #define USB_ENDPOINT_XFER_ISOC 1 | 315 | #define USB_ENDPOINT_XFER_ISOC 1 |
290 | #define USB_ENDPOINT_XFER_BULK 2 | 316 | #define USB_ENDPOINT_XFER_BULK 2 |
291 | #define USB_ENDPOINT_XFER_INT 3 | 317 | #define USB_ENDPOINT_XFER_INT 3 |
318 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 | ||
292 | 319 | ||
293 | 320 | ||
294 | /*-------------------------------------------------------------------------*/ | 321 | /*-------------------------------------------------------------------------*/ |
@@ -352,12 +379,154 @@ struct usb_interface_assoc_descriptor { | |||
352 | 379 | ||
353 | /*-------------------------------------------------------------------------*/ | 380 | /*-------------------------------------------------------------------------*/ |
354 | 381 | ||
382 | /* USB_DT_SECURITY: group of wireless security descriptors, including | ||
383 | * encryption types available for setting up a CC/association. | ||
384 | */ | ||
385 | struct usb_security_descriptor { | ||
386 | __u8 bLength; | ||
387 | __u8 bDescriptorType; | ||
388 | |||
389 | __le16 wTotalLength; | ||
390 | __u8 bNumEncryptionTypes; | ||
391 | }; | ||
392 | |||
393 | /*-------------------------------------------------------------------------*/ | ||
394 | |||
395 | /* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys | ||
396 | * may be retrieved. | ||
397 | */ | ||
398 | struct usb_key_descriptor { | ||
399 | __u8 bLength; | ||
400 | __u8 bDescriptorType; | ||
401 | |||
402 | __u8 tTKID[3]; | ||
403 | __u8 bReserved; | ||
404 | __u8 bKeyData[0]; | ||
405 | }; | ||
406 | |||
407 | /*-------------------------------------------------------------------------*/ | ||
408 | |||
409 | /* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */ | ||
410 | struct usb_encryption_descriptor { | ||
411 | __u8 bLength; | ||
412 | __u8 bDescriptorType; | ||
413 | |||
414 | __u8 bEncryptionType; | ||
415 | #define USB_ENC_TYPE_UNSECURE 0 | ||
416 | #define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */ | ||
417 | #define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */ | ||
418 | #define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */ | ||
419 | __u8 bEncryptionValue; /* use in SET_ENCRYPTION */ | ||
420 | __u8 bAuthKeyIndex; | ||
421 | }; | ||
422 | |||
423 | |||
424 | /*-------------------------------------------------------------------------*/ | ||
425 | |||
426 | /* USB_DT_BOS: group of wireless capabilities */ | ||
427 | struct usb_bos_descriptor { | ||
428 | __u8 bLength; | ||
429 | __u8 bDescriptorType; | ||
430 | |||
431 | __le16 wTotalLength; | ||
432 | __u8 bNumDeviceCaps; | ||
433 | }; | ||
434 | |||
435 | /*-------------------------------------------------------------------------*/ | ||
436 | |||
437 | /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ | ||
438 | struct usb_dev_cap_header { | ||
439 | __u8 bLength; | ||
440 | __u8 bDescriptorType; | ||
441 | __u8 bDevCapabilityType; | ||
442 | }; | ||
443 | |||
444 | #define USB_CAP_TYPE_WIRELESS_USB 1 | ||
445 | |||
446 | struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ | ||
447 | __u8 bLength; | ||
448 | __u8 bDescriptorType; | ||
449 | __u8 bDevCapabilityType; | ||
450 | |||
451 | __u8 bmAttributes; | ||
452 | #define USB_WIRELESS_P2P_DRD (1 << 1) | ||
453 | #define USB_WIRELESS_BEACON_MASK (3 << 2) | ||
454 | #define USB_WIRELESS_BEACON_SELF (1 << 2) | ||
455 | #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) | ||
456 | #define USB_WIRELESS_BEACON_NONE (3 << 2) | ||
457 | __le16 wPHYRates; /* bit rates, Mbps */ | ||
458 | #define USB_WIRELESS_PHY_53 (1 << 0) /* always set */ | ||
459 | #define USB_WIRELESS_PHY_80 (1 << 1) | ||
460 | #define USB_WIRELESS_PHY_107 (1 << 2) /* always set */ | ||
461 | #define USB_WIRELESS_PHY_160 (1 << 3) | ||
462 | #define USB_WIRELESS_PHY_200 (1 << 4) /* always set */ | ||
463 | #define USB_WIRELESS_PHY_320 (1 << 5) | ||
464 | #define USB_WIRELESS_PHY_400 (1 << 6) | ||
465 | #define USB_WIRELESS_PHY_480 (1 << 7) | ||
466 | __u8 bmTFITXPowerInfo; /* TFI power levels */ | ||
467 | __u8 bmFFITXPowerInfo; /* FFI power levels */ | ||
468 | __le16 bmBandGroup; | ||
469 | __u8 bReserved; | ||
470 | }; | ||
471 | |||
472 | /*-------------------------------------------------------------------------*/ | ||
473 | |||
474 | /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with | ||
475 | * each endpoint descriptor for a wireless device | ||
476 | */ | ||
477 | struct usb_wireless_ep_comp_descriptor { | ||
478 | __u8 bLength; | ||
479 | __u8 bDescriptorType; | ||
480 | |||
481 | __u8 bMaxBurst; | ||
482 | __u8 bMaxSequence; | ||
483 | __le16 wMaxStreamDelay; | ||
484 | __le16 wOverTheAirPacketSize; | ||
485 | __u8 bOverTheAirInterval; | ||
486 | __u8 bmCompAttributes; | ||
487 | #define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */ | ||
488 | #define USB_ENDPOINT_SWITCH_NO 0 | ||
489 | #define USB_ENDPOINT_SWITCH_SWITCH 1 | ||
490 | #define USB_ENDPOINT_SWITCH_SCALE 2 | ||
491 | }; | ||
492 | |||
493 | /*-------------------------------------------------------------------------*/ | ||
494 | |||
495 | /* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless | ||
496 | * host and a device for connection set up, mutual authentication, and | ||
497 | * exchanging short lived session keys. The handshake depends on a CC. | ||
498 | */ | ||
499 | struct usb_handshake { | ||
500 | __u8 bMessageNumber; | ||
501 | __u8 bStatus; | ||
502 | __u8 tTKID[3]; | ||
503 | __u8 bReserved; | ||
504 | __u8 CDID[16]; | ||
505 | __u8 nonce[16]; | ||
506 | __u8 MIC[8]; | ||
507 | }; | ||
508 | |||
509 | /*-------------------------------------------------------------------------*/ | ||
510 | |||
511 | /* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC). | ||
512 | * A CC may also be set up using non-wireless secure channels (including | ||
513 | * wired USB!), and some devices may support CCs with multiple hosts. | ||
514 | */ | ||
515 | struct usb_connection_context { | ||
516 | __u8 CHID[16]; /* persistent host id */ | ||
517 | __u8 CDID[16]; /* device id (unique w/in host context) */ | ||
518 | __u8 CK[16]; /* connection key */ | ||
519 | }; | ||
520 | |||
521 | /*-------------------------------------------------------------------------*/ | ||
522 | |||
355 | /* USB 2.0 defines three speeds, here's how Linux identifies them */ | 523 | /* USB 2.0 defines three speeds, here's how Linux identifies them */ |
356 | 524 | ||
357 | enum usb_device_speed { | 525 | enum usb_device_speed { |
358 | USB_SPEED_UNKNOWN = 0, /* enumerating */ | 526 | USB_SPEED_UNKNOWN = 0, /* enumerating */ |
359 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ | 527 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ |
360 | USB_SPEED_HIGH /* usb 2.0 */ | 528 | USB_SPEED_HIGH, /* usb 2.0 */ |
529 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ | ||
361 | }; | 530 | }; |
362 | 531 | ||
363 | enum usb_device_state { | 532 | enum usb_device_state { |
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h index 9bba9997947b..b00f127cb447 100644 --- a/include/linux/usb_gadget.h +++ b/include/linux/usb_gadget.h | |||
@@ -711,7 +711,7 @@ usb_gadget_disconnect (struct usb_gadget *gadget) | |||
711 | * the hardware level driver. Most calls must be handled by | 711 | * the hardware level driver. Most calls must be handled by |
712 | * the gadget driver, including descriptor and configuration | 712 | * the gadget driver, including descriptor and configuration |
713 | * management. The 16 bit members of the setup data are in | 713 | * management. The 16 bit members of the setup data are in |
714 | * cpu order. Called in_interrupt; this may not sleep. Driver | 714 | * USB byte order. Called in_interrupt; this may not sleep. Driver |
715 | * queues a response to ep0, or returns negative to stall. | 715 | * queues a response to ep0, or returns negative to stall. |
716 | * @disconnect: Invoked after all transfers have been stopped, | 716 | * @disconnect: Invoked after all transfers have been stopped, |
717 | * when the host is disconnected. May be called in_interrupt; this | 717 | * when the host is disconnected. May be called in_interrupt; this |
diff --git a/include/linux/usb_isp116x.h b/include/linux/usb_isp116x.h new file mode 100644 index 000000000000..5f5a9d9bd6c2 --- /dev/null +++ b/include/linux/usb_isp116x.h | |||
@@ -0,0 +1,47 @@ | |||
1 | |||
2 | /* | ||
3 | * Board initialization code should put one of these into dev->platform_data | ||
4 | * and place the isp116x onto platform_bus. | ||
5 | */ | ||
6 | |||
7 | struct isp116x_platform_data { | ||
8 | /* Enable internal resistors on downstream ports */ | ||
9 | unsigned sel15Kres:1; | ||
10 | /* Chip's internal clock won't be stopped in suspended state. | ||
11 | Setting/unsetting this bit takes effect only if | ||
12 | 'remote_wakeup_enable' below is not set. */ | ||
13 | unsigned clknotstop:1; | ||
14 | /* On-chip overcurrent protection */ | ||
15 | unsigned oc_enable:1; | ||
16 | /* INT output polarity */ | ||
17 | unsigned int_act_high:1; | ||
18 | /* INT edge or level triggered */ | ||
19 | unsigned int_edge_triggered:1; | ||
20 | /* WAKEUP pin connected - NOT SUPPORTED */ | ||
21 | /* unsigned remote_wakeup_connected:1; */ | ||
22 | /* Wakeup by devices on usb bus enabled */ | ||
23 | unsigned remote_wakeup_enable:1; | ||
24 | /* Switch or not to switch (keep always powered) */ | ||
25 | unsigned no_power_switching:1; | ||
26 | /* Ganged port power switching (0) or individual port | ||
27 | power switching (1) */ | ||
28 | unsigned power_switching_mode:1; | ||
29 | /* Given port_power, msec/2 after power on till power good */ | ||
30 | u8 potpg; | ||
31 | /* Hardware reset set/clear. If implemented, this function must: | ||
32 | if set == 0, deassert chip's HW reset pin | ||
33 | otherwise, assert chip's HW reset pin */ | ||
34 | void (*reset) (struct device * dev, int set); | ||
35 | /* Hardware clock start/stop. If implemented, this function must: | ||
36 | if start == 0, stop the external clock | ||
37 | otherwise, start the external clock | ||
38 | */ | ||
39 | void (*clock) (struct device * dev, int start); | ||
40 | /* Inter-io delay (ns). The chip is picky about access timings; it | ||
41 | expects at least: | ||
42 | 150ns delay between consecutive accesses to DATA_REG, | ||
43 | 300ns delay between access to ADDR_REG and DATA_REG | ||
44 | OE, WE MUST NOT be changed during these intervals | ||
45 | */ | ||
46 | void (*delay) (struct device * dev, int delay); | ||
47 | }; | ||