diff options
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/cdc_ncm.h | 33 | ||||
-rw-r--r-- | include/linux/usb/hcd.h | 16 | ||||
-rw-r--r-- | include/linux/usb/intel_mid_otg.h | 180 | ||||
-rw-r--r-- | include/linux/usb/musb.h | 2 | ||||
-rw-r--r-- | include/linux/usb/omap_control_usb.h | 33 | ||||
-rw-r--r-- | include/linux/usb/serial.h | 2 | ||||
-rw-r--r-- | include/linux/usb/usb_phy_gen_xceiv.h | 5 | ||||
-rw-r--r-- | include/linux/usb/usbnet.h | 1 | ||||
-rw-r--r-- | include/linux/usb/wusb-wa.h | 51 | ||||
-rw-r--r-- | include/linux/usb/wusb.h | 2 |
10 files changed, 84 insertions, 241 deletions
diff --git a/include/linux/usb/cdc_ncm.h b/include/linux/usb/cdc_ncm.h index cc25b70af33c..c3fa80745996 100644 --- a/include/linux/usb/cdc_ncm.h +++ b/include/linux/usb/cdc_ncm.h @@ -36,6 +36,9 @@ * SUCH DAMAGE. */ +#ifndef __LINUX_USB_CDC_NCM_H +#define __LINUX_USB_CDC_NCM_H + #define CDC_NCM_COMM_ALTSETTING_NCM 0 #define CDC_NCM_COMM_ALTSETTING_MBIM 1 @@ -85,22 +88,13 @@ #define cdc_ncm_data_intf_is_mbim(x) ((x)->desc.bInterfaceProtocol == USB_CDC_MBIM_PROTO_NTB) struct cdc_ncm_ctx { - struct usb_cdc_ncm_ntb_parameters ncm_parm; struct hrtimer tx_timer; struct tasklet_struct bh; const struct usb_cdc_ncm_desc *func_desc; - const struct usb_cdc_mbim_desc *mbim_desc; - const struct usb_cdc_header_desc *header_desc; - const struct usb_cdc_union_desc *union_desc; + const struct usb_cdc_mbim_desc *mbim_desc; const struct usb_cdc_ether_desc *ether_desc; - struct net_device *netdev; - struct usb_device *udev; - struct usb_host_endpoint *in_ep; - struct usb_host_endpoint *out_ep; - struct usb_host_endpoint *status_ep; - struct usb_interface *intf; struct usb_interface *control; struct usb_interface *data; @@ -113,8 +107,6 @@ struct cdc_ncm_ctx { u32 tx_timer_pending; u32 tx_curr_frame_num; - u32 rx_speed; - u32 tx_speed; u32 rx_max; u32 tx_max; u32 max_datagram_size; @@ -127,9 +119,14 @@ struct cdc_ncm_ctx { u16 connected; }; -extern u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); -extern int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); -extern void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); -extern struct sk_buff *cdc_ncm_fill_tx_frame(struct cdc_ncm_ctx *ctx, struct sk_buff *skb, __le32 sign); -extern int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); -extern int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset); +u8 cdc_ncm_select_altsetting(struct usbnet *dev, struct usb_interface *intf); +int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting); +void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf); +struct sk_buff *cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign); +int cdc_ncm_rx_verify_nth16(struct cdc_ncm_ctx *ctx, struct sk_buff *skb_in); +int cdc_ncm_rx_verify_ndp16(struct sk_buff *skb_in, int ndpoffset); +struct sk_buff * +cdc_ncm_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); +int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in); + +#endif /* __LINUX_USB_CDC_NCM_H */ diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 75efc45eaa2f..b8aba196f7f1 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -73,6 +73,7 @@ struct giveback_urb_bh { spinlock_t lock; struct list_head head; struct tasklet_struct bh; + struct usb_host_endpoint *completing_ep; }; struct usb_hcd { @@ -140,6 +141,7 @@ struct usb_hcd { unsigned wireless:1; /* Wireless USB HCD */ unsigned authorized_default:1; unsigned has_tt:1; /* Integrated TT in root hub */ + unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ unsigned int irq; /* irq allocated */ void __iomem *regs; /* device memory/io */ @@ -378,6 +380,12 @@ static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd) return hcd->driver->flags & HCD_BH; } +static inline bool hcd_periodic_completion_in_progress(struct usb_hcd *hcd, + struct usb_host_endpoint *ep) +{ + return hcd->high_prio_bh.completing_ep == ep; +} + extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, int status); @@ -428,6 +436,8 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev, extern void usb_hcd_pci_remove(struct pci_dev *dev); extern void usb_hcd_pci_shutdown(struct pci_dev *dev); +extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev); + #ifdef CONFIG_PM extern const struct dev_pm_ops usb_hcd_pci_pm_ops; #endif @@ -496,6 +506,7 @@ struct usb_tt { struct usb_device *hub; /* upstream highspeed hub */ int multi; /* true means one TT per port */ unsigned think_time; /* think time in ns */ + void *hcpriv; /* HCD private data */ /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ spinlock_t lock; @@ -554,9 +565,8 @@ extern void usb_ep0_reinit(struct usb_device *); * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ /* bytecount = data payload byte count */ -#define NS_TO_US(ns) ((ns + 500L) / 1000L) - /* convert & round nanoseconds to microseconds */ - +#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L) + /* convert nanoseconds to microseconds, rounding up */ /* * Full/low speed bandwidth allocation constants/support. diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h deleted file mode 100644 index 756cf5543ffd..000000000000 --- a/include/linux/usb/intel_mid_otg.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Intel MID (Langwell/Penwell) USB OTG Transceiver driver - * Copyright (C) 2008 - 2010, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef __INTEL_MID_OTG_H -#define __INTEL_MID_OTG_H - -#include <linux/pm.h> -#include <linux/usb/otg.h> -#include <linux/notifier.h> - -struct intel_mid_otg_xceiv; - -/* This is a common data structure for Intel MID platform to - * save values of the OTG state machine */ -struct otg_hsm { - /* Input */ - int a_bus_resume; - int a_bus_suspend; - int a_conn; - int a_sess_vld; - int a_srp_det; - int a_vbus_vld; - int b_bus_resume; - int b_bus_suspend; - int b_conn; - int b_se0_srp; - int b_ssend_srp; - int b_sess_end; - int b_sess_vld; - int id; -/* id values */ -#define ID_B 0x05 -#define ID_A 0x04 -#define ID_ACA_C 0x03 -#define ID_ACA_B 0x02 -#define ID_ACA_A 0x01 - int power_up; - int adp_change; - int test_device; - - /* Internal variables */ - int a_set_b_hnp_en; - int b_srp_done; - int b_hnp_enable; - int hnp_poll_enable; - - /* Timeout indicator for timers */ - int a_wait_vrise_tmout; - int a_wait_bcon_tmout; - int a_aidl_bdis_tmout; - int a_bidl_adis_tmout; - int a_bidl_adis_tmr; - int a_wait_vfall_tmout; - int b_ase0_brst_tmout; - int b_bus_suspend_tmout; - int b_srp_init_tmout; - int b_srp_fail_tmout; - int b_srp_fail_tmr; - int b_adp_sense_tmout; - - /* Informative variables */ - int a_bus_drop; - int a_bus_req; - int a_clr_err; - int b_bus_req; - int a_suspend_req; - int b_bus_suspend_vld; - - /* Output */ - int drv_vbus; - int loc_conn; - int loc_sof; - - /* Others */ - int vbus_srp_up; -}; - -/* must provide ULPI access function to read/write registers implemented in - * ULPI address space */ -struct iotg_ulpi_access_ops { - int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val); - int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val); -}; - -#define OTG_A_DEVICE 0x0 -#define OTG_B_DEVICE 0x1 - -/* - * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact - * with device and host drivers to implement the USB OTG related feature. More - * function members are added based on usb_phy data structure for this - * purpose. - */ -struct intel_mid_otg_xceiv { - struct usb_phy otg; - struct otg_hsm hsm; - - /* base address */ - void __iomem *base; - - /* ops to access ulpi */ - struct iotg_ulpi_access_ops ulpi_ops; - - /* atomic notifier for interrupt context */ - struct atomic_notifier_head iotg_notifier; - - /* start/stop USB Host function */ - int (*start_host)(struct intel_mid_otg_xceiv *iotg); - int (*stop_host)(struct intel_mid_otg_xceiv *iotg); - - /* start/stop USB Peripheral function */ - int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg); - int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg); - - /* start/stop ADP sense/probe function */ - int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg, - bool enabled, int dev); - int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg, - bool enabled); - -#ifdef CONFIG_PM - /* suspend/resume USB host function */ - int (*suspend_host)(struct intel_mid_otg_xceiv *iotg, - pm_message_t message); - int (*resume_host)(struct intel_mid_otg_xceiv *iotg); - - int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg, - pm_message_t message); - int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg); -#endif - -}; -static inline -struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg) -{ - return container_of(otg, struct intel_mid_otg_xceiv, otg); -} - -#define MID_OTG_NOTIFY_CONNECT 0x0001 -#define MID_OTG_NOTIFY_DISCONN 0x0002 -#define MID_OTG_NOTIFY_HSUSPEND 0x0003 -#define MID_OTG_NOTIFY_HRESUME 0x0004 -#define MID_OTG_NOTIFY_CSUSPEND 0x0005 -#define MID_OTG_NOTIFY_CRESUME 0x0006 -#define MID_OTG_NOTIFY_HOSTADD 0x0007 -#define MID_OTG_NOTIFY_HOSTREMOVE 0x0008 -#define MID_OTG_NOTIFY_CLIENTADD 0x0009 -#define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a - -static inline int -intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg, - struct notifier_block *nb) -{ - return atomic_notifier_chain_register(&iotg->iotg_notifier, nb); -} - -static inline void -intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg, - struct notifier_block *nb) -{ - atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb); -} - -#endif /* __INTEL_MID_OTG_H */ diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 053c26841cc3..eb505250940a 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h @@ -99,8 +99,6 @@ struct musb_hdrc_platform_data { /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ u8 mode; - u8 has_mailbox:1; - /* for clk_get() */ const char *clock; diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h index 27b5b8c931b0..596b01918813 100644 --- a/include/linux/usb/omap_control_usb.h +++ b/include/linux/usb/omap_control_usb.h @@ -19,20 +19,23 @@ #ifndef __OMAP_CONTROL_USB_H__ #define __OMAP_CONTROL_USB_H__ +enum omap_control_usb_type { + OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */ + OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ + OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */ + OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */ +}; + struct omap_control_usb { struct device *dev; - u32 __iomem *dev_conf; u32 __iomem *otghs_control; - u32 __iomem *phy_power; + u32 __iomem *power; + u32 __iomem *power_aux; struct clk *sys_clk; - u32 type; -}; - -struct omap_control_usb_platform_data { - u8 type; + enum omap_control_usb_type type; }; enum omap_control_usb_mode { @@ -42,10 +45,6 @@ enum omap_control_usb_mode { USB_MODE_DISCONNECT, }; -/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */ -#define OMAP_CTRL_DEV_TYPE1 0x1 -#define OMAP_CTRL_DEV_TYPE2 0x2 - #define OMAP_CTRL_DEV_PHY_PD BIT(0) #define OMAP_CTRL_DEV_AVALID BIT(0) @@ -63,26 +62,18 @@ enum omap_control_usb_mode { #define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 #define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 +#define OMAP_CTRL_USB2_PHY_PD BIT(28) + #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) -extern struct device *omap_get_control_dev(void); extern void omap_control_usb_phy_power(struct device *dev, int on); -extern void omap_control_usb3_phy_power(struct device *dev, bool on); extern void omap_control_usb_set_mode(struct device *dev, enum omap_control_usb_mode mode); #else -static inline struct device *omap_get_control_dev(void) -{ - return ERR_PTR(-ENODEV); -} static inline void omap_control_usb_phy_power(struct device *dev, int on) { } -static inline void omap_control_usb3_phy_power(struct device *dev, int on) -{ -} - static inline void omap_control_usb_set_mode(struct device *dev, enum omap_control_usb_mode mode) { diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index d528b8045150..704a1ab8240c 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -320,6 +320,8 @@ extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor); extern void usb_serial_put(struct usb_serial *serial); extern int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port); +extern int usb_serial_generic_write_start(struct usb_serial_port *port, + gfp_t mem_flags); extern int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *port, const unsigned char *buf, int count); extern void usb_serial_generic_close(struct usb_serial_port *port); diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h index f9a7e7bc925b..cc8d818a83be 100644 --- a/include/linux/usb/usb_phy_gen_xceiv.h +++ b/include/linux/usb/usb_phy_gen_xceiv.h @@ -9,10 +9,11 @@ struct usb_phy_gen_xceiv_platform_data { /* if set fails with -EPROBE_DEFER if can't get regulator */ unsigned int needs_vcc:1; - unsigned int needs_reset:1; + unsigned int needs_reset:1; /* deprecated */ + int gpio_reset; }; -#if IS_ENABLED(CONFIG_NOP_USB_XCEIV) +#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) /* sometimes transceivers are accessed only through e.g. ULPI */ extern void usb_nop_xceiv_register(void); extern void usb_nop_xceiv_unregister(void); diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 9cb2fe8ca944..e303eef94dd5 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -42,6 +42,7 @@ struct usbnet { struct usb_host_endpoint *status; unsigned maxpacket; struct timer_list delay; + const char *padding_pkt; /* protocol/interface state */ struct net_device *net; diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h index 4ff744e2b678..c1257130769b 100644 --- a/include/linux/usb/wusb-wa.h +++ b/include/linux/usb/wusb-wa.h @@ -142,7 +142,7 @@ enum wa_notif_type { struct wa_notif_hdr { u8 bLength; u8 bNotifyType; /* enum wa_notif_type */ -} __attribute__((packed)); +} __packed; /** * HWA DN Received notification [(WUSB] section 8.5.4.2) @@ -158,7 +158,7 @@ struct hwa_notif_dn { u8 bSourceDeviceAddr; /* from errata 2005/07 */ u8 bmAttributes; struct wusb_dn_hdr dndata[]; -} __attribute__((packed)); +} __packed; /* [WUSB] section 8.3.3 */ enum wa_xfer_type { @@ -167,6 +167,8 @@ enum wa_xfer_type { WA_XFER_TYPE_ISO = 0x82, WA_XFER_RESULT = 0x83, WA_XFER_ABORT = 0x84, + WA_XFER_ISO_PACKET_INFO = 0xA0, + WA_XFER_ISO_PACKET_STATUS = 0xA1, }; /* [WUSB] section 8.3.3 */ @@ -177,28 +179,47 @@ struct wa_xfer_hdr { __le32 dwTransferID; /* Host-assigned ID */ __le32 dwTransferLength; /* Length of data to xfer */ u8 bTransferSegment; -} __attribute__((packed)); +} __packed; struct wa_xfer_ctl { struct wa_xfer_hdr hdr; u8 bmAttribute; __le16 wReserved; struct usb_ctrlrequest baSetupData; -} __attribute__((packed)); +} __packed; struct wa_xfer_bi { struct wa_xfer_hdr hdr; u8 bReserved; __le16 wReserved; -} __attribute__((packed)); +} __packed; +/* [WUSB] section 8.5.5 */ struct wa_xfer_hwaiso { struct wa_xfer_hdr hdr; u8 bReserved; __le16 wPresentationTime; __le32 dwNumOfPackets; - /* FIXME: u8 pktdata[]? */ -} __attribute__((packed)); +} __packed; + +struct wa_xfer_packet_info_hwaiso { + __le16 wLength; + u8 bPacketType; + u8 bReserved; + __le16 PacketLength[0]; +} __packed; + +struct wa_xfer_packet_status_len_hwaiso { + __le16 PacketLength; + __le16 PacketStatus; +} __packed; + +struct wa_xfer_packet_status_hwaiso { + __le16 wLength; + u8 bPacketType; + u8 bReserved; + struct wa_xfer_packet_status_len_hwaiso PacketStatus[0]; +} __packed; /* [WUSB] section 8.3.3.5 */ struct wa_xfer_abort { @@ -206,7 +227,7 @@ struct wa_xfer_abort { u8 bRequestType; __le16 wRPipe; /* RPipe index */ __le32 dwTransferID; /* Host-assigned ID */ -} __attribute__((packed)); +} __packed; /** * WA Transfer Complete notification ([WUSB] section 8.3.3.3) @@ -216,7 +237,7 @@ struct wa_notif_xfer { struct wa_notif_hdr hdr; u8 bEndpoint; u8 Reserved; -} __attribute__((packed)); +} __packed; /** Transfer result basic codes [WUSB] table 8-15 */ enum { @@ -243,7 +264,7 @@ struct wa_xfer_result { u8 bTransferSegment; u8 bTransferStatus; __le32 dwNumOfPackets; -} __attribute__((packed)); +} __packed; /** * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). @@ -258,16 +279,16 @@ struct wa_xfer_result { struct usb_wa_descriptor { u8 bLength; u8 bDescriptorType; - u16 bcdWAVersion; + __le16 bcdWAVersion; u8 bNumPorts; /* don't use!! */ u8 bmAttributes; /* Reserved == 0 */ - u16 wNumRPipes; - u16 wRPipeMaxBlock; + __le16 wNumRPipes; + __le16 wRPipeMaxBlock; u8 bRPipeBlockSize; u8 bPwrOn2PwrGood; u8 bNumMMCIEs; u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ -} __attribute__((packed)); +} __packed; /** * HWA Device Information Buffer (WUSB1.0[T8.54]) @@ -277,6 +298,6 @@ struct hwa_dev_info { u8 bDeviceAddress; __le16 wPHYRates; u8 bmDeviceAttribute; -} __attribute__((packed)); +} __packed; #endif /* #ifndef __LINUX_USB_WUSB_WA_H */ diff --git a/include/linux/usb/wusb.h b/include/linux/usb/wusb.h index 0c4d4ca370ec..eeb28329fa3c 100644 --- a/include/linux/usb/wusb.h +++ b/include/linux/usb/wusb.h @@ -271,6 +271,8 @@ static inline u8 wusb_key_index(int index, int type, int originator) #define WUSB_KEY_INDEX_TYPE_GTK 2 #define WUSB_KEY_INDEX_ORIGINATOR_HOST 0 #define WUSB_KEY_INDEX_ORIGINATOR_DEVICE 1 +/* bits 0-3 used for the key index. */ +#define WUSB_KEY_INDEX_MAX 15 /* A CCM Nonce, defined in WUSB1.0[6.4.1] */ struct aes_ccm_nonce { |