diff options
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/composite.h | 1 | ||||
| -rw-r--r-- | include/linux/usb/otg.h | 68 | ||||
| -rw-r--r-- | include/linux/usb/serial.h | 3 | ||||
| -rw-r--r-- | include/linux/usb/ulpi.h | 7 | ||||
| -rw-r--r-- | include/linux/usb/usbnet.h | 8 | ||||
| -rw-r--r-- | include/linux/usb/wusb.h | 2 |
6 files changed, 84 insertions, 5 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 4f6bb3d2160e..738ea1a691cb 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -127,6 +127,7 @@ struct usb_function { | |||
| 127 | /* private: */ | 127 | /* private: */ |
| 128 | /* internals */ | 128 | /* internals */ |
| 129 | struct list_head list; | 129 | struct list_head list; |
| 130 | DECLARE_BITMAP(endpoints, 32); | ||
| 130 | }; | 131 | }; |
| 131 | 132 | ||
| 132 | int usb_add_function(struct usb_configuration *, struct usb_function *); | 133 | int usb_add_function(struct usb_configuration *, struct usb_function *); |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 2443c0e7a80c..52bb917641f0 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
| @@ -33,6 +33,23 @@ enum usb_otg_state { | |||
| 33 | OTG_STATE_A_VBUS_ERR, | 33 | OTG_STATE_A_VBUS_ERR, |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | #define USB_OTG_PULLUP_ID (1 << 0) | ||
| 37 | #define USB_OTG_PULLDOWN_DP (1 << 1) | ||
| 38 | #define USB_OTG_PULLDOWN_DM (1 << 2) | ||
| 39 | #define USB_OTG_EXT_VBUS_INDICATOR (1 << 3) | ||
| 40 | #define USB_OTG_DRV_VBUS (1 << 4) | ||
| 41 | #define USB_OTG_DRV_VBUS_EXT (1 << 5) | ||
| 42 | |||
| 43 | struct otg_transceiver; | ||
| 44 | |||
| 45 | /* for transceivers connected thru an ULPI interface, the user must | ||
| 46 | * provide access ops | ||
| 47 | */ | ||
| 48 | struct otg_io_access_ops { | ||
| 49 | int (*read)(struct otg_transceiver *otg, u32 reg); | ||
| 50 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | ||
| 51 | }; | ||
| 52 | |||
| 36 | /* | 53 | /* |
| 37 | * the otg driver needs to interact with both device side and host side | 54 | * the otg driver needs to interact with both device side and host side |
| 38 | * usb controllers. it decides which controller is active at a given | 55 | * usb controllers. it decides which controller is active at a given |
| @@ -42,6 +59,7 @@ enum usb_otg_state { | |||
| 42 | struct otg_transceiver { | 59 | struct otg_transceiver { |
| 43 | struct device *dev; | 60 | struct device *dev; |
| 44 | const char *label; | 61 | const char *label; |
| 62 | unsigned int flags; | ||
| 45 | 63 | ||
| 46 | u8 default_a; | 64 | u8 default_a; |
| 47 | enum usb_otg_state state; | 65 | enum usb_otg_state state; |
| @@ -49,10 +67,17 @@ struct otg_transceiver { | |||
| 49 | struct usb_bus *host; | 67 | struct usb_bus *host; |
| 50 | struct usb_gadget *gadget; | 68 | struct usb_gadget *gadget; |
| 51 | 69 | ||
| 70 | struct otg_io_access_ops *io_ops; | ||
| 71 | void __iomem *io_priv; | ||
| 72 | |||
| 52 | /* to pass extra port status to the root hub */ | 73 | /* to pass extra port status to the root hub */ |
| 53 | u16 port_status; | 74 | u16 port_status; |
| 54 | u16 port_change; | 75 | u16 port_change; |
| 55 | 76 | ||
| 77 | /* initialize/shutdown the OTG controller */ | ||
| 78 | int (*init)(struct otg_transceiver *otg); | ||
| 79 | void (*shutdown)(struct otg_transceiver *otg); | ||
| 80 | |||
| 56 | /* bind/unbind the host controller */ | 81 | /* bind/unbind the host controller */ |
| 57 | int (*set_host)(struct otg_transceiver *otg, | 82 | int (*set_host)(struct otg_transceiver *otg, |
| 58 | struct usb_bus *host); | 83 | struct usb_bus *host); |
| @@ -65,6 +90,10 @@ struct otg_transceiver { | |||
| 65 | int (*set_power)(struct otg_transceiver *otg, | 90 | int (*set_power)(struct otg_transceiver *otg, |
| 66 | unsigned mA); | 91 | unsigned mA); |
| 67 | 92 | ||
| 93 | /* effective for A-peripheral, ignored for B devices */ | ||
| 94 | int (*set_vbus)(struct otg_transceiver *otg, | ||
| 95 | bool enabled); | ||
| 96 | |||
| 68 | /* for non-OTG B devices: set transceiver into suspend mode */ | 97 | /* for non-OTG B devices: set transceiver into suspend mode */ |
| 69 | int (*set_suspend)(struct otg_transceiver *otg, | 98 | int (*set_suspend)(struct otg_transceiver *otg, |
| 70 | int suspend); | 99 | int suspend); |
| @@ -85,6 +114,38 @@ extern int otg_set_transceiver(struct otg_transceiver *); | |||
| 85 | extern void usb_nop_xceiv_register(void); | 114 | extern void usb_nop_xceiv_register(void); |
| 86 | extern void usb_nop_xceiv_unregister(void); | 115 | extern void usb_nop_xceiv_unregister(void); |
| 87 | 116 | ||
| 117 | /* helpers for direct access thru low-level io interface */ | ||
| 118 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | ||
| 119 | { | ||
| 120 | if (otg->io_ops && otg->io_ops->read) | ||
| 121 | return otg->io_ops->read(otg, reg); | ||
| 122 | |||
| 123 | return -EINVAL; | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) | ||
| 127 | { | ||
| 128 | if (otg->io_ops && otg->io_ops->write) | ||
| 129 | return otg->io_ops->write(otg, reg, val); | ||
| 130 | |||
| 131 | return -EINVAL; | ||
| 132 | } | ||
| 133 | |||
| 134 | static inline int | ||
| 135 | otg_init(struct otg_transceiver *otg) | ||
| 136 | { | ||
| 137 | if (otg->init) | ||
| 138 | return otg->init(otg); | ||
| 139 | |||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | static inline void | ||
| 144 | otg_shutdown(struct otg_transceiver *otg) | ||
| 145 | { | ||
| 146 | if (otg->shutdown) | ||
| 147 | otg->shutdown(otg); | ||
| 148 | } | ||
| 88 | 149 | ||
| 89 | /* for usb host and peripheral controller drivers */ | 150 | /* for usb host and peripheral controller drivers */ |
| 90 | extern struct otg_transceiver *otg_get_transceiver(void); | 151 | extern struct otg_transceiver *otg_get_transceiver(void); |
| @@ -97,6 +158,12 @@ otg_start_hnp(struct otg_transceiver *otg) | |||
| 97 | return otg->start_hnp(otg); | 158 | return otg->start_hnp(otg); |
| 98 | } | 159 | } |
| 99 | 160 | ||
| 161 | /* Context: can sleep */ | ||
| 162 | static inline int | ||
| 163 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | ||
| 164 | { | ||
| 165 | return otg->set_vbus(otg, enabled); | ||
| 166 | } | ||
| 100 | 167 | ||
| 101 | /* for HCDs */ | 168 | /* for HCDs */ |
| 102 | static inline int | 169 | static inline int |
| @@ -105,7 +172,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
| 105 | return otg->set_host(otg, host); | 172 | return otg->set_host(otg, host); |
| 106 | } | 173 | } |
| 107 | 174 | ||
| 108 | |||
| 109 | /* for usb peripheral controller drivers */ | 175 | /* for usb peripheral controller drivers */ |
| 110 | 176 | ||
| 111 | /* Context: can sleep */ | 177 | /* Context: can sleep */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index ce911ebf91e8..acf6e457c04b 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -39,8 +39,6 @@ enum port_dev_state { | |||
| 39 | * @serial: pointer back to the struct usb_serial owner of this port. | 39 | * @serial: pointer back to the struct usb_serial owner of this port. |
| 40 | * @port: pointer to the corresponding tty_port for this port. | 40 | * @port: pointer to the corresponding tty_port for this port. |
| 41 | * @lock: spinlock to grab when updating portions of this structure. | 41 | * @lock: spinlock to grab when updating portions of this structure. |
| 42 | * @mutex: mutex used to synchronize serial_open() and serial_close() | ||
| 43 | * access for this port. | ||
| 44 | * @number: the number of the port (the minor number). | 42 | * @number: the number of the port (the minor number). |
| 45 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 43 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
| 46 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | 44 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. |
| @@ -77,7 +75,6 @@ struct usb_serial_port { | |||
| 77 | struct usb_serial *serial; | 75 | struct usb_serial *serial; |
| 78 | struct tty_port port; | 76 | struct tty_port port; |
| 79 | spinlock_t lock; | 77 | spinlock_t lock; |
| 80 | struct mutex mutex; | ||
| 81 | unsigned char number; | 78 | unsigned char number; |
| 82 | 79 | ||
| 83 | unsigned char *interrupt_in_buffer; | 80 | unsigned char *interrupt_in_buffer; |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h new file mode 100644 index 000000000000..20675c6ebc4d --- /dev/null +++ b/include/linux/usb/ulpi.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #ifndef __LINUX_USB_ULPI_H | ||
| 2 | #define __LINUX_USB_ULPI_H | ||
| 3 | |||
| 4 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | ||
| 5 | unsigned int flags); | ||
| 6 | |||
| 7 | #endif /* __LINUX_USB_ULPI_H */ | ||
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index f81473052059..8ce61359bf73 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
| @@ -55,6 +55,7 @@ struct usbnet { | |||
| 55 | struct sk_buff_head done; | 55 | struct sk_buff_head done; |
| 56 | struct sk_buff_head rxq_pause; | 56 | struct sk_buff_head rxq_pause; |
| 57 | struct urb *interrupt; | 57 | struct urb *interrupt; |
| 58 | struct usb_anchor deferred; | ||
| 58 | struct tasklet_struct bh; | 59 | struct tasklet_struct bh; |
| 59 | 60 | ||
| 60 | struct work_struct kevent; | 61 | struct work_struct kevent; |
| @@ -65,6 +66,8 @@ struct usbnet { | |||
| 65 | # define EVENT_STS_SPLIT 3 | 66 | # define EVENT_STS_SPLIT 3 |
| 66 | # define EVENT_LINK_RESET 4 | 67 | # define EVENT_LINK_RESET 4 |
| 67 | # define EVENT_RX_PAUSED 5 | 68 | # define EVENT_RX_PAUSED 5 |
| 69 | # define EVENT_DEV_WAKING 6 | ||
| 70 | # define EVENT_DEV_ASLEEP 7 | ||
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 73 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
| @@ -90,7 +93,9 @@ struct driver_info { | |||
| 90 | #define FLAG_WLAN 0x0080 /* use "wlan%d" names */ | 93 | #define FLAG_WLAN 0x0080 /* use "wlan%d" names */ |
| 91 | #define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ | 94 | #define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ |
| 92 | #define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ | 95 | #define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ |
| 96 | #define FLAG_WWAN 0x0400 /* use "wwan%d" names */ | ||
| 93 | 97 | ||
| 98 | #define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ | ||
| 94 | 99 | ||
| 95 | /* init device ... can sleep, or cause probe() failure */ | 100 | /* init device ... can sleep, or cause probe() failure */ |
| 96 | int (*bind)(struct usbnet *, struct usb_interface *); | 101 | int (*bind)(struct usbnet *, struct usb_interface *); |
| @@ -107,6 +112,9 @@ struct driver_info { | |||
| 107 | /* see if peer is connected ... can sleep */ | 112 | /* see if peer is connected ... can sleep */ |
| 108 | int (*check_connect)(struct usbnet *); | 113 | int (*check_connect)(struct usbnet *); |
| 109 | 114 | ||
| 115 | /* (dis)activate runtime power management */ | ||
| 116 | int (*manage_power)(struct usbnet *, int); | ||
| 117 | |||
| 110 | /* for status polling */ | 118 | /* for status polling */ |
| 111 | void (*status)(struct usbnet *, struct urb *); | 119 | void (*status)(struct usbnet *, struct urb *); |
| 112 | 120 | ||
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 429c631d2aad..63ebdcc5dda6 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h | |||
| @@ -74,7 +74,7 @@ enum { | |||
| 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of | 74 | * WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of |
| 75 | * data. In order to avoid confusion and enforce types, we wrap it. | 75 | * data. In order to avoid confusion and enforce types, we wrap it. |
| 76 | * | 76 | * |
| 77 | * Make it packed, as we use it in some hw defintions. | 77 | * Make it packed, as we use it in some hw definitions. |
| 78 | */ | 78 | */ |
| 79 | struct wusb_ckhdid { | 79 | struct wusb_ckhdid { |
| 80 | u8 data[16]; | 80 | u8 data[16]; |
