diff options
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/ch11.h | 2 | ||||
| -rw-r--r-- | include/linux/usb/ch9.h | 58 | ||||
| -rw-r--r-- | include/linux/usb/chipidea.h | 28 | ||||
| -rw-r--r-- | include/linux/usb/composite.h | 6 | ||||
| -rw-r--r-- | include/linux/usb/functionfs.h | 4 | ||||
| -rw-r--r-- | include/linux/usb/gpio_vbus.h | 2 | ||||
| -rw-r--r-- | include/linux/usb/hcd.h | 32 | ||||
| -rw-r--r-- | include/linux/usb/isp1301.h | 80 | ||||
| -rw-r--r-- | include/linux/usb/langwell_udc.h | 310 | ||||
| -rw-r--r-- | include/linux/usb/rndis_host.h | 66 | ||||
| -rw-r--r-- | include/linux/usb/serial.h | 34 |
11 files changed, 211 insertions, 411 deletions
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h index f1d26b6067f1..b6c2863b2c94 100644 --- a/include/linux/usb/ch11.h +++ b/include/linux/usb/ch11.h | |||
| @@ -76,6 +76,8 @@ | |||
| 76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 | 76 | #define USB_PORT_FEAT_C_BH_PORT_RESET 29 |
| 77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 | 77 | #define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 |
| 78 | 78 | ||
| 79 | #define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8) | ||
| 80 | |||
| 79 | /* USB 3.0 hub remote wake mask bits, see table 10-14 */ | 81 | /* USB 3.0 hub remote wake mask bits, see table 10-14 */ |
| 80 | #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) | 82 | #define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8) |
| 81 | #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) | 83 | #define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9) |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index af21f3115919..d1d732c2838d 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
| @@ -88,6 +88,8 @@ | |||
| 88 | #define USB_REQ_GET_INTERFACE 0x0A | 88 | #define USB_REQ_GET_INTERFACE 0x0A |
| 89 | #define USB_REQ_SET_INTERFACE 0x0B | 89 | #define USB_REQ_SET_INTERFACE 0x0B |
| 90 | #define USB_REQ_SYNCH_FRAME 0x0C | 90 | #define USB_REQ_SYNCH_FRAME 0x0C |
| 91 | #define USB_REQ_SET_SEL 0x30 | ||
| 92 | #define USB_REQ_SET_ISOCH_DELAY 0x31 | ||
| 91 | 93 | ||
| 92 | #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ | 94 | #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ |
| 93 | #define USB_REQ_GET_ENCRYPTION 0x0E | 95 | #define USB_REQ_GET_ENCRYPTION 0x0E |
| @@ -390,6 +392,11 @@ struct usb_endpoint_descriptor { | |||
| 390 | #define USB_ENDPOINT_XFER_INT 3 | 392 | #define USB_ENDPOINT_XFER_INT 3 |
| 391 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 | 393 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 |
| 392 | 394 | ||
| 395 | /* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */ | ||
| 396 | #define USB_ENDPOINT_INTRTYPE 0x30 | ||
| 397 | #define USB_ENDPOINT_INTR_PERIODIC (0 << 4) | ||
| 398 | #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4) | ||
| 399 | |||
| 393 | #define USB_ENDPOINT_SYNCTYPE 0x0c | 400 | #define USB_ENDPOINT_SYNCTYPE 0x0c |
| 394 | #define USB_ENDPOINT_SYNC_NONE (0 << 2) | 401 | #define USB_ENDPOINT_SYNC_NONE (0 << 2) |
| 395 | #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) | 402 | #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) |
| @@ -592,6 +599,12 @@ static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd) | |||
| 592 | return __le16_to_cpu(epd->wMaxPacketSize); | 599 | return __le16_to_cpu(epd->wMaxPacketSize); |
| 593 | } | 600 | } |
| 594 | 601 | ||
| 602 | static inline int usb_endpoint_interrupt_type( | ||
| 603 | const struct usb_endpoint_descriptor *epd) | ||
| 604 | { | ||
| 605 | return epd->bmAttributes & USB_ENDPOINT_INTRTYPE; | ||
| 606 | } | ||
| 607 | |||
| 595 | /*-------------------------------------------------------------------------*/ | 608 | /*-------------------------------------------------------------------------*/ |
| 596 | 609 | ||
| 597 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ | 610 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ |
| @@ -933,6 +946,51 @@ enum usb_device_state { | |||
| 933 | */ | 946 | */ |
| 934 | }; | 947 | }; |
| 935 | 948 | ||
| 949 | enum usb3_link_state { | ||
| 950 | USB3_LPM_U0 = 0, | ||
| 951 | USB3_LPM_U1, | ||
| 952 | USB3_LPM_U2, | ||
| 953 | USB3_LPM_U3 | ||
| 954 | }; | ||
| 955 | |||
| 956 | /* | ||
| 957 | * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1. | ||
| 958 | * 0xff means the parent hub will accept transitions to U1, but will not | ||
| 959 | * initiate a transition. | ||
| 960 | * | ||
| 961 | * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to | ||
| 962 | * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved | ||
| 963 | * values. | ||
| 964 | * | ||
| 965 | * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2. | ||
| 966 | * 0xff means the parent hub will accept transitions to U2, but will not | ||
| 967 | * initiate a transition. | ||
| 968 | * | ||
| 969 | * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to | ||
| 970 | * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2 | ||
| 971 | * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means | ||
| 972 | * 65.024ms. | ||
| 973 | */ | ||
| 974 | #define USB3_LPM_DISABLED 0x0 | ||
| 975 | #define USB3_LPM_U1_MAX_TIMEOUT 0x7F | ||
| 976 | #define USB3_LPM_U2_MAX_TIMEOUT 0xFE | ||
| 977 | #define USB3_LPM_DEVICE_INITIATED 0xFF | ||
| 978 | |||
| 979 | struct usb_set_sel_req { | ||
| 980 | __u8 u1_sel; | ||
| 981 | __u8 u1_pel; | ||
| 982 | __le16 u2_sel; | ||
| 983 | __le16 u2_pel; | ||
| 984 | } __attribute__ ((packed)); | ||
| 985 | |||
| 986 | /* | ||
| 987 | * The Set System Exit Latency control transfer provides one byte each for | ||
| 988 | * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each | ||
| 989 | * are two bytes long. | ||
| 990 | */ | ||
| 991 | #define USB3_LPM_MAX_U1_SEL_PEL 0xFF | ||
| 992 | #define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF | ||
| 993 | |||
| 936 | /*-------------------------------------------------------------------------*/ | 994 | /*-------------------------------------------------------------------------*/ |
| 937 | 995 | ||
| 938 | /* | 996 | /* |
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h new file mode 100644 index 000000000000..edb90d6cfd12 --- /dev/null +++ b/include/linux/usb/chipidea.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | /* | ||
| 2 | * Platform data for the chipidea USB dual role controller | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef __LINUX_USB_CHIPIDEA_H | ||
| 6 | #define __LINUX_USB_CHIPIDEA_H | ||
| 7 | |||
| 8 | struct ci13xxx; | ||
| 9 | struct ci13xxx_udc_driver { | ||
| 10 | const char *name; | ||
| 11 | /* offset of the capability registers */ | ||
| 12 | uintptr_t capoffset; | ||
| 13 | unsigned power_budget; | ||
| 14 | unsigned long flags; | ||
| 15 | #define CI13XXX_REGS_SHARED BIT(0) | ||
| 16 | #define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) | ||
| 17 | #define CI13XXX_PULLUP_ON_VBUS BIT(2) | ||
| 18 | #define CI13XXX_DISABLE_STREAMING BIT(3) | ||
| 19 | |||
| 20 | #define CI13XXX_CONTROLLER_RESET_EVENT 0 | ||
| 21 | #define CI13XXX_CONTROLLER_STOPPED_EVENT 1 | ||
| 22 | void (*notify_event) (struct ci13xxx *udc, unsigned event); | ||
| 23 | }; | ||
| 24 | |||
| 25 | /* Default offset of capability registers */ | ||
| 26 | #define DEF_CAPOFFSET 0x100 | ||
| 27 | |||
| 28 | #endif | ||
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a316fba73518..9d8c3b634493 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -242,6 +242,9 @@ int usb_add_config(struct usb_composite_dev *, | |||
| 242 | struct usb_configuration *, | 242 | struct usb_configuration *, |
| 243 | int (*)(struct usb_configuration *)); | 243 | int (*)(struct usb_configuration *)); |
| 244 | 244 | ||
| 245 | void usb_remove_config(struct usb_composite_dev *, | ||
| 246 | struct usb_configuration *); | ||
| 247 | |||
| 245 | /** | 248 | /** |
| 246 | * struct usb_composite_driver - groups configurations into a gadget | 249 | * struct usb_composite_driver - groups configurations into a gadget |
| 247 | * @name: For diagnostics, identifies the driver. | 250 | * @name: For diagnostics, identifies the driver. |
| @@ -250,6 +253,8 @@ int usb_add_config(struct usb_composite_dev *, | |||
| 250 | * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is | 253 | * @iManufacturer: Used as iManufacturer override if @dev->iManufacturer is |
| 251 | * not set. If NULL a default "<system> <release> with <udc>" value | 254 | * not set. If NULL a default "<system> <release> with <udc>" value |
| 252 | * will be used. | 255 | * will be used. |
| 256 | * @iSerialNumber: Used as iSerialNumber override if @dev->iSerialNumber is | ||
| 257 | * not set. | ||
| 253 | * @dev: Template descriptor for the device, including default device | 258 | * @dev: Template descriptor for the device, including default device |
| 254 | * identifiers. | 259 | * identifiers. |
| 255 | * @strings: tables of strings, keyed by identifiers assigned during bind() | 260 | * @strings: tables of strings, keyed by identifiers assigned during bind() |
| @@ -280,6 +285,7 @@ struct usb_composite_driver { | |||
| 280 | const char *name; | 285 | const char *name; |
| 281 | const char *iProduct; | 286 | const char *iProduct; |
| 282 | const char *iManufacturer; | 287 | const char *iManufacturer; |
| 288 | const char *iSerialNumber; | ||
| 283 | const struct usb_device_descriptor *dev; | 289 | const struct usb_device_descriptor *dev; |
| 284 | struct usb_gadget_strings **strings; | 290 | struct usb_gadget_strings **strings; |
| 285 | enum usb_device_speed max_speed; | 291 | enum usb_device_speed max_speed; |
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h index 7587ef934ba8..a843d0851364 100644 --- a/include/linux/usb/functionfs.h +++ b/include/linux/usb/functionfs.h | |||
| @@ -190,8 +190,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs) | |||
| 190 | __attribute__((warn_unused_result, nonnull)); | 190 | __attribute__((warn_unused_result, nonnull)); |
| 191 | static void functionfs_closed_callback(struct ffs_data *ffs) | 191 | static void functionfs_closed_callback(struct ffs_data *ffs) |
| 192 | __attribute__((nonnull)); | 192 | __attribute__((nonnull)); |
| 193 | static int functionfs_check_dev_callback(const char *dev_name) | 193 | static void *functionfs_acquire_dev_callback(const char *dev_name) |
| 194 | __attribute__((warn_unused_result, nonnull)); | 194 | __attribute__((warn_unused_result, nonnull)); |
| 195 | static void functionfs_release_dev_callback(struct ffs_data *ffs_data) | ||
| 196 | __attribute__((nonnull)); | ||
| 195 | 197 | ||
| 196 | 198 | ||
| 197 | #endif | 199 | #endif |
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h index d9f03ccc2d60..837bba604a0b 100644 --- a/include/linux/usb/gpio_vbus.h +++ b/include/linux/usb/gpio_vbus.h | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid) | 17 | * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid) |
| 18 | * @gpio_vbus_inverted: true if gpio_vbus is active low | 18 | * @gpio_vbus_inverted: true if gpio_vbus is active low |
| 19 | * @gpio_pullup_inverted: true if gpio_pullup is active low | 19 | * @gpio_pullup_inverted: true if gpio_pullup is active low |
| 20 | * @wakeup: configure gpio_vbus as a wake-up source | ||
| 20 | * | 21 | * |
| 21 | * The VBUS sensing GPIO should have a pulldown, which will normally be | 22 | * The VBUS sensing GPIO should have a pulldown, which will normally be |
| 22 | * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a | 23 | * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a |
| @@ -27,4 +28,5 @@ struct gpio_vbus_mach_info { | |||
| 27 | int gpio_pullup; | 28 | int gpio_pullup; |
| 28 | bool gpio_vbus_inverted; | 29 | bool gpio_vbus_inverted; |
| 29 | bool gpio_pullup_inverted; | 30 | bool gpio_pullup_inverted; |
| 31 | bool wakeup; | ||
| 30 | }; | 32 | }; |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index d28cc78a38e4..7f855d50cdf5 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
| @@ -344,6 +344,15 @@ struct hc_driver { | |||
| 344 | */ | 344 | */ |
| 345 | int (*update_device)(struct usb_hcd *, struct usb_device *); | 345 | int (*update_device)(struct usb_hcd *, struct usb_device *); |
| 346 | int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); | 346 | int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); |
| 347 | /* USB 3.0 Link Power Management */ | ||
| 348 | /* Returns the USB3 hub-encoded value for the U1/U2 timeout. */ | ||
| 349 | int (*enable_usb3_lpm_timeout)(struct usb_hcd *, | ||
| 350 | struct usb_device *, enum usb3_link_state state); | ||
| 351 | /* The xHCI host controller can still fail the command to | ||
| 352 | * disable the LPM timeouts, so this can return an error code. | ||
| 353 | */ | ||
| 354 | int (*disable_usb3_lpm_timeout)(struct usb_hcd *, | ||
| 355 | struct usb_device *, enum usb3_link_state state); | ||
| 347 | }; | 356 | }; |
| 348 | 357 | ||
| 349 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); | 358 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); |
| @@ -584,29 +593,6 @@ static inline void usb_hcd_resume_root_hub(struct usb_hcd *hcd) | |||
| 584 | } | 593 | } |
| 585 | #endif /* CONFIG_USB_SUSPEND */ | 594 | #endif /* CONFIG_USB_SUSPEND */ |
| 586 | 595 | ||
| 587 | |||
| 588 | /* | ||
| 589 | * USB device fs stuff | ||
| 590 | */ | ||
| 591 | |||
| 592 | #ifdef CONFIG_USB_DEVICEFS | ||
| 593 | |||
| 594 | /* | ||
| 595 | * these are expected to be called from the USB core/hub thread | ||
| 596 | * with the kernel lock held | ||
| 597 | */ | ||
| 598 | extern void usbfs_update_special(void); | ||
| 599 | extern int usbfs_init(void); | ||
| 600 | extern void usbfs_cleanup(void); | ||
| 601 | |||
| 602 | #else /* CONFIG_USB_DEVICEFS */ | ||
| 603 | |||
| 604 | static inline void usbfs_update_special(void) {} | ||
| 605 | static inline int usbfs_init(void) { return 0; } | ||
| 606 | static inline void usbfs_cleanup(void) { } | ||
| 607 | |||
| 608 | #endif /* CONFIG_USB_DEVICEFS */ | ||
| 609 | |||
| 610 | /*-------------------------------------------------------------------------*/ | 596 | /*-------------------------------------------------------------------------*/ |
| 611 | 597 | ||
| 612 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) | 598 | #if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) |
diff --git a/include/linux/usb/isp1301.h b/include/linux/usb/isp1301.h new file mode 100644 index 000000000000..d3a851c28b6a --- /dev/null +++ b/include/linux/usb/isp1301.h | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | /* | ||
| 2 | * NXP ISP1301 USB transceiver driver | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Roland Stigge <stigge@antcom.de> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef __LINUX_USB_ISP1301_H | ||
| 18 | #define __LINUX_USB_ISP1301_H | ||
| 19 | |||
| 20 | #include <linux/of.h> | ||
| 21 | |||
| 22 | /* I2C Register definitions: */ | ||
| 23 | |||
| 24 | #define ISP1301_I2C_MODE_CONTROL_1 0x04 /* u8 read, set, +1 clear */ | ||
| 25 | |||
| 26 | #define MC1_SPEED_REG (1 << 0) | ||
| 27 | #define MC1_SUSPEND_REG (1 << 1) | ||
| 28 | #define MC1_DAT_SE0 (1 << 2) | ||
| 29 | #define MC1_TRANSPARENT (1 << 3) | ||
| 30 | #define MC1_BDIS_ACON_EN (1 << 4) | ||
| 31 | #define MC1_OE_INT_EN (1 << 5) | ||
| 32 | #define MC1_UART_EN (1 << 6) | ||
| 33 | #define MC1_MASK 0x7f | ||
| 34 | |||
| 35 | #define ISP1301_I2C_MODE_CONTROL_2 0x12 /* u8 read, set, +1 clear */ | ||
| 36 | |||
| 37 | #define MC2_GLOBAL_PWR_DN (1 << 0) | ||
| 38 | #define MC2_SPD_SUSP_CTRL (1 << 1) | ||
| 39 | #define MC2_BI_DI (1 << 2) | ||
| 40 | #define MC2_TRANSP_BDIR0 (1 << 3) | ||
| 41 | #define MC2_TRANSP_BDIR1 (1 << 4) | ||
| 42 | #define MC2_AUDIO_EN (1 << 5) | ||
| 43 | #define MC2_PSW_EN (1 << 6) | ||
| 44 | #define MC2_EN2V7 (1 << 7) | ||
| 45 | |||
| 46 | #define ISP1301_I2C_OTG_CONTROL_1 0x06 /* u8 read, set, +1 clear */ | ||
| 47 | |||
| 48 | #define OTG1_DP_PULLUP (1 << 0) | ||
| 49 | #define OTG1_DM_PULLUP (1 << 1) | ||
| 50 | #define OTG1_DP_PULLDOWN (1 << 2) | ||
| 51 | #define OTG1_DM_PULLDOWN (1 << 3) | ||
| 52 | #define OTG1_ID_PULLDOWN (1 << 4) | ||
| 53 | #define OTG1_VBUS_DRV (1 << 5) | ||
| 54 | #define OTG1_VBUS_DISCHRG (1 << 6) | ||
| 55 | #define OTG1_VBUS_CHRG (1 << 7) | ||
| 56 | |||
| 57 | #define ISP1301_I2C_OTG_CONTROL_2 0x10 /* u8 readonly */ | ||
| 58 | |||
| 59 | #define OTG_B_SESS_END (1 << 6) | ||
| 60 | #define OTG_B_SESS_VLD (1 << 7) | ||
| 61 | |||
| 62 | #define ISP1301_I2C_INTERRUPT_SOURCE 0x8 | ||
| 63 | #define ISP1301_I2C_INTERRUPT_LATCH 0xA | ||
| 64 | #define ISP1301_I2C_INTERRUPT_FALLING 0xC | ||
| 65 | #define ISP1301_I2C_INTERRUPT_RISING 0xE | ||
| 66 | |||
| 67 | #define INT_VBUS_VLD (1 << 0) | ||
| 68 | #define INT_SESS_VLD (1 << 1) | ||
| 69 | #define INT_DP_HI (1 << 2) | ||
| 70 | #define INT_ID_GND (1 << 3) | ||
| 71 | #define INT_DM_HI (1 << 4) | ||
| 72 | #define INT_ID_FLOAT (1 << 5) | ||
| 73 | #define INT_BDIS_ACON (1 << 6) | ||
| 74 | #define INT_CR_INT (1 << 7) | ||
| 75 | |||
| 76 | #define ISP1301_I2C_REG_CLEAR_ADDR 1 /* Register Address Modifier */ | ||
| 77 | |||
| 78 | struct i2c_client *isp1301_get_client(struct device_node *node); | ||
| 79 | |||
| 80 | #endif /* __LINUX_USB_ISP1301_H */ | ||
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h deleted file mode 100644 index 2d2d1bbad9d2..000000000000 --- a/include/linux/usb/langwell_udc.h +++ /dev/null | |||
| @@ -1,310 +0,0 @@ | |||
| 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/rndis_host.h b/include/linux/usb/rndis_host.h index 88fceb718c77..d44ef85db177 100644 --- a/include/linux/usb/rndis_host.h +++ b/include/linux/usb/rndis_host.h | |||
| @@ -20,6 +20,8 @@ | |||
| 20 | #ifndef __LINUX_USB_RNDIS_HOST_H | 20 | #ifndef __LINUX_USB_RNDIS_HOST_H |
| 21 | #define __LINUX_USB_RNDIS_HOST_H | 21 | #define __LINUX_USB_RNDIS_HOST_H |
| 22 | 22 | ||
| 23 | #include <linux/rndis.h> | ||
| 24 | |||
| 23 | /* | 25 | /* |
| 24 | * CONTROL uses CDC "encapsulated commands" with funky notifications. | 26 | * CONTROL uses CDC "encapsulated commands" with funky notifications. |
| 25 | * - control-out: SEND_ENCAPSULATED | 27 | * - control-out: SEND_ENCAPSULATED |
| @@ -49,47 +51,6 @@ struct rndis_msg_hdr { | |||
| 49 | */ | 51 | */ |
| 50 | #define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) | 52 | #define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) |
| 51 | 53 | ||
| 52 | #define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000) | ||
| 53 | |||
| 54 | /* codes for "msg_type" field of rndis messages; | ||
| 55 | * only the data channel uses packet messages (maybe batched); | ||
| 56 | * everything else goes on the control channel. | ||
| 57 | */ | ||
| 58 | #define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */ | ||
| 59 | #define RNDIS_MSG_INIT cpu_to_le32(0x00000002) | ||
| 60 | #define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) | ||
| 61 | #define RNDIS_MSG_HALT cpu_to_le32(0x00000003) | ||
| 62 | #define RNDIS_MSG_QUERY cpu_to_le32(0x00000004) | ||
| 63 | #define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) | ||
| 64 | #define RNDIS_MSG_SET cpu_to_le32(0x00000005) | ||
| 65 | #define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) | ||
| 66 | #define RNDIS_MSG_RESET cpu_to_le32(0x00000006) | ||
| 67 | #define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) | ||
| 68 | #define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007) | ||
| 69 | #define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008) | ||
| 70 | #define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) | ||
| 71 | |||
| 72 | /* codes for "status" field of completion messages */ | ||
| 73 | #define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000) | ||
| 74 | #define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001) | ||
| 75 | #define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015) | ||
| 76 | #define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb) | ||
| 77 | #define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b) | ||
| 78 | #define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c) | ||
| 79 | #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012) | ||
| 80 | |||
| 81 | /* codes for OID_GEN_PHYSICAL_MEDIUM */ | ||
| 82 | #define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000) | ||
| 83 | #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001) | ||
| 84 | #define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002) | ||
| 85 | #define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003) | ||
| 86 | #define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004) | ||
| 87 | #define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005) | ||
| 88 | #define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006) | ||
| 89 | #define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007) | ||
| 90 | #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008) | ||
| 91 | #define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009) | ||
| 92 | |||
| 93 | struct rndis_data_hdr { | 54 | struct rndis_data_hdr { |
| 94 | __le32 msg_type; /* RNDIS_MSG_PACKET */ | 55 | __le32 msg_type; /* RNDIS_MSG_PACKET */ |
| 95 | __le32 msg_len; /* rndis_data_hdr + data_len + pad */ | 56 | __le32 msg_len; /* rndis_data_hdr + data_len + pad */ |
| @@ -222,29 +183,6 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */ | |||
| 222 | __le32 status; | 183 | __le32 status; |
| 223 | } __attribute__ ((packed)); | 184 | } __attribute__ ((packed)); |
| 224 | 185 | ||
| 225 | /* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and | ||
| 226 | * there are gobs more that may optionally be supported. We'll avoid as much | ||
| 227 | * of that mess as possible. | ||
| 228 | */ | ||
| 229 | #define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101) | ||
| 230 | #define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106) | ||
| 231 | #define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e) | ||
| 232 | #define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202) | ||
| 233 | |||
| 234 | /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ | ||
| 235 | #define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001) | ||
| 236 | #define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002) | ||
| 237 | #define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004) | ||
| 238 | #define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008) | ||
| 239 | #define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010) | ||
| 240 | #define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020) | ||
| 241 | #define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040) | ||
| 242 | #define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080) | ||
| 243 | #define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000) | ||
| 244 | #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000) | ||
| 245 | #define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000) | ||
| 246 | #define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000) | ||
| 247 | |||
| 248 | /* default filter used with RNDIS devices */ | 186 | /* default filter used with RNDIS devices */ |
| 249 | #define RNDIS_DEFAULT_FILTER ( \ | 187 | #define RNDIS_DEFAULT_FILTER ( \ |
| 250 | RNDIS_PACKET_TYPE_DIRECTED | \ | 188 | RNDIS_PACKET_TYPE_DIRECTED | \ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 474283888233..86c0b451745d 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * USB Serial Converter stuff | 2 | * USB Serial Converter stuff |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999 - 2005 | 4 | * Copyright (C) 1999 - 2012 |
| 5 | * Greg Kroah-Hartman (greg@kroah.com) | 5 | * Greg Kroah-Hartman (greg@kroah.com) |
| 6 | * | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -249,6 +249,7 @@ struct usb_serial_driver { | |||
| 249 | 249 | ||
| 250 | int (*suspend)(struct usb_serial *serial, pm_message_t message); | 250 | int (*suspend)(struct usb_serial *serial, pm_message_t message); |
| 251 | int (*resume)(struct usb_serial *serial); | 251 | int (*resume)(struct usb_serial *serial); |
| 252 | int (*reset_resume)(struct usb_serial *serial); | ||
| 252 | 253 | ||
| 253 | /* serial function calls */ | 254 | /* serial function calls */ |
| 254 | /* Called by console and by the tty layer */ | 255 | /* Called by console and by the tty layer */ |
| @@ -292,16 +293,11 @@ struct usb_serial_driver { | |||
| 292 | #define to_usb_serial_driver(d) \ | 293 | #define to_usb_serial_driver(d) \ |
| 293 | container_of(d, struct usb_serial_driver, driver) | 294 | container_of(d, struct usb_serial_driver, driver) |
| 294 | 295 | ||
| 295 | extern int usb_serial_register_drivers(struct usb_driver *udriver, | 296 | extern int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[], |
| 296 | struct usb_serial_driver * const serial_drivers[]); | 297 | const char *name, const struct usb_device_id *id_table); |
| 297 | extern void usb_serial_deregister_drivers(struct usb_driver *udriver, | 298 | extern void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]); |
| 298 | struct usb_serial_driver * const serial_drivers[]); | ||
| 299 | extern void usb_serial_port_softint(struct usb_serial_port *port); | 299 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
| 300 | 300 | ||
| 301 | extern int usb_serial_probe(struct usb_interface *iface, | ||
| 302 | const struct usb_device_id *id); | ||
| 303 | extern void usb_serial_disconnect(struct usb_interface *iface); | ||
| 304 | |||
| 305 | extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); | 301 | extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); |
| 306 | extern int usb_serial_resume(struct usb_interface *intf); | 302 | extern int usb_serial_resume(struct usb_interface *intf); |
| 307 | 303 | ||
| @@ -400,8 +396,8 @@ do { \ | |||
| 400 | 396 | ||
| 401 | /* | 397 | /* |
| 402 | * module_usb_serial_driver() - Helper macro for registering a USB Serial driver | 398 | * module_usb_serial_driver() - Helper macro for registering a USB Serial driver |
| 403 | * @__usb_driver: usb_driver struct to register | ||
| 404 | * @__serial_drivers: list of usb_serial drivers to register | 399 | * @__serial_drivers: list of usb_serial drivers to register |
| 400 | * @__ids: all device ids that @__serial_drivers bind to | ||
| 405 | * | 401 | * |
| 406 | * Helper macro for USB serial drivers which do not do anything special | 402 | * Helper macro for USB serial drivers which do not do anything special |
| 407 | * in module init/exit. This eliminates a lot of boilerplate. Each | 403 | * in module init/exit. This eliminates a lot of boilerplate. Each |
| @@ -409,9 +405,21 @@ do { \ | |||
| 409 | * module_init() and module_exit() | 405 | * module_init() and module_exit() |
| 410 | * | 406 | * |
| 411 | */ | 407 | */ |
| 412 | #define module_usb_serial_driver(__usb_driver, __serial_drivers) \ | 408 | #define usb_serial_module_driver(__name, __serial_drivers, __ids) \ |
| 413 | module_driver(__usb_driver, usb_serial_register_drivers, \ | 409 | static int __init usb_serial_module_init(void) \ |
| 414 | usb_serial_deregister_drivers, __serial_drivers) | 410 | { \ |
| 411 | return usb_serial_register_drivers(__serial_drivers, \ | ||
| 412 | __name, __ids); \ | ||
| 413 | } \ | ||
| 414 | module_init(usb_serial_module_init); \ | ||
| 415 | static void __exit usb_serial_module_exit(void) \ | ||
| 416 | { \ | ||
| 417 | usb_serial_deregister_drivers(__serial_drivers); \ | ||
| 418 | } \ | ||
| 419 | module_exit(usb_serial_module_exit); | ||
| 420 | |||
| 421 | #define module_usb_serial_driver(__serial_drivers, __ids) \ | ||
| 422 | usb_serial_module_driver(KBUILD_MODNAME, __serial_drivers, __ids) | ||
| 415 | 423 | ||
| 416 | #endif /* __LINUX_USB_SERIAL_H */ | 424 | #endif /* __LINUX_USB_SERIAL_H */ |
| 417 | 425 | ||
