diff options
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/cdc.h | 79 | ||||
| -rw-r--r-- | include/linux/usb/ch9.h | 68 | ||||
| -rw-r--r-- | include/linux/usb/composite.h | 41 | ||||
| -rw-r--r-- | include/linux/usb/gadget.h | 20 | ||||
| -rw-r--r-- | include/linux/usb/hcd.h | 2 | ||||
| -rw-r--r-- | include/linux/usb/intel_mid_otg.h | 180 | ||||
| -rw-r--r-- | include/linux/usb/langwell_otg.h | 139 | ||||
| -rw-r--r-- | include/linux/usb/ncm.h | 114 | ||||
| -rw-r--r-- | include/linux/usb/otg.h | 11 | ||||
| -rw-r--r-- | include/linux/usb/serial.h | 5 | ||||
| -rw-r--r-- | include/linux/usb/storage.h | 48 |
11 files changed, 547 insertions, 160 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index c117a68d04a7..5e86dc771da4 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h | |||
| @@ -32,6 +32,8 @@ | |||
| 32 | 32 | ||
| 33 | #define USB_CDC_PROTO_EEM 7 | 33 | #define USB_CDC_PROTO_EEM 7 |
| 34 | 34 | ||
| 35 | #define USB_CDC_NCM_PROTO_NTB 1 | ||
| 36 | |||
| 35 | /*-------------------------------------------------------------------------*/ | 37 | /*-------------------------------------------------------------------------*/ |
| 36 | 38 | ||
| 37 | /* | 39 | /* |
| @@ -274,13 +276,13 @@ struct usb_cdc_notification { | |||
| 274 | /* | 276 | /* |
| 275 | * Class Specific structures and constants | 277 | * Class Specific structures and constants |
| 276 | * | 278 | * |
| 277 | * CDC NCM parameter structure, CDC NCM subclass 6.2.1 | 279 | * CDC NCM NTB parameters structure, CDC NCM subclass 6.2.1 |
| 278 | * | 280 | * |
| 279 | */ | 281 | */ |
| 280 | 282 | ||
| 281 | struct usb_cdc_ncm_ntb_parameter { | 283 | struct usb_cdc_ncm_ntb_parameters { |
| 282 | __le16 wLength; | 284 | __le16 wLength; |
| 283 | __le16 bmNtbFormatSupported; | 285 | __le16 bmNtbFormatsSupported; |
| 284 | __le32 dwNtbInMaxSize; | 286 | __le32 dwNtbInMaxSize; |
| 285 | __le16 wNdpInDivisor; | 287 | __le16 wNdpInDivisor; |
| 286 | __le16 wNdpInPayloadRemainder; | 288 | __le16 wNdpInPayloadRemainder; |
| @@ -297,8 +299,8 @@ struct usb_cdc_ncm_ntb_parameter { | |||
| 297 | * CDC NCM transfer headers, CDC NCM subclass 3.2 | 299 | * CDC NCM transfer headers, CDC NCM subclass 3.2 |
| 298 | */ | 300 | */ |
| 299 | 301 | ||
| 300 | #define NCM_NTH16_SIGN 0x484D434E /* NCMH */ | 302 | #define USB_CDC_NCM_NTH16_SIGN 0x484D434E /* NCMH */ |
| 301 | #define NCM_NTH32_SIGN 0x686D636E /* ncmh */ | 303 | #define USB_CDC_NCM_NTH32_SIGN 0x686D636E /* ncmh */ |
| 302 | 304 | ||
| 303 | struct usb_cdc_ncm_nth16 { | 305 | struct usb_cdc_ncm_nth16 { |
| 304 | __le32 dwSignature; | 306 | __le32 dwSignature; |
| @@ -320,25 +322,78 @@ struct usb_cdc_ncm_nth32 { | |||
| 320 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 | 322 | * CDC NCM datagram pointers, CDC NCM subclass 3.3 |
| 321 | */ | 323 | */ |
| 322 | 324 | ||
| 323 | #define NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ | 325 | #define USB_CDC_NCM_NDP16_CRC_SIGN 0x314D434E /* NCM1 */ |
| 324 | #define NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ | 326 | #define USB_CDC_NCM_NDP16_NOCRC_SIGN 0x304D434E /* NCM0 */ |
| 325 | #define NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ | 327 | #define USB_CDC_NCM_NDP32_CRC_SIGN 0x316D636E /* ncm1 */ |
| 326 | #define NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ | 328 | #define USB_CDC_NCM_NDP32_NOCRC_SIGN 0x306D636E /* ncm0 */ |
| 329 | |||
| 330 | /* 16-bit NCM Datagram Pointer Entry */ | ||
| 331 | struct usb_cdc_ncm_dpe16 { | ||
| 332 | __le16 wDatagramIndex; | ||
| 333 | __le16 wDatagramLength; | ||
| 334 | } __attribute__((__packed__)); | ||
| 327 | 335 | ||
| 336 | /* 16-bit NCM Datagram Pointer Table */ | ||
| 328 | struct usb_cdc_ncm_ndp16 { | 337 | struct usb_cdc_ncm_ndp16 { |
| 329 | __le32 dwSignature; | 338 | __le32 dwSignature; |
| 330 | __le16 wLength; | 339 | __le16 wLength; |
| 331 | __le16 wNextFpIndex; | 340 | __le16 wNextFpIndex; |
| 332 | __u8 data[0]; | 341 | struct usb_cdc_ncm_dpe16 dpe16[0]; |
| 333 | } __attribute__ ((packed)); | 342 | } __attribute__ ((packed)); |
| 334 | 343 | ||
| 344 | /* 32-bit NCM Datagram Pointer Entry */ | ||
| 345 | struct usb_cdc_ncm_dpe32 { | ||
| 346 | __le32 dwDatagramIndex; | ||
| 347 | __le32 dwDatagramLength; | ||
| 348 | } __attribute__((__packed__)); | ||
| 349 | |||
| 350 | /* 32-bit NCM Datagram Pointer Table */ | ||
| 335 | struct usb_cdc_ncm_ndp32 { | 351 | struct usb_cdc_ncm_ndp32 { |
| 336 | __le32 dwSignature; | 352 | __le32 dwSignature; |
| 337 | __le16 wLength; | 353 | __le16 wLength; |
| 338 | __le16 wReserved6; | 354 | __le16 wReserved6; |
| 339 | __le32 dwNextFpIndex; | 355 | __le32 dwNextNdpIndex; |
| 340 | __le32 dwReserved12; | 356 | __le32 dwReserved12; |
| 341 | __u8 data[0]; | 357 | struct usb_cdc_ncm_dpe32 dpe32[0]; |
| 342 | } __attribute__ ((packed)); | 358 | } __attribute__ ((packed)); |
| 343 | 359 | ||
| 360 | /* CDC NCM subclass 3.2.1 and 3.2.2 */ | ||
| 361 | #define USB_CDC_NCM_NDP16_INDEX_MIN 0x000C | ||
| 362 | #define USB_CDC_NCM_NDP32_INDEX_MIN 0x0010 | ||
| 363 | |||
| 364 | /* CDC NCM subclass 3.3.3 Datagram Formatting */ | ||
| 365 | #define USB_CDC_NCM_DATAGRAM_FORMAT_CRC 0x30 | ||
| 366 | #define USB_CDC_NCM_DATAGRAM_FORMAT_NOCRC 0X31 | ||
| 367 | |||
| 368 | /* CDC NCM subclass 4.2 NCM Communications Interface Protocol Code */ | ||
| 369 | #define USB_CDC_NCM_PROTO_CODE_NO_ENCAP_COMMANDS 0x00 | ||
| 370 | #define USB_CDC_NCM_PROTO_CODE_EXTERN_PROTO 0xFE | ||
| 371 | |||
| 372 | /* CDC NCM subclass 5.2.1 NCM Functional Descriptor, bmNetworkCapabilities */ | ||
| 373 | #define USB_CDC_NCM_NCAP_ETH_FILTER (1 << 0) | ||
| 374 | #define USB_CDC_NCM_NCAP_NET_ADDRESS (1 << 1) | ||
| 375 | #define USB_CDC_NCM_NCAP_ENCAP_COMMAND (1 << 2) | ||
| 376 | #define USB_CDC_NCM_NCAP_MAX_DATAGRAM_SIZE (1 << 3) | ||
| 377 | #define USB_CDC_NCM_NCAP_CRC_MODE (1 << 4) | ||
| 378 | |||
| 379 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
| 380 | #define USB_CDC_NCM_NTB16_SUPPORTED (1 << 0) | ||
| 381 | #define USB_CDC_NCM_NTB32_SUPPORTED (1 << 1) | ||
| 382 | |||
| 383 | /* CDC NCM subclass Table 6-3: NTB Parameter Structure */ | ||
| 384 | #define USB_CDC_NCM_NDP_ALIGN_MIN_SIZE 0x04 | ||
| 385 | #define USB_CDC_NCM_NTB_MAX_LENGTH 0x1C | ||
| 386 | |||
| 387 | /* CDC NCM subclass 6.2.5 SetNtbFormat */ | ||
| 388 | #define USB_CDC_NCM_NTB16_FORMAT 0x00 | ||
| 389 | #define USB_CDC_NCM_NTB32_FORMAT 0x01 | ||
| 390 | |||
| 391 | /* CDC NCM subclass 6.2.7 SetNtbInputSize */ | ||
| 392 | #define USB_CDC_NCM_NTB_MIN_IN_SIZE 2048 | ||
| 393 | #define USB_CDC_NCM_NTB_MIN_OUT_SIZE 2048 | ||
| 394 | |||
| 395 | /* CDC NCM subclass 6.2.11 SetCrcMode */ | ||
| 396 | #define USB_CDC_NCM_CRC_NOT_APPENDED 0x00 | ||
| 397 | #define USB_CDC_NCM_CRC_APPENDED 0x01 | ||
| 398 | |||
| 344 | #endif /* __LINUX_USB_CDC_H */ | 399 | #endif /* __LINUX_USB_CDC_H */ |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index da2ed77d3e8d..f917bbbc8901 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -123,8 +123,23 @@ | |||
| 123 | #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ | 123 | #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */ |
| 124 | #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ | 124 | #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ |
| 125 | 125 | ||
| 126 | /* | ||
| 127 | * New Feature Selectors as added by USB 3.0 | ||
| 128 | * See USB 3.0 spec Table 9-6 | ||
| 129 | */ | ||
| 130 | #define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */ | ||
| 131 | #define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */ | ||
| 132 | #define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */ | ||
| 133 | #define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */ | ||
| 134 | |||
| 135 | #define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 | ||
| 136 | |||
| 126 | #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ | 137 | #define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ |
| 127 | 138 | ||
| 139 | /* Bit array elements as returned by the USB_REQ_GET_STATUS request. */ | ||
| 140 | #define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */ | ||
| 141 | #define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */ | ||
| 142 | #define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */ | ||
| 128 | 143 | ||
| 129 | /** | 144 | /** |
| 130 | * struct usb_ctrlrequest - SETUP data for a USB device control request | 145 | * struct usb_ctrlrequest - SETUP data for a USB device control request |
| @@ -675,6 +690,7 @@ struct usb_bos_descriptor { | |||
| 675 | __u8 bNumDeviceCaps; | 690 | __u8 bNumDeviceCaps; |
| 676 | } __attribute__((packed)); | 691 | } __attribute__((packed)); |
| 677 | 692 | ||
| 693 | #define USB_DT_BOS_SIZE 5 | ||
| 678 | /*-------------------------------------------------------------------------*/ | 694 | /*-------------------------------------------------------------------------*/ |
| 679 | 695 | ||
| 680 | /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ | 696 | /* USB_DT_DEVICE_CAPABILITY: grouped with BOS */ |
| @@ -712,16 +728,56 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */ | |||
| 712 | __u8 bReserved; | 728 | __u8 bReserved; |
| 713 | } __attribute__((packed)); | 729 | } __attribute__((packed)); |
| 714 | 730 | ||
| 731 | /* USB 2.0 Extension descriptor */ | ||
| 715 | #define USB_CAP_TYPE_EXT 2 | 732 | #define USB_CAP_TYPE_EXT 2 |
| 716 | 733 | ||
| 717 | struct usb_ext_cap_descriptor { /* Link Power Management */ | 734 | struct usb_ext_cap_descriptor { /* Link Power Management */ |
| 718 | __u8 bLength; | 735 | __u8 bLength; |
| 719 | __u8 bDescriptorType; | 736 | __u8 bDescriptorType; |
| 720 | __u8 bDevCapabilityType; | 737 | __u8 bDevCapabilityType; |
| 721 | __u8 bmAttributes; | 738 | __le32 bmAttributes; |
| 722 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ | 739 | #define USB_LPM_SUPPORT (1 << 1) /* supports LPM */ |
| 723 | } __attribute__((packed)); | 740 | } __attribute__((packed)); |
| 724 | 741 | ||
| 742 | #define USB_DT_USB_EXT_CAP_SIZE 7 | ||
| 743 | |||
| 744 | /* | ||
| 745 | * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB | ||
| 746 | * specific device level capabilities | ||
| 747 | */ | ||
| 748 | #define USB_SS_CAP_TYPE 3 | ||
| 749 | struct usb_ss_cap_descriptor { /* Link Power Management */ | ||
| 750 | __u8 bLength; | ||
| 751 | __u8 bDescriptorType; | ||
| 752 | __u8 bDevCapabilityType; | ||
| 753 | __u8 bmAttributes; | ||
| 754 | #define USB_LTM_SUPPORT (1 << 1) /* supports LTM */ | ||
| 755 | __le16 wSpeedSupported; | ||
| 756 | #define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */ | ||
| 757 | #define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */ | ||
| 758 | #define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */ | ||
| 759 | #define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */ | ||
| 760 | __u8 bFunctionalitySupport; | ||
| 761 | __u8 bU1devExitLat; | ||
| 762 | __le16 bU2DevExitLat; | ||
| 763 | } __attribute__((packed)); | ||
| 764 | |||
| 765 | #define USB_DT_USB_SS_CAP_SIZE 10 | ||
| 766 | |||
| 767 | /* | ||
| 768 | * Container ID Capability descriptor: Defines the instance unique ID used to | ||
| 769 | * identify the instance across all operating modes | ||
| 770 | */ | ||
| 771 | #define CONTAINER_ID_TYPE 4 | ||
| 772 | struct usb_ss_container_id_descriptor { | ||
| 773 | __u8 bLength; | ||
| 774 | __u8 bDescriptorType; | ||
| 775 | __u8 bDevCapabilityType; | ||
| 776 | __u8 bReserved; | ||
| 777 | __u8 ContainerID[16]; /* 128-bit number */ | ||
| 778 | } __attribute__((packed)); | ||
| 779 | |||
| 780 | #define USB_DT_USB_SS_CONTN_ID_SIZE 20 | ||
| 725 | /*-------------------------------------------------------------------------*/ | 781 | /*-------------------------------------------------------------------------*/ |
| 726 | 782 | ||
| 727 | /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with | 783 | /* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with |
| @@ -808,4 +864,14 @@ enum usb_device_state { | |||
| 808 | */ | 864 | */ |
| 809 | }; | 865 | }; |
| 810 | 866 | ||
| 867 | /*-------------------------------------------------------------------------*/ | ||
| 868 | |||
| 869 | /* | ||
| 870 | * As per USB compliance update, a device that is actively drawing | ||
| 871 | * more than 100mA from USB must report itself as bus-powered in | ||
| 872 | * the GetStatus(DEVICE) call. | ||
| 873 | * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34 | ||
| 874 | */ | ||
| 875 | #define USB_SELF_POWER_VBUS_MAX_DRAW 100 | ||
| 876 | |||
| 811 | #endif /* __LINUX_USB_CH9_H */ | 877 | #endif /* __LINUX_USB_CH9_H */ |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 890bc1472190..3d29a7dcac2d 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -161,8 +161,6 @@ ep_choose(struct usb_gadget *g, struct usb_endpoint_descriptor *hs, | |||
| 161 | * and by language IDs provided in control requests. | 161 | * and by language IDs provided in control requests. |
| 162 | * @descriptors: Table of descriptors preceding all function descriptors. | 162 | * @descriptors: Table of descriptors preceding all function descriptors. |
| 163 | * Examples include OTG and vendor-specific descriptors. | 163 | * Examples include OTG and vendor-specific descriptors. |
| 164 | * @bind: Called from @usb_add_config() to allocate resources unique to this | ||
| 165 | * configuration and to call @usb_add_function() for each function used. | ||
| 166 | * @unbind: Reverses @bind; called as a side effect of unregistering the | 164 | * @unbind: Reverses @bind; called as a side effect of unregistering the |
| 167 | * driver which added this configuration. | 165 | * driver which added this configuration. |
| 168 | * @setup: Used to delegate control requests that aren't handled by standard | 166 | * @setup: Used to delegate control requests that aren't handled by standard |
| @@ -207,8 +205,7 @@ struct usb_configuration { | |||
| 207 | * we can't restructure things to avoid mismatching... | 205 | * we can't restructure things to avoid mismatching... |
| 208 | */ | 206 | */ |
| 209 | 207 | ||
| 210 | /* configuration management: bind/unbind */ | 208 | /* configuration management: unbind/setup */ |
| 211 | int (*bind)(struct usb_configuration *); | ||
| 212 | void (*unbind)(struct usb_configuration *); | 209 | void (*unbind)(struct usb_configuration *); |
| 213 | int (*setup)(struct usb_configuration *, | 210 | int (*setup)(struct usb_configuration *, |
| 214 | const struct usb_ctrlrequest *); | 211 | const struct usb_ctrlrequest *); |
| @@ -232,21 +229,26 @@ struct usb_configuration { | |||
| 232 | }; | 229 | }; |
| 233 | 230 | ||
| 234 | int usb_add_config(struct usb_composite_dev *, | 231 | int usb_add_config(struct usb_composite_dev *, |
| 235 | struct usb_configuration *); | 232 | struct usb_configuration *, |
| 233 | int (*)(struct usb_configuration *)); | ||
| 236 | 234 | ||
| 237 | /** | 235 | /** |
| 238 | * struct usb_composite_driver - groups configurations into a gadget | 236 | * struct usb_composite_driver - groups configurations into a gadget |
| 239 | * @name: For diagnostics, identifies the driver. | 237 | * @name: For diagnostics, identifies the driver. |
| 238 | * @iProduct: Used as iProduct override if @dev->iProduct is not set. | ||
| 239 | * If NULL value of @name is taken. | ||
| 240 | * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is | ||
| 241 | * not set. If NULL a default "<system> <release> with <udc>" value | ||
| 242 | * will be used. | ||
| 240 | * @dev: Template descriptor for the device, including default device | 243 | * @dev: Template descriptor for the device, including default device |
| 241 | * identifiers. | 244 | * identifiers. |
| 242 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 245 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
| 243 | * and language IDs provided in control requests | 246 | * and language IDs provided in control requests |
| 244 | * @bind: (REQUIRED) Used to allocate resources that are shared across the | 247 | * @needs_serial: set to 1 if the gadget needs userspace to provide |
| 245 | * whole device, such as string IDs, and add its configurations using | 248 | * a serial number. If one is not provided, warning will be printed. |
| 246 | * @usb_add_config(). This may fail by returning a negative errno | 249 | * @unbind: Reverses bind; called as a side effect of unregistering |
| 247 | * value; it should return zero on successful initialization. | ||
| 248 | * @unbind: Reverses @bind(); called as a side effect of unregistering | ||
| 249 | * this driver. | 250 | * this driver. |
| 251 | * @disconnect: optional driver disconnect method | ||
| 250 | * @suspend: Notifies when the host stops sending USB traffic, | 252 | * @suspend: Notifies when the host stops sending USB traffic, |
| 251 | * after function notifications | 253 | * after function notifications |
| 252 | * @resume: Notifies configuration when the host restarts USB traffic, | 254 | * @resume: Notifies configuration when the host restarts USB traffic, |
| @@ -255,7 +257,7 @@ int usb_add_config(struct usb_composite_dev *, | |||
| 255 | * Devices default to reporting self powered operation. Devices which rely | 257 | * Devices default to reporting self powered operation. Devices which rely |
| 256 | * on bus powered operation should report this in their @bind() method. | 258 | * on bus powered operation should report this in their @bind() method. |
| 257 | * | 259 | * |
| 258 | * Before returning from @bind, various fields in the template descriptor | 260 | * Before returning from bind, various fields in the template descriptor |
| 259 | * may be overridden. These include the idVendor/idProduct/bcdDevice values | 261 | * may be overridden. These include the idVendor/idProduct/bcdDevice values |
| 260 | * normally to bind the appropriate host side driver, and the three strings | 262 | * normally to bind the appropriate host side driver, and the three strings |
| 261 | * (iManufacturer, iProduct, iSerialNumber) normally used to provide user | 263 | * (iManufacturer, iProduct, iSerialNumber) normally used to provide user |
| @@ -265,15 +267,12 @@ int usb_add_config(struct usb_composite_dev *, | |||
| 265 | */ | 267 | */ |
| 266 | struct usb_composite_driver { | 268 | struct usb_composite_driver { |
| 267 | const char *name; | 269 | const char *name; |
| 270 | const char *iProduct; | ||
| 271 | const char *iManufacturer; | ||
| 268 | const struct usb_device_descriptor *dev; | 272 | const struct usb_device_descriptor *dev; |
| 269 | struct usb_gadget_strings **strings; | 273 | struct usb_gadget_strings **strings; |
| 274 | unsigned needs_serial:1; | ||
| 270 | 275 | ||
| 271 | /* REVISIT: bind() functions can be marked __init, which | ||
| 272 | * makes trouble for section mismatch analysis. See if | ||
| 273 | * we can't restructure things to avoid mismatching... | ||
| 274 | */ | ||
| 275 | |||
| 276 | int (*bind)(struct usb_composite_dev *); | ||
| 277 | int (*unbind)(struct usb_composite_dev *); | 276 | int (*unbind)(struct usb_composite_dev *); |
| 278 | 277 | ||
| 279 | void (*disconnect)(struct usb_composite_dev *); | 278 | void (*disconnect)(struct usb_composite_dev *); |
| @@ -283,8 +282,9 @@ struct usb_composite_driver { | |||
| 283 | void (*resume)(struct usb_composite_dev *); | 282 | void (*resume)(struct usb_composite_dev *); |
| 284 | }; | 283 | }; |
| 285 | 284 | ||
| 286 | extern int usb_composite_register(struct usb_composite_driver *); | 285 | extern int usb_composite_probe(struct usb_composite_driver *driver, |
| 287 | extern void usb_composite_unregister(struct usb_composite_driver *); | 286 | int (*bind)(struct usb_composite_dev *cdev)); |
| 287 | extern void usb_composite_unregister(struct usb_composite_driver *driver); | ||
| 288 | 288 | ||
| 289 | 289 | ||
| 290 | /** | 290 | /** |
| @@ -333,6 +333,9 @@ struct usb_composite_dev { | |||
| 333 | struct list_head configs; | 333 | struct list_head configs; |
| 334 | struct usb_composite_driver *driver; | 334 | struct usb_composite_driver *driver; |
| 335 | u8 next_string_id; | 335 | u8 next_string_id; |
| 336 | u8 manufacturer_override; | ||
| 337 | u8 product_override; | ||
| 338 | u8 serial_override; | ||
| 336 | 339 | ||
| 337 | /* the gadget driver won't enable the data pullup | 340 | /* the gadget driver won't enable the data pullup |
| 338 | * while the deactivation count is nonzero. | 341 | * while the deactivation count is nonzero. |
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index d3ef42d7d2f0..006412ce2303 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h | |||
| @@ -705,11 +705,6 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) | |||
| 705 | * struct usb_gadget_driver - driver for usb 'slave' devices | 705 | * struct usb_gadget_driver - driver for usb 'slave' devices |
| 706 | * @function: String describing the gadget's function | 706 | * @function: String describing the gadget's function |
| 707 | * @speed: Highest speed the driver handles. | 707 | * @speed: Highest speed the driver handles. |
| 708 | * @bind: Invoked when the driver is bound to a gadget, usually | ||
| 709 | * after registering the driver. | ||
| 710 | * At that point, ep0 is fully initialized, and ep_list holds | ||
| 711 | * the currently-available endpoints. | ||
| 712 | * Called in a context that permits sleeping. | ||
| 713 | * @setup: Invoked for ep0 control requests that aren't handled by | 708 | * @setup: Invoked for ep0 control requests that aren't handled by |
| 714 | * the hardware level driver. Most calls must be handled by | 709 | * the hardware level driver. Most calls must be handled by |
| 715 | * the gadget driver, including descriptor and configuration | 710 | * the gadget driver, including descriptor and configuration |
| @@ -774,7 +769,6 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) | |||
| 774 | struct usb_gadget_driver { | 769 | struct usb_gadget_driver { |
| 775 | char *function; | 770 | char *function; |
| 776 | enum usb_device_speed speed; | 771 | enum usb_device_speed speed; |
| 777 | int (*bind)(struct usb_gadget *); | ||
| 778 | void (*unbind)(struct usb_gadget *); | 772 | void (*unbind)(struct usb_gadget *); |
| 779 | int (*setup)(struct usb_gadget *, | 773 | int (*setup)(struct usb_gadget *, |
| 780 | const struct usb_ctrlrequest *); | 774 | const struct usb_ctrlrequest *); |
| @@ -798,17 +792,19 @@ struct usb_gadget_driver { | |||
| 798 | */ | 792 | */ |
| 799 | 793 | ||
| 800 | /** | 794 | /** |
| 801 | * usb_gadget_register_driver - register a gadget driver | 795 | * usb_gadget_probe_driver - probe a gadget driver |
| 802 | * @driver:the driver being registered | 796 | * @driver: the driver being registered |
| 797 | * @bind: the driver's bind callback | ||
| 803 | * Context: can sleep | 798 | * Context: can sleep |
| 804 | * | 799 | * |
| 805 | * Call this in your gadget driver's module initialization function, | 800 | * Call this in your gadget driver's module initialization function, |
| 806 | * to tell the underlying usb controller driver about your driver. | 801 | * to tell the underlying usb controller driver about your driver. |
| 807 | * The driver's bind() function will be called to bind it to a | 802 | * The @bind() function will be called to bind it to a gadget before this |
| 808 | * gadget before this registration call returns. It's expected that | 803 | * registration call returns. It's expected that the @bind() function will |
| 809 | * the bind() functions will be in init sections. | 804 | * be in init sections. |
| 810 | */ | 805 | */ |
| 811 | int usb_gadget_register_driver(struct usb_gadget_driver *driver); | 806 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, |
| 807 | int (*bind)(struct usb_gadget *)); | ||
| 812 | 808 | ||
| 813 | /** | 809 | /** |
| 814 | * usb_gadget_unregister_driver - unregister a gadget driver | 810 | * usb_gadget_unregister_driver - unregister a gadget driver |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 3b571f1ffbb3..0b6e751ea0b1 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -329,6 +329,8 @@ extern int usb_hcd_submit_urb(struct urb *urb, gfp_t mem_flags); | |||
| 329 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); | 329 | extern int usb_hcd_unlink_urb(struct urb *urb, int status); |
| 330 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, | 330 | extern void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, |
| 331 | int status); | 331 | int status); |
| 332 | extern void unmap_urb_setup_for_dma(struct usb_hcd *, struct urb *); | ||
| 333 | extern void unmap_urb_for_dma(struct usb_hcd *, struct urb *); | ||
| 332 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, | 334 | extern void usb_hcd_flush_endpoint(struct usb_device *udev, |
| 333 | struct usb_host_endpoint *ep); | 335 | struct usb_host_endpoint *ep); |
| 334 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, | 336 | extern void usb_hcd_disable_endpoint(struct usb_device *udev, |
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h new file mode 100644 index 000000000000..a0ccf795f362 --- /dev/null +++ b/include/linux/usb/intel_mid_otg.h | |||
| @@ -0,0 +1,180 @@ | |||
| 1 | /* | ||
| 2 | * Intel MID (Langwell/Penwell) USB OTG Transceiver driver | ||
| 3 | * Copyright (C) 2008 - 2010, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __INTEL_MID_OTG_H | ||
| 21 | #define __INTEL_MID_OTG_H | ||
| 22 | |||
| 23 | #include <linux/pm.h> | ||
| 24 | #include <linux/usb/otg.h> | ||
| 25 | #include <linux/notifier.h> | ||
| 26 | |||
| 27 | struct intel_mid_otg_xceiv; | ||
| 28 | |||
| 29 | /* This is a common data structure for Intel MID platform to | ||
| 30 | * save values of the OTG state machine */ | ||
| 31 | struct otg_hsm { | ||
| 32 | /* Input */ | ||
| 33 | int a_bus_resume; | ||
| 34 | int a_bus_suspend; | ||
| 35 | int a_conn; | ||
| 36 | int a_sess_vld; | ||
| 37 | int a_srp_det; | ||
| 38 | int a_vbus_vld; | ||
| 39 | int b_bus_resume; | ||
| 40 | int b_bus_suspend; | ||
| 41 | int b_conn; | ||
| 42 | int b_se0_srp; | ||
| 43 | int b_ssend_srp; | ||
| 44 | int b_sess_end; | ||
| 45 | int b_sess_vld; | ||
| 46 | int id; | ||
| 47 | /* id values */ | ||
| 48 | #define ID_B 0x05 | ||
| 49 | #define ID_A 0x04 | ||
| 50 | #define ID_ACA_C 0x03 | ||
| 51 | #define ID_ACA_B 0x02 | ||
| 52 | #define ID_ACA_A 0x01 | ||
| 53 | int power_up; | ||
| 54 | int adp_change; | ||
| 55 | int test_device; | ||
| 56 | |||
| 57 | /* Internal variables */ | ||
| 58 | int a_set_b_hnp_en; | ||
| 59 | int b_srp_done; | ||
| 60 | int b_hnp_enable; | ||
| 61 | int hnp_poll_enable; | ||
| 62 | |||
| 63 | /* Timeout indicator for timers */ | ||
| 64 | int a_wait_vrise_tmout; | ||
| 65 | int a_wait_bcon_tmout; | ||
| 66 | int a_aidl_bdis_tmout; | ||
| 67 | int a_bidl_adis_tmout; | ||
| 68 | int a_bidl_adis_tmr; | ||
| 69 | int a_wait_vfall_tmout; | ||
| 70 | int b_ase0_brst_tmout; | ||
| 71 | int b_bus_suspend_tmout; | ||
| 72 | int b_srp_init_tmout; | ||
| 73 | int b_srp_fail_tmout; | ||
| 74 | int b_srp_fail_tmr; | ||
| 75 | int b_adp_sense_tmout; | ||
| 76 | |||
| 77 | /* Informative variables */ | ||
| 78 | int a_bus_drop; | ||
| 79 | int a_bus_req; | ||
| 80 | int a_clr_err; | ||
| 81 | int b_bus_req; | ||
| 82 | int a_suspend_req; | ||
| 83 | int b_bus_suspend_vld; | ||
| 84 | |||
| 85 | /* Output */ | ||
| 86 | int drv_vbus; | ||
| 87 | int loc_conn; | ||
| 88 | int loc_sof; | ||
| 89 | |||
| 90 | /* Others */ | ||
| 91 | int vbus_srp_up; | ||
| 92 | }; | ||
| 93 | |||
| 94 | /* must provide ULPI access function to read/write registers implemented in | ||
| 95 | * ULPI address space */ | ||
| 96 | struct iotg_ulpi_access_ops { | ||
| 97 | int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val); | ||
| 98 | int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val); | ||
| 99 | }; | ||
| 100 | |||
| 101 | #define OTG_A_DEVICE 0x0 | ||
| 102 | #define OTG_B_DEVICE 0x1 | ||
| 103 | |||
| 104 | /* | ||
| 105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact | ||
| 106 | * with device and host drivers to implement the USB OTG related feature. More | ||
| 107 | * function members are added based on otg_transceiver data structure for this | ||
| 108 | * purpose. | ||
| 109 | */ | ||
| 110 | struct intel_mid_otg_xceiv { | ||
| 111 | struct otg_transceiver otg; | ||
| 112 | struct otg_hsm hsm; | ||
| 113 | |||
| 114 | /* base address */ | ||
| 115 | void __iomem *base; | ||
| 116 | |||
| 117 | /* ops to access ulpi */ | ||
| 118 | struct iotg_ulpi_access_ops ulpi_ops; | ||
| 119 | |||
| 120 | /* atomic notifier for interrupt context */ | ||
| 121 | struct atomic_notifier_head iotg_notifier; | ||
| 122 | |||
| 123 | /* start/stop USB Host function */ | ||
| 124 | int (*start_host)(struct intel_mid_otg_xceiv *iotg); | ||
| 125 | int (*stop_host)(struct intel_mid_otg_xceiv *iotg); | ||
| 126 | |||
| 127 | /* start/stop USB Peripheral function */ | ||
| 128 | int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg); | ||
| 129 | int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg); | ||
| 130 | |||
| 131 | /* start/stop ADP sense/probe function */ | ||
| 132 | int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg, | ||
| 133 | bool enabled, int dev); | ||
| 134 | int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg, | ||
| 135 | bool enabled); | ||
| 136 | |||
| 137 | #ifdef CONFIG_PM | ||
| 138 | /* suspend/resume USB host function */ | ||
| 139 | int (*suspend_host)(struct intel_mid_otg_xceiv *iotg, | ||
| 140 | pm_message_t message); | ||
| 141 | int (*resume_host)(struct intel_mid_otg_xceiv *iotg); | ||
| 142 | |||
| 143 | int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg, | ||
| 144 | pm_message_t message); | ||
| 145 | int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg); | ||
| 146 | #endif | ||
| 147 | |||
| 148 | }; | ||
| 149 | static inline | ||
| 150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) | ||
| 151 | { | ||
| 152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); | ||
| 153 | } | ||
| 154 | |||
| 155 | #define MID_OTG_NOTIFY_CONNECT 0x0001 | ||
| 156 | #define MID_OTG_NOTIFY_DISCONN 0x0002 | ||
| 157 | #define MID_OTG_NOTIFY_HSUSPEND 0x0003 | ||
| 158 | #define MID_OTG_NOTIFY_HRESUME 0x0004 | ||
| 159 | #define MID_OTG_NOTIFY_CSUSPEND 0x0005 | ||
| 160 | #define MID_OTG_NOTIFY_CRESUME 0x0006 | ||
| 161 | #define MID_OTG_NOTIFY_HOSTADD 0x0007 | ||
| 162 | #define MID_OTG_NOTIFY_HOSTREMOVE 0x0008 | ||
| 163 | #define MID_OTG_NOTIFY_CLIENTADD 0x0009 | ||
| 164 | #define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a | ||
| 165 | |||
| 166 | static inline int | ||
| 167 | intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg, | ||
| 168 | struct notifier_block *nb) | ||
| 169 | { | ||
| 170 | return atomic_notifier_chain_register(&iotg->iotg_notifier, nb); | ||
| 171 | } | ||
| 172 | |||
| 173 | static inline void | ||
| 174 | intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg, | ||
| 175 | struct notifier_block *nb) | ||
| 176 | { | ||
| 177 | atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb); | ||
| 178 | } | ||
| 179 | |||
| 180 | #endif /* __INTEL_MID_OTG_H */ | ||
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h new file mode 100644 index 000000000000..51f17b16d312 --- /dev/null +++ b/include/linux/usb/langwell_otg.h | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | /* | ||
| 2 | * Intel Langwell USB OTG transceiver driver | ||
| 3 | * Copyright (C) 2008 - 2010, Intel Corporation. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms and conditions of the GNU General Public License, | ||
| 7 | * version 2, as published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along with | ||
| 15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | * | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LANGWELL_OTG_H | ||
| 21 | #define __LANGWELL_OTG_H | ||
| 22 | |||
| 23 | #include <linux/usb/intel_mid_otg.h> | ||
| 24 | |||
| 25 | #define CI_USBCMD 0x30 | ||
| 26 | # define USBCMD_RST BIT(1) | ||
| 27 | # define USBCMD_RS BIT(0) | ||
| 28 | #define CI_USBSTS 0x34 | ||
| 29 | # define USBSTS_SLI BIT(8) | ||
| 30 | # define USBSTS_URI BIT(6) | ||
| 31 | # define USBSTS_PCI BIT(2) | ||
| 32 | #define CI_PORTSC1 0x74 | ||
| 33 | # define PORTSC_PP BIT(12) | ||
| 34 | # define PORTSC_LS (BIT(11) | BIT(10)) | ||
| 35 | # define PORTSC_SUSP BIT(7) | ||
| 36 | # define PORTSC_CCS BIT(0) | ||
| 37 | #define CI_HOSTPC1 0xb4 | ||
| 38 | # define HOSTPC1_PHCD BIT(22) | ||
| 39 | #define CI_OTGSC 0xf4 | ||
| 40 | # define OTGSC_DPIE BIT(30) | ||
| 41 | # define OTGSC_1MSE BIT(29) | ||
| 42 | # define OTGSC_BSEIE BIT(28) | ||
| 43 | # define OTGSC_BSVIE BIT(27) | ||
| 44 | # define OTGSC_ASVIE BIT(26) | ||
| 45 | # define OTGSC_AVVIE BIT(25) | ||
| 46 | # define OTGSC_IDIE BIT(24) | ||
| 47 | # define OTGSC_DPIS BIT(22) | ||
| 48 | # define OTGSC_1MSS BIT(21) | ||
| 49 | # define OTGSC_BSEIS BIT(20) | ||
| 50 | # define OTGSC_BSVIS BIT(19) | ||
| 51 | # define OTGSC_ASVIS BIT(18) | ||
| 52 | # define OTGSC_AVVIS BIT(17) | ||
| 53 | # define OTGSC_IDIS BIT(16) | ||
| 54 | # define OTGSC_DPS BIT(14) | ||
| 55 | # define OTGSC_1MST BIT(13) | ||
| 56 | # define OTGSC_BSE BIT(12) | ||
| 57 | # define OTGSC_BSV BIT(11) | ||
| 58 | # define OTGSC_ASV BIT(10) | ||
| 59 | # define OTGSC_AVV BIT(9) | ||
| 60 | # define OTGSC_ID BIT(8) | ||
| 61 | # define OTGSC_HABA BIT(7) | ||
| 62 | # define OTGSC_HADP BIT(6) | ||
| 63 | # define OTGSC_IDPU BIT(5) | ||
| 64 | # define OTGSC_DP BIT(4) | ||
| 65 | # define OTGSC_OT BIT(3) | ||
| 66 | # define OTGSC_HAAR BIT(2) | ||
| 67 | # define OTGSC_VC BIT(1) | ||
| 68 | # define OTGSC_VD BIT(0) | ||
| 69 | # define OTGSC_INTEN_MASK (0x7f << 24) | ||
| 70 | # define OTGSC_INT_MASK (0x5f << 24) | ||
| 71 | # define OTGSC_INTSTS_MASK (0x7f << 16) | ||
| 72 | #define CI_USBMODE 0xf8 | ||
| 73 | # define USBMODE_CM (BIT(1) | BIT(0)) | ||
| 74 | # define USBMODE_IDLE 0 | ||
| 75 | # define USBMODE_DEVICE 0x2 | ||
| 76 | # define USBMODE_HOST 0x3 | ||
| 77 | #define USBCFG_ADDR 0xff10801c | ||
| 78 | #define USBCFG_LEN 4 | ||
| 79 | # define USBCFG_VBUSVAL BIT(14) | ||
| 80 | # define USBCFG_AVALID BIT(13) | ||
| 81 | # define USBCFG_BVALID BIT(12) | ||
| 82 | # define USBCFG_SESEND BIT(11) | ||
| 83 | |||
| 84 | #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) | ||
| 85 | |||
| 86 | enum langwell_otg_timer_type { | ||
| 87 | TA_WAIT_VRISE_TMR, | ||
| 88 | TA_WAIT_BCON_TMR, | ||
| 89 | TA_AIDL_BDIS_TMR, | ||
| 90 | TB_ASE0_BRST_TMR, | ||
| 91 | TB_SE0_SRP_TMR, | ||
| 92 | TB_SRP_INIT_TMR, | ||
| 93 | TB_SRP_FAIL_TMR, | ||
| 94 | TB_BUS_SUSPEND_TMR | ||
| 95 | }; | ||
| 96 | |||
| 97 | #define TA_WAIT_VRISE 100 | ||
| 98 | #define TA_WAIT_BCON 30000 | ||
| 99 | #define TA_AIDL_BDIS 15000 | ||
| 100 | #define TB_ASE0_BRST 5000 | ||
| 101 | #define TB_SE0_SRP 2 | ||
| 102 | #define TB_SRP_INIT 100 | ||
| 103 | #define TB_SRP_FAIL 5500 | ||
| 104 | #define TB_BUS_SUSPEND 500 | ||
| 105 | |||
| 106 | struct langwell_otg_timer { | ||
| 107 | unsigned long expires; /* Number of count increase to timeout */ | ||
| 108 | unsigned long count; /* Tick counter */ | ||
| 109 | void (*function)(unsigned long); /* Timeout function */ | ||
| 110 | unsigned long data; /* Data passed to function */ | ||
| 111 | struct list_head list; | ||
| 112 | }; | ||
| 113 | |||
| 114 | struct langwell_otg { | ||
| 115 | struct intel_mid_otg_xceiv iotg; | ||
| 116 | struct device *dev; | ||
| 117 | |||
| 118 | void __iomem *usbcfg; /* SCCBUSB config Reg */ | ||
| 119 | |||
| 120 | unsigned region; | ||
| 121 | unsigned cfg_region; | ||
| 122 | |||
| 123 | struct work_struct work; | ||
| 124 | struct workqueue_struct *qwork; | ||
| 125 | struct timer_list hsm_timer; | ||
| 126 | |||
| 127 | spinlock_t lock; | ||
| 128 | spinlock_t wq_lock; | ||
| 129 | |||
| 130 | struct notifier_block iotg_notifier; | ||
| 131 | }; | ||
| 132 | |||
| 133 | static inline | ||
| 134 | struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg) | ||
| 135 | { | ||
| 136 | return container_of(iotg, struct langwell_otg, iotg); | ||
| 137 | } | ||
| 138 | |||
| 139 | #endif /* __LANGWELL_OTG_H__ */ | ||
diff --git a/include/linux/usb/ncm.h b/include/linux/usb/ncm.h deleted file mode 100644 index 006d1064c8b2..000000000000 --- a/include/linux/usb/ncm.h +++ /dev/null | |||
| @@ -1,114 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * USB CDC NCM auxiliary definitions | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef __LINUX_USB_NCM_H | ||
| 6 | #define __LINUX_USB_NCM_H | ||
| 7 | |||
| 8 | #include <linux/types.h> | ||
| 9 | #include <linux/usb/cdc.h> | ||
| 10 | #include <asm/unaligned.h> | ||
| 11 | |||
| 12 | #define NCM_NTB_MIN_IN_SIZE 2048 | ||
| 13 | #define NCM_NTB_MIN_OUT_SIZE 2048 | ||
| 14 | |||
| 15 | #define NCM_CONTROL_TIMEOUT (5 * 1000) | ||
| 16 | |||
| 17 | /* bmNetworkCapabilities */ | ||
| 18 | |||
| 19 | #define NCM_NCAP_ETH_FILTER (1 << 0) | ||
| 20 | #define NCM_NCAP_NET_ADDRESS (1 << 1) | ||
| 21 | #define NCM_NCAP_ENCAP_COMM (1 << 2) | ||
| 22 | #define NCM_NCAP_MAX_DGRAM (1 << 3) | ||
| 23 | #define NCM_NCAP_CRC_MODE (1 << 4) | ||
| 24 | |||
| 25 | /* | ||
| 26 | * Here are options for NCM Datagram Pointer table (NDP) parser. | ||
| 27 | * There are 2 different formats: NDP16 and NDP32 in the spec (ch. 3), | ||
| 28 | * in NDP16 offsets and sizes fields are 1 16bit word wide, | ||
| 29 | * in NDP32 -- 2 16bit words wide. Also signatures are different. | ||
| 30 | * To make the parser code the same, put the differences in the structure, | ||
| 31 | * and switch pointers to the structures when the format is changed. | ||
| 32 | */ | ||
| 33 | |||
| 34 | struct ndp_parser_opts { | ||
| 35 | u32 nth_sign; | ||
| 36 | u32 ndp_sign; | ||
| 37 | unsigned nth_size; | ||
| 38 | unsigned ndp_size; | ||
| 39 | unsigned ndplen_align; | ||
| 40 | /* sizes in u16 units */ | ||
| 41 | unsigned dgram_item_len; /* index or length */ | ||
| 42 | unsigned block_length; | ||
| 43 | unsigned fp_index; | ||
| 44 | unsigned reserved1; | ||
| 45 | unsigned reserved2; | ||
| 46 | unsigned next_fp_index; | ||
| 47 | }; | ||
| 48 | |||
| 49 | #define INIT_NDP16_OPTS { \ | ||
| 50 | .nth_sign = NCM_NTH16_SIGN, \ | ||
| 51 | .ndp_sign = NCM_NDP16_NOCRC_SIGN, \ | ||
| 52 | .nth_size = sizeof(struct usb_cdc_ncm_nth16), \ | ||
| 53 | .ndp_size = sizeof(struct usb_cdc_ncm_ndp16), \ | ||
| 54 | .ndplen_align = 4, \ | ||
| 55 | .dgram_item_len = 1, \ | ||
| 56 | .block_length = 1, \ | ||
| 57 | .fp_index = 1, \ | ||
| 58 | .reserved1 = 0, \ | ||
| 59 | .reserved2 = 0, \ | ||
| 60 | .next_fp_index = 1, \ | ||
| 61 | } | ||
| 62 | |||
| 63 | |||
| 64 | #define INIT_NDP32_OPTS { \ | ||
| 65 | .nth_sign = NCM_NTH32_SIGN, \ | ||
| 66 | .ndp_sign = NCM_NDP32_NOCRC_SIGN, \ | ||
| 67 | .nth_size = sizeof(struct usb_cdc_ncm_nth32), \ | ||
| 68 | .ndp_size = sizeof(struct usb_cdc_ncm_ndp32), \ | ||
| 69 | .ndplen_align = 8, \ | ||
| 70 | .dgram_item_len = 2, \ | ||
| 71 | .block_length = 2, \ | ||
| 72 | .fp_index = 2, \ | ||
| 73 | .reserved1 = 1, \ | ||
| 74 | .reserved2 = 2, \ | ||
| 75 | .next_fp_index = 2, \ | ||
| 76 | } | ||
| 77 | |||
| 78 | static inline void put_ncm(__le16 **p, unsigned size, unsigned val) | ||
| 79 | { | ||
| 80 | switch (size) { | ||
| 81 | case 1: | ||
| 82 | put_unaligned_le16((u16)val, *p); | ||
| 83 | break; | ||
| 84 | case 2: | ||
| 85 | put_unaligned_le32((u32)val, *p); | ||
| 86 | |||
| 87 | break; | ||
| 88 | default: | ||
| 89 | BUG(); | ||
| 90 | } | ||
| 91 | |||
| 92 | *p += size; | ||
| 93 | } | ||
| 94 | |||
| 95 | static inline unsigned get_ncm(__le16 **p, unsigned size) | ||
| 96 | { | ||
| 97 | unsigned tmp; | ||
| 98 | |||
| 99 | switch (size) { | ||
| 100 | case 1: | ||
| 101 | tmp = get_unaligned_le16(*p); | ||
| 102 | break; | ||
| 103 | case 2: | ||
| 104 | tmp = get_unaligned_le32(*p); | ||
| 105 | break; | ||
| 106 | default: | ||
| 107 | BUG(); | ||
| 108 | } | ||
| 109 | |||
| 110 | *p += size; | ||
| 111 | return tmp; | ||
| 112 | } | ||
| 113 | |||
| 114 | #endif /* __LINUX_USB_NCM_H */ | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 545cba73ccaf..0a5b3711e502 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -164,8 +164,19 @@ otg_shutdown(struct otg_transceiver *otg) | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | /* for usb host and peripheral controller drivers */ | 166 | /* for usb host and peripheral controller drivers */ |
| 167 | #ifdef CONFIG_USB_OTG_UTILS | ||
| 167 | extern struct otg_transceiver *otg_get_transceiver(void); | 168 | extern struct otg_transceiver *otg_get_transceiver(void); |
| 168 | extern void otg_put_transceiver(struct otg_transceiver *); | 169 | extern void otg_put_transceiver(struct otg_transceiver *); |
| 170 | #else | ||
| 171 | static inline struct otg_transceiver *otg_get_transceiver(void) | ||
| 172 | { | ||
| 173 | return NULL; | ||
| 174 | } | ||
| 175 | |||
| 176 | static inline void otg_put_transceiver(struct otg_transceiver *x) | ||
| 177 | { | ||
| 178 | } | ||
| 179 | #endif | ||
| 169 | 180 | ||
| 170 | /* Context: can sleep */ | 181 | /* Context: can sleep */ |
| 171 | static inline int | 182 | static inline int |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 84a4c44c208b..16d682f4f7c3 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -271,6 +271,8 @@ struct usb_serial_driver { | |||
| 271 | int (*tiocmget)(struct tty_struct *tty, struct file *file); | 271 | int (*tiocmget)(struct tty_struct *tty, struct file *file); |
| 272 | int (*tiocmset)(struct tty_struct *tty, struct file *file, | 272 | int (*tiocmset)(struct tty_struct *tty, struct file *file, |
| 273 | unsigned int set, unsigned int clear); | 273 | unsigned int set, unsigned int clear); |
| 274 | int (*get_icount)(struct tty_struct *tty, | ||
| 275 | struct serial_icounter_struct *icount); | ||
| 274 | /* Called by the tty layer for port level work. There may or may not | 276 | /* Called by the tty layer for port level work. There may or may not |
| 275 | be an attached tty at this point */ | 277 | be an attached tty at this point */ |
| 276 | void (*dtr_rts)(struct usb_serial_port *port, int on); | 278 | void (*dtr_rts)(struct usb_serial_port *port, int on); |
| @@ -342,8 +344,7 @@ extern int usb_serial_generic_submit_read_urb(struct usb_serial_port *port, | |||
| 342 | extern void usb_serial_generic_process_read_urb(struct urb *urb); | 344 | extern void usb_serial_generic_process_read_urb(struct urb *urb); |
| 343 | extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, | 345 | extern int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, |
| 344 | void *dest, size_t size); | 346 | void *dest, size_t size); |
| 345 | extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, | 347 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, |
| 346 | struct usb_serial_port *port, | ||
| 347 | unsigned int ch); | 348 | unsigned int ch); |
| 348 | extern int usb_serial_handle_break(struct usb_serial_port *port); | 349 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
| 349 | 350 | ||
diff --git a/include/linux/usb/storage.h b/include/linux/usb/storage.h new file mode 100644 index 000000000000..d7fc910f1dc4 --- /dev/null +++ b/include/linux/usb/storage.h | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | #ifndef __LINUX_USB_STORAGE_H | ||
| 2 | #define __LINUX_USB_STORAGE_H | ||
| 3 | |||
| 4 | /* | ||
| 5 | * linux/usb/storage.h | ||
| 6 | * | ||
| 7 | * Copyright Matthew Wilcox for Intel Corp, 2010 | ||
| 8 | * | ||
| 9 | * This file contains definitions taken from the | ||
| 10 | * USB Mass Storage Class Specification Overview | ||
| 11 | * | ||
| 12 | * Distributed under the terms of the GNU GPL, version two. | ||
| 13 | */ | ||
| 14 | |||
| 15 | /* Storage subclass codes */ | ||
| 16 | |||
| 17 | #define USB_SC_RBC 0x01 /* Typically, flash devices */ | ||
| 18 | #define USB_SC_8020 0x02 /* CD-ROM */ | ||
| 19 | #define USB_SC_QIC 0x03 /* QIC-157 Tapes */ | ||
| 20 | #define USB_SC_UFI 0x04 /* Floppy */ | ||
| 21 | #define USB_SC_8070 0x05 /* Removable media */ | ||
| 22 | #define USB_SC_SCSI 0x06 /* Transparent */ | ||
| 23 | #define USB_SC_LOCKABLE 0x07 /* Password-protected */ | ||
| 24 | |||
| 25 | #define USB_SC_ISD200 0xf0 /* ISD200 ATA */ | ||
| 26 | #define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */ | ||
| 27 | #define USB_SC_DEVICE 0xff /* Use device's value */ | ||
| 28 | |||
| 29 | /* Storage protocol codes */ | ||
| 30 | |||
| 31 | #define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */ | ||
| 32 | #define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */ | ||
| 33 | #define USB_PR_BULK 0x50 /* bulk only */ | ||
| 34 | #define USB_PR_UAS 0x62 /* USB Attached SCSI */ | ||
| 35 | |||
| 36 | #define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */ | ||
| 37 | #define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */ | ||
| 38 | #define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */ | ||
| 39 | #define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */ | ||
| 40 | #define USB_PR_FREECOM 0xf1 /* Freecom */ | ||
| 41 | #define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */ | ||
| 42 | #define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */ | ||
| 43 | #define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */ | ||
| 44 | #define USB_PR_KARMA 0xf5 /* Rio Karma */ | ||
| 45 | |||
| 46 | #define USB_PR_DEVICE 0xff /* Use device's value */ | ||
| 47 | |||
| 48 | #endif | ||
