summaryrefslogtreecommitdiff
path: root/include/linux/usb
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/composite.h1
-rw-r--r--include/linux/usb/otg.h68
-rw-r--r--include/linux/usb/serial.h6
-rw-r--r--include/linux/usb/ulpi.h7
-rw-r--r--include/linux/usb/usbnet.h8
-rw-r--r--include/linux/usb/wusb.h2
6 files changed, 86 insertions, 6 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 4f6bb3d..738ea1a 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -127,6 +127,7 @@ struct usb_function {
/* private: */
/* internals */
struct list_head list;
+ DECLARE_BITMAP(endpoints, 32);
};
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 2443c0e..52bb917 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -33,6 +33,23 @@ enum usb_otg_state {
OTG_STATE_A_VBUS_ERR,
};
+#define USB_OTG_PULLUP_ID (1 << 0)
+#define USB_OTG_PULLDOWN_DP (1 << 1)
+#define USB_OTG_PULLDOWN_DM (1 << 2)
+#define USB_OTG_EXT_VBUS_INDICATOR (1 << 3)
+#define USB_OTG_DRV_VBUS (1 << 4)
+#define USB_OTG_DRV_VBUS_EXT (1 << 5)
+
+struct otg_transceiver;
+
+/* for transceivers connected thru an ULPI interface, the user must
+ * provide access ops
+ */
+struct otg_io_access_ops {
+ int (*read)(struct otg_transceiver *otg, u32 reg);
+ int (*write)(struct otg_transceiver *otg, u32 val, u32 reg);
+};
+
/*
* the otg driver needs to interact with both device side and host side
* usb controllers. it decides which controller is active at a given
@@ -42,6 +59,7 @@ enum usb_otg_state {
struct otg_transceiver {
struct device *dev;
const char *label;
+ unsigned int flags;
u8 default_a;
enum usb_otg_state state;
@@ -49,10 +67,17 @@ struct otg_transceiver {
struct usb_bus *host;
struct usb_gadget *gadget;
+ struct otg_io_access_ops *io_ops;
+ void __iomem *io_priv;
+
/* to pass extra port status to the root hub */
u16 port_status;
u16 port_change;
+ /* initialize/shutdown the OTG controller */
+ int (*init)(struct otg_transceiver *otg);
+ void (*shutdown)(struct otg_transceiver *otg);
+
/* bind/unbind the host controller */
int (*set_host)(struct otg_transceiver *otg,
struct usb_bus *host);
@@ -65,6 +90,10 @@ struct otg_transceiver {
int (*set_power)(struct otg_transceiver *otg,
unsigned mA);
+ /* effective for A-peripheral, ignored for B devices */
+ int (*set_vbus)(struct otg_transceiver *otg,
+ bool enabled);
+
/* for non-OTG B devices: set transceiver into suspend mode */
int (*set_suspend)(struct otg_transceiver *otg,
int suspend);
@@ -85,6 +114,38 @@ extern int otg_set_transceiver(struct otg_transceiver *);
extern void usb_nop_xceiv_register(void);
extern void usb_nop_xceiv_unregister(void);
+/* helpers for direct access thru low-level io interface */
+static inline int otg_io_read(struct otg_transceiver *otg, u32 reg)
+{
+ if (otg->io_ops && otg->io_ops->read)
+ return otg->io_ops->read(otg, reg);
+
+ return -EINVAL;
+}
+
+static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val)
+{
+ if (otg->io_ops && otg->io_ops->write)
+ return otg->io_ops->write(otg, reg, val);
+
+ return -EINVAL;
+}
+
+static inline int
+otg_init(struct otg_transceiver *otg)
+{
+ if (otg->init)
+ return otg->init(otg);
+
+ return 0;
+}
+
+static inline void
+otg_shutdown(struct otg_transceiver *otg)
+{
+ if (otg->shutdown)
+ otg->shutdown(otg);
+}
/* for usb host and peripheral controller drivers */
extern struct otg_transceiver *otg_get_transceiver(void);
@@ -97,6 +158,12 @@ otg_start_hnp(struct otg_transceiver *otg)
return otg->start_hnp(otg);
}
+/* Context: can sleep */
+static inline int
+otg_set_vbus(struct otg_transceiver *otg, bool enabled)
+{
+ return otg->set_vbus(otg, enabled);
+}
/* for HCDs */
static inline int
@@ -105,7 +172,6 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
return otg->set_host(otg, host);
}
-
/* for usb peripheral controller drivers */
/* Context: can sleep */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index ce911eb..1819396 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -16,6 +16,7 @@
#include <linux/kref.h>
#include <linux/mutex.h>
#include <linux/sysrq.h>
+#include <linux/kfifo.h>
#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -39,8 +40,6 @@ enum port_dev_state {
* @serial: pointer back to the struct usb_serial owner of this port.
* @port: pointer to the corresponding tty_port for this port.
* @lock: spinlock to grab when updating portions of this structure.
- * @mutex: mutex used to synchronize serial_open() and serial_close()
- * access for this port.
* @number: the number of the port (the minor number).
* @interrupt_in_buffer: pointer to the interrupt in buffer for this port.
* @interrupt_in_urb: pointer to the interrupt in struct urb for this port.
@@ -77,7 +76,6 @@ struct usb_serial_port {
struct usb_serial *serial;
struct tty_port port;
spinlock_t lock;
- struct mutex mutex;
unsigned char number;
unsigned char *interrupt_in_buffer;
@@ -97,7 +95,7 @@ struct usb_serial_port {
unsigned char *bulk_out_buffer;
int bulk_out_size;
struct urb *write_urb;
- struct kfifo *write_fifo;
+ struct kfifo write_fifo;
int write_urb_busy;
__u8 bulk_out_endpointAddress;
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h
new file mode 100644
index 0000000..20675c6
--- /dev/null
+++ b/include/linux/usb/ulpi.h
@@ -0,0 +1,7 @@
+#ifndef __LINUX_USB_ULPI_H
+#define __LINUX_USB_ULPI_H
+
+struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops,
+ unsigned int flags);
+
+#endif /* __LINUX_USB_ULPI_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f814730..8ce6135 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -55,6 +55,7 @@ struct usbnet {
struct sk_buff_head done;
struct sk_buff_head rxq_pause;
struct urb *interrupt;
+ struct usb_anchor deferred;
struct tasklet_struct bh;
struct work_struct kevent;
@@ -65,6 +66,8 @@ struct usbnet {
# define EVENT_STS_SPLIT 3
# define EVENT_LINK_RESET 4
# define EVENT_RX_PAUSED 5
+# define EVENT_DEV_WAKING 6
+# define EVENT_DEV_ASLEEP 7
};
static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -90,7 +93,9 @@ struct driver_info {
#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */
#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */
+#define FLAG_WWAN 0x0400 /* use "wwan%d" names */
+#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */
/* init device ... can sleep, or cause probe() failure */
int (*bind)(struct usbnet *, struct usb_interface *);
@@ -107,6 +112,9 @@ struct driver_info {
/* see if peer is connected ... can sleep */
int (*check_connect)(struct usbnet *);
+ /* (dis)activate runtime power management */
+ int (*manage_power)(struct usbnet *, int);
+
/* for status polling */
void (*status)(struct usbnet *, struct urb *);
diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h
index 429c631..63ebdcc 100644
--- a/include/linux/usb/wusb.h
+++ b/include/linux/usb/wusb.h
@@ -74,7 +74,7 @@ enum {
* WUSB defines that CHIDs, CDIDs and CKs are a 16 byte string of
* data. In order to avoid confusion and enforce types, we wrap it.
*
- * Make it packed, as we use it in some hw defintions.
+ * Make it packed, as we use it in some hw definitions.
*/
struct wusb_ckhdid {
u8 data[16];