summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2023-03-20 09:03:43 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2023-03-20 16:05:12 +0100
commit253e3e4f47bfbc2919dbe9e0dce35f054009cdb6 (patch)
tree722b728d788adc24c97c1d367255355cb14486a1 /include/usb
parent37ea6d0f30d45b4ad5539a9748ebf5e4e5635132 (diff)
downloadbarebox-253e3e4f47bfbc2919dbe9e0dce35f054009cdb6.tar.gz
barebox-253e3e4f47bfbc2919dbe9e0dce35f054009cdb6.tar.xz
usb: move include files to place where Linux has them
For easier patch merging and comparison with Linux move the usb gadget files to where Linux has them. For now do a plain git mv include/usb include/linux/usb, eventhough there might be some files which are purely barebox specific. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/cdc.h252
-rw-r--r--include/usb/ch11.h281
-rw-r--r--include/usb/ch9.h1047
-rw-r--r--include/usb/chipidea-imx.h64
-rw-r--r--include/usb/composite.h494
-rw-r--r--include/usb/dfu.h34
-rw-r--r--include/usb/ehci.h41
-rw-r--r--include/usb/fastboot.h19
-rw-r--r--include/usb/fsl_usb2.h33
-rw-r--r--include/usb/gadget-multi.h42
-rw-r--r--include/usb/gadget.h1030
-rw-r--r--include/usb/mass_storage.h29
-rw-r--r--include/usb/musb.h146
-rw-r--r--include/usb/phy.h222
-rw-r--r--include/usb/storage.h87
-rw-r--r--include/usb/twl4030.h28
-rw-r--r--include/usb/ulpi.h61
-rw-r--r--include/usb/usb.h495
-rw-r--r--include/usb/usb_defs.h150
-rw-r--r--include/usb/usbnet.h183
-rw-r--r--include/usb/usbroothubdes.h128
-rw-r--r--include/usb/usbserial.h13
-rw-r--r--include/usb/xhci.h27
23 files changed, 0 insertions, 4906 deletions
diff --git a/include/usb/cdc.h b/include/usb/cdc.h
deleted file mode 100644
index e29429d783..0000000000
--- a/include/usb/cdc.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/*
- * USB Communications Device Class (CDC) definitions
- *
- * CDC says how to talk to lots of different types of network adapters,
- * notably ethernet adapters and various modems. It's used mostly with
- * firmware based USB peripherals.
- */
-
-#ifndef __LINUX_USB_CDC_H
-#define __LINUX_USB_CDC_H
-
-#include <linux/types.h>
-
-#define USB_CDC_SUBCLASS_ACM 0x02
-#define USB_CDC_SUBCLASS_ETHERNET 0x06
-#define USB_CDC_SUBCLASS_WHCM 0x08
-#define USB_CDC_SUBCLASS_DMM 0x09
-#define USB_CDC_SUBCLASS_MDLM 0x0a
-#define USB_CDC_SUBCLASS_OBEX 0x0b
-#define USB_CDC_SUBCLASS_EEM 0x0c
-
-#define USB_CDC_PROTO_NONE 0
-
-#define USB_CDC_ACM_PROTO_AT_V25TER 1
-#define USB_CDC_ACM_PROTO_AT_PCCA101 2
-#define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE 3
-#define USB_CDC_ACM_PROTO_AT_GSM 4
-#define USB_CDC_ACM_PROTO_AT_3G 5
-#define USB_CDC_ACM_PROTO_AT_CDMA 6
-#define USB_CDC_ACM_PROTO_VENDOR 0xff
-
-#define USB_CDC_PROTO_EEM 7
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * Class-Specific descriptors ... there are a couple dozen of them
- */
-
-#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
-#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
-#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
-#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
-#define USB_CDC_COUNTRY_TYPE 0x07
-#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
-#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
-#define USB_CDC_WHCM_TYPE 0x11
-#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
-#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
-#define USB_CDC_DMM_TYPE 0x14
-#define USB_CDC_OBEX_TYPE 0x15
-
-/* "Header Functional Descriptor" from CDC spec 5.2.3.1 */
-struct usb_cdc_header_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __le16 bcdCDC;
-} __attribute__ ((packed));
-
-/* "Call Management Descriptor" from CDC spec 5.2.3.2 */
-struct usb_cdc_call_mgmt_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 bmCapabilities;
-#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT 0x01
-#define USB_CDC_CALL_MGMT_CAP_DATA_INTF 0x02
-
- __u8 bDataInterface;
-} __attribute__ ((packed));
-
-/* "Abstract Control Management Descriptor" from CDC spec 5.2.3.3 */
-struct usb_cdc_acm_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 bmCapabilities;
-} __attribute__ ((packed));
-
-/* capabilities from 5.2.3.3 */
-
-#define USB_CDC_COMM_FEATURE 0x01
-#define USB_CDC_CAP_LINE 0x02
-#define USB_CDC_CAP_BRK 0x04
-#define USB_CDC_CAP_NOTIFY 0x08
-
-/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */
-struct usb_cdc_union_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 bMasterInterface0;
- __u8 bSlaveInterface0;
- /* ... and there could be other slave interfaces */
-} __attribute__ ((packed));
-
-/* "Country Selection Functional Descriptor" from CDC spec 5.2.3.9 */
-struct usb_cdc_country_functional_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 iCountryCodeRelDate;
- __le16 wCountyCode0;
- /* ... and there can be a lot of country codes */
-} __attribute__ ((packed));
-
-/* "Network Channel Terminal Functional Descriptor" from CDC spec 5.2.3.11 */
-struct usb_cdc_network_terminal_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 bEntityId;
- __u8 iName;
- __u8 bChannelIndex;
- __u8 bPhysicalInterface;
-} __attribute__ ((packed));
-
-/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */
-struct usb_cdc_ether_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __u8 iMACAddress;
- __le32 bmEthernetStatistics;
- __le16 wMaxSegmentSize;
- __le16 wNumberMCFilters;
- __u8 bNumberPowerFilters;
-} __attribute__ ((packed));
-
-/* "Telephone Control Model Functional Descriptor" from CDC WMC spec 6.3..3 */
-struct usb_cdc_dmm_desc {
- __u8 bFunctionLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubtype;
- __u16 bcdVersion;
- __le16 wMaxCommand;
-} __attribute__ ((packed));
-
-/* "MDLM Functional Descriptor" from CDC WMC spec 6.7.2.3 */
-struct usb_cdc_mdlm_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __le16 bcdVersion;
- __u8 bGUID[16];
-} __attribute__ ((packed));
-
-/* "MDLM Detail Functional Descriptor" from CDC WMC spec 6.7.2.4 */
-struct usb_cdc_mdlm_detail_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- /* type is associated with mdlm_desc.bGUID */
- __u8 bGuidDescriptorType;
- __u8 bDetailData[0];
-} __attribute__ ((packed));
-
-/* "OBEX Control Model Functional Descriptor" */
-struct usb_cdc_obex_desc {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDescriptorSubType;
-
- __le16 bcdVersion;
-} __attribute__ ((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * Class-Specific Control Requests (6.2)
- *
- * section 3.6.2.1 table 4 has the ACM profile, for modems.
- * section 3.8.2 table 10 has the ethernet profile.
- *
- * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant,
- * heavily dependent on the encapsulated (proprietary) command mechanism.
- */
-
-#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00
-#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01
-#define USB_CDC_REQ_SET_LINE_CODING 0x20
-#define USB_CDC_REQ_GET_LINE_CODING 0x21
-#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
-#define USB_CDC_REQ_SEND_BREAK 0x23
-#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40
-#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41
-#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42
-#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43
-#define USB_CDC_GET_ETHERNET_STATISTIC 0x44
-
-/* Line Coding Structure from CDC spec 6.2.13 */
-struct usb_cdc_line_coding {
- __le32 dwDTERate;
- __u8 bCharFormat;
-#define USB_CDC_1_STOP_BITS 0
-#define USB_CDC_1_5_STOP_BITS 1
-#define USB_CDC_2_STOP_BITS 2
-
- __u8 bParityType;
-#define USB_CDC_NO_PARITY 0
-#define USB_CDC_ODD_PARITY 1
-#define USB_CDC_EVEN_PARITY 2
-#define USB_CDC_MARK_PARITY 3
-#define USB_CDC_SPACE_PARITY 4
-
- __u8 bDataBits;
-} __attribute__ ((packed));
-
-/* table 62; bits in multicast filter */
-#define USB_CDC_PACKET_TYPE_PROMISCUOUS (1 << 0)
-#define USB_CDC_PACKET_TYPE_ALL_MULTICAST (1 << 1) /* no filter */
-#define USB_CDC_PACKET_TYPE_DIRECTED (1 << 2)
-#define USB_CDC_PACKET_TYPE_BROADCAST (1 << 3)
-#define USB_CDC_PACKET_TYPE_MULTICAST (1 << 4) /* filtered */
-
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * Class-Specific Notifications (6.3) sent by interrupt transfers
- *
- * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications
- * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS
- * RNDIS also defines its own bit-incompatible notifications
- */
-
-#define USB_CDC_NOTIFY_NETWORK_CONNECTION 0x00
-#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE 0x01
-#define USB_CDC_NOTIFY_SERIAL_STATE 0x20
-#define USB_CDC_NOTIFY_SPEED_CHANGE 0x2a
-
-struct usb_cdc_notification {
- __u8 bmRequestType;
- __u8 bNotificationType;
- __le16 wValue;
- __le16 wIndex;
- __le16 wLength;
-} __attribute__ ((packed));
-
-#endif /* __LINUX_USB_CDC_H */
diff --git a/include/usb/ch11.h b/include/usb/ch11.h
deleted file mode 100644
index c712d80275..0000000000
--- a/include/usb/ch11.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/*
- * This file holds Hub protocol constants and data structures that are
- * defined in chapter 11 (Hub Specification) of the USB 2.0 specification.
- *
- * It is used/shared between the USB core, the HCDs and couple of other USB
- * drivers.
- */
-
-#ifndef __LINUX_CH11_H
-#define __LINUX_CH11_H
-
-#include <linux/types.h> /* __u8 etc */
-
-/* This is arbitrary.
- * From USB 2.0 spec Table 11-13, offset 7, a hub can
- * have up to 255 ports. The most yet reported is 10.
- *
- * Current Wireless USB host hardware (Intel i1480 for example) allows
- * up to 22 devices to connect. Upcoming hardware might raise that
- * limit. Because the arrays need to add a bit for hub status data, we
- * use 31, so plus one evens out to four bytes.
- *
- * Reduced to 8 max children for Barebox.
- */
-#define USB_MAXCHILDREN 8
-
-/*
- * Hub request types
- */
-
-#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
-#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
-
-/*
- * Hub class requests
- * See USB 2.0 spec Table 11-16
- */
-#define HUB_CLEAR_TT_BUFFER 8
-#define HUB_RESET_TT 9
-#define HUB_GET_TT_STATE 10
-#define HUB_STOP_TT 11
-
-/*
- * Hub class additional requests defined by USB 3.0 spec
- * See USB 3.0 spec Table 10-6
- */
-#define HUB_SET_DEPTH 12
-#define HUB_GET_PORT_ERR_COUNT 13
-
-/*
- * Hub Class feature numbers
- * See USB 2.0 spec Table 11-17
- */
-#define C_HUB_LOCAL_POWER 0
-#define C_HUB_OVER_CURRENT 1
-
-/*
- * Port feature numbers
- * See USB 2.0 spec Table 11-17
- */
-#define USB_PORT_FEAT_CONNECTION 0
-#define USB_PORT_FEAT_ENABLE 1
-#define USB_PORT_FEAT_SUSPEND 2 /* L2 suspend */
-#define USB_PORT_FEAT_OVER_CURRENT 3
-#define USB_PORT_FEAT_RESET 4
-#define USB_PORT_FEAT_L1 5 /* L1 suspend */
-#define USB_PORT_FEAT_POWER 8
-#define USB_PORT_FEAT_LOWSPEED 9 /* Should never be used */
-#define USB_PORT_FEAT_C_CONNECTION 16
-#define USB_PORT_FEAT_C_ENABLE 17
-#define USB_PORT_FEAT_C_SUSPEND 18
-#define USB_PORT_FEAT_C_OVER_CURRENT 19
-#define USB_PORT_FEAT_C_RESET 20
-#define USB_PORT_FEAT_TEST 21
-#define USB_PORT_FEAT_INDICATOR 22
-#define USB_PORT_FEAT_C_PORT_L1 23
-
-/*
- * Port feature selectors added by USB 3.0 spec.
- * See USB 3.0 spec Table 10-7
- */
-#define USB_PORT_FEAT_LINK_STATE 5
-#define USB_PORT_FEAT_U1_TIMEOUT 23
-#define USB_PORT_FEAT_U2_TIMEOUT 24
-#define USB_PORT_FEAT_C_PORT_LINK_STATE 25
-#define USB_PORT_FEAT_C_PORT_CONFIG_ERROR 26
-#define USB_PORT_FEAT_REMOTE_WAKE_MASK 27
-#define USB_PORT_FEAT_BH_PORT_RESET 28
-#define USB_PORT_FEAT_C_BH_PORT_RESET 29
-#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
-
-#define USB_PORT_LPM_TIMEOUT(p) (((p) & 0xff) << 8)
-
-/* USB 3.0 hub remote wake mask bits, see table 10-14 */
-#define USB_PORT_FEAT_REMOTE_WAKE_CONNECT (1 << 8)
-#define USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT (1 << 9)
-#define USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT (1 << 10)
-
-/*
- * Hub Status and Hub Change results
- * See USB 2.0 spec Table 11-19 and Table 11-20
- */
-struct usb_port_status {
- __le16 wPortStatus;
- __le16 wPortChange;
-} __attribute__ ((packed));
-
-/*
- * wPortStatus bit field
- * See USB 2.0 spec Table 11-21
- */
-#define USB_PORT_STAT_CONNECTION 0x0001
-#define USB_PORT_STAT_ENABLE 0x0002
-#define USB_PORT_STAT_SUSPEND 0x0004
-#define USB_PORT_STAT_OVERCURRENT 0x0008
-#define USB_PORT_STAT_RESET 0x0010
-#define USB_PORT_STAT_L1 0x0020
-/* bits 6 to 7 are reserved */
-#define USB_PORT_STAT_POWER 0x0100
-#define USB_PORT_STAT_LOW_SPEED 0x0200
-#define USB_PORT_STAT_HIGH_SPEED 0x0400
-#define USB_PORT_STAT_TEST 0x0800
-#define USB_PORT_STAT_INDICATOR 0x1000
-/* bits 13 to 15 are reserved */
-
-/*
- * Additions to wPortStatus bit field from USB 3.0
- * See USB 3.0 spec Table 10-10
- */
-#define USB_PORT_STAT_LINK_STATE 0x01e0
-#define USB_SS_PORT_STAT_POWER 0x0200
-#define USB_SS_PORT_STAT_SPEED 0x1c00
-#define USB_PORT_STAT_SPEED_5GBPS 0x0000
-/* Valid only if port is enabled */
-/* Bits that are the same from USB 2.0 */
-#define USB_SS_PORT_STAT_MASK (USB_PORT_STAT_CONNECTION | \
- USB_PORT_STAT_ENABLE | \
- USB_PORT_STAT_OVERCURRENT | \
- USB_PORT_STAT_RESET)
-
-/*
- * Definitions for PORT_LINK_STATE values
- * (bits 5-8) in wPortStatus
- */
-#define USB_SS_PORT_LS_U0 0x0000
-#define USB_SS_PORT_LS_U1 0x0020
-#define USB_SS_PORT_LS_U2 0x0040
-#define USB_SS_PORT_LS_U3 0x0060
-#define USB_SS_PORT_LS_SS_DISABLED 0x0080
-#define USB_SS_PORT_LS_RX_DETECT 0x00a0
-#define USB_SS_PORT_LS_SS_INACTIVE 0x00c0
-#define USB_SS_PORT_LS_POLLING 0x00e0
-#define USB_SS_PORT_LS_RECOVERY 0x0100
-#define USB_SS_PORT_LS_HOT_RESET 0x0120
-#define USB_SS_PORT_LS_COMP_MOD 0x0140
-#define USB_SS_PORT_LS_LOOPBACK 0x0160
-
-/*
- * wPortChange bit field
- * See USB 2.0 spec Table 11-22 and USB 2.0 LPM ECN Table-4.10
- * Bits 0 to 5 shown, bits 6 to 15 are reserved
- */
-#define USB_PORT_STAT_C_CONNECTION 0x0001
-#define USB_PORT_STAT_C_ENABLE 0x0002
-#define USB_PORT_STAT_C_SUSPEND 0x0004
-#define USB_PORT_STAT_C_OVERCURRENT 0x0008
-#define USB_PORT_STAT_C_RESET 0x0010
-#define USB_PORT_STAT_C_L1 0x0020
-/*
- * USB 3.0 wPortChange bit fields
- * See USB 3.0 spec Table 10-11
- */
-#define USB_PORT_STAT_C_BH_RESET 0x0020
-#define USB_PORT_STAT_C_LINK_STATE 0x0040
-#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080
-
-/*
- * wHubCharacteristics (masks)
- * See USB 2.0 spec Table 11-13, offset 3
- */
-#define HUB_CHAR_LPSM 0x0003 /* Logical Power Switching Mode mask */
-#define HUB_CHAR_COMMON_LPSM 0x0000 /* All ports power control at once */
-#define HUB_CHAR_INDV_PORT_LPSM 0x0001 /* per-port power control */
-#define HUB_CHAR_NO_LPSM 0x0002 /* no power switching */
-
-#define HUB_CHAR_COMPOUND 0x0004 /* hub is part of a compound device */
-
-#define HUB_CHAR_OCPM 0x0018 /* Over-Current Protection Mode mask */
-#define HUB_CHAR_COMMON_OCPM 0x0000 /* All ports Over-Current reporting */
-#define HUB_CHAR_INDV_PORT_OCPM 0x0008 /* per-port Over-current reporting */
-#define HUB_CHAR_NO_OCPM 0x0010 /* No Over-current Protection support */
-
-#define HUB_CHAR_TTTT 0x0060 /* TT Think Time mask */
-#define HUB_CHAR_PORTIND 0x0080 /* per-port indicators (LEDs) */
-
-struct usb_hub_status {
- __le16 wHubStatus;
- __le16 wHubChange;
-} __attribute__ ((packed));
-
-/*
- * Hub Status & Hub Change bit masks
- * See USB 2.0 spec Table 11-19 and Table 11-20
- * Bits 0 and 1 for wHubStatus and wHubChange
- * Bits 2 to 15 are reserved for both
- */
-#define HUB_STATUS_LOCAL_POWER 0x0001
-#define HUB_STATUS_OVERCURRENT 0x0002
-#define HUB_CHANGE_LOCAL_POWER 0x0001
-#define HUB_CHANGE_OVERCURRENT 0x0002
-
-
-/*
- * Hub descriptor
- * See USB 2.0 spec Table 11-13
- */
-
-#define USB_DT_HUB (USB_TYPE_CLASS | 0x09)
-#define USB_DT_SS_HUB (USB_TYPE_CLASS | 0x0a)
-#define USB_DT_HUB_NONVAR_SIZE 7
-#define USB_DT_SS_HUB_SIZE 12
-
-/*
- * Hub Device descriptor
- * USB Hub class device protocols
- */
-
-#define USB_HUB_PR_FS 0 /* Full speed hub */
-#define USB_HUB_PR_HS_NO_TT 0 /* Hi-speed hub without TT */
-#define USB_HUB_PR_HS_SINGLE_TT 1 /* Hi-speed hub with single TT */
-#define USB_HUB_PR_HS_MULTI_TT 2 /* Hi-speed hub with multiple TT */
-#define USB_HUB_PR_SS 3 /* Super speed hub */
-
-struct usb_hub_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bNbrPorts;
- __le16 wHubCharacteristics;
- __u8 bPwrOn2PwrGood;
- __u8 bHubContrCurrent;
-
- /* 2.0 and 3.0 hubs differ here */
- union {
- struct {
- /* add 1 bit for hub status change; round to bytes */
- __u8 DeviceRemovable[(USB_MAXCHILDREN + 1 + 7) / 8];
- __u8 PortPwrCtrlMask[(USB_MAXCHILDREN + 1 + 7) / 8];
- } __attribute__ ((packed)) hs;
-
- struct {
- __u8 bHubHdrDecLat;
- __le16 wHubDelay;
- __le16 DeviceRemovable;
- } __attribute__ ((packed)) ss;
- } u;
-} __attribute__ ((packed));
-
-/* port indicator status selectors, tables 11-7 and 11-25 */
-#define HUB_LED_AUTO 0
-#define HUB_LED_AMBER 1
-#define HUB_LED_GREEN 2
-#define HUB_LED_OFF 3
-
-enum hub_led_mode {
- INDICATOR_AUTO = 0,
- INDICATOR_CYCLE,
- /* software blinks for attention: software, hardware, reserved */
- INDICATOR_GREEN_BLINK, INDICATOR_GREEN_BLINK_OFF,
- INDICATOR_AMBER_BLINK, INDICATOR_AMBER_BLINK_OFF,
- INDICATOR_ALT_BLINK, INDICATOR_ALT_BLINK_OFF
-} __attribute__ ((packed));
-
-/* Transaction Translator Think Times, in bits */
-#define HUB_TTTT_8_BITS 0x00
-#define HUB_TTTT_16_BITS 0x20
-#define HUB_TTTT_24_BITS 0x40
-#define HUB_TTTT_32_BITS 0x60
-
-#endif /* __LINUX_CH11_H */
diff --git a/include/usb/ch9.h b/include/usb/ch9.h
deleted file mode 100644
index 4c1e765326..0000000000
--- a/include/usb/ch9.h
+++ /dev/null
@@ -1,1047 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/*
- * This file holds USB constants and structures that are needed for
- * USB device APIs. These are used by the USB device model, which is
- * defined in chapter 9 of the USB 2.0 specification and in the
- * Wireless USB 1.0 (spread around). Linux has several APIs in C that
- * need these:
- *
- * - the master/host side Linux-USB kernel driver API;
- * - the "usbfs" user space API; and
- * - the Linux "gadget" slave/device/peripheral side driver API.
- *
- * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
- * act either as a USB master/host or as a USB slave/device. That means
- * the master and slave side APIs benefit from working well together.
- *
- * There's also "Wireless USB", using low power short range radios for
- * peripheral interconnection but otherwise building on the USB framework.
- *
- * Note all descriptors are declared '__attribute__((packed))' so that:
- *
- * [a] they never get padded, either internally (USB spec writers
- * probably handled that) or externally;
- *
- * [b] so that accessing bigger-than-a-bytes fields will never
- * generate bus errors on any platform, even when the location of
- * its descriptor inside a bundle isn't "naturally aligned", and
- *
- * [c] for consistency, removing all doubt even when it appears to
- * someone that the two other points are non-issues for that
- * particular descriptor type.
- */
-
-#ifndef _UAPI__LINUX_USB_CH9_H
-#define _UAPI__LINUX_USB_CH9_H
-
-#include <linux/types.h> /* __u8 etc */
-#include <asm/byteorder.h> /* le16_to_cpu */
-
-/*-------------------------------------------------------------------------*/
-
-/* CONTROL REQUEST SUPPORT */
-
-/*
- * USB directions
- *
- * This bit flag is used in endpoint descriptors' bEndpointAddress field.
- * It's also one of three fields in control requests bRequestType.
- */
-#define USB_DIR_OUT 0 /* to device */
-#define USB_DIR_IN 0x80 /* to host */
-
-/*
- * USB types, the second of three bRequestType fields
- */
-#define USB_TYPE_MASK (0x03 << 5)
-#define USB_TYPE_STANDARD (0x00 << 5)
-#define USB_TYPE_CLASS (0x01 << 5)
-#define USB_TYPE_VENDOR (0x02 << 5)
-#define USB_TYPE_RESERVED (0x03 << 5)
-
-/*
- * USB recipients, the third of three bRequestType fields
- */
-#define USB_RECIP_MASK 0x1f
-#define USB_RECIP_DEVICE 0x00
-#define USB_RECIP_INTERFACE 0x01
-#define USB_RECIP_ENDPOINT 0x02
-#define USB_RECIP_OTHER 0x03
-/* From Wireless USB 1.0 */
-#define USB_RECIP_PORT 0x04
-#define USB_RECIP_RPIPE 0x05
-
-/*
- * Standard requests, for the bRequest field of a SETUP packet.
- *
- * These are qualified by the bRequestType field, so that for example
- * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
- * by a GET_STATUS request.
- */
-#define USB_REQ_GET_STATUS 0x00
-#define USB_REQ_CLEAR_FEATURE 0x01
-#define USB_REQ_SET_FEATURE 0x03
-#define USB_REQ_SET_ADDRESS 0x05
-#define USB_REQ_GET_DESCRIPTOR 0x06
-#define USB_REQ_SET_DESCRIPTOR 0x07
-#define USB_REQ_GET_CONFIGURATION 0x08
-#define USB_REQ_SET_CONFIGURATION 0x09
-#define USB_REQ_GET_INTERFACE 0x0A
-#define USB_REQ_SET_INTERFACE 0x0B
-#define USB_REQ_SYNCH_FRAME 0x0C
-#define USB_REQ_SET_SEL 0x30
-#define USB_REQ_SET_ISOCH_DELAY 0x31
-
-#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
-#define USB_REQ_GET_ENCRYPTION 0x0E
-#define USB_REQ_RPIPE_ABORT 0x0E
-#define USB_REQ_SET_HANDSHAKE 0x0F
-#define USB_REQ_RPIPE_RESET 0x0F
-#define USB_REQ_GET_HANDSHAKE 0x10
-#define USB_REQ_SET_CONNECTION 0x11
-#define USB_REQ_SET_SECURITY_DATA 0x12
-#define USB_REQ_GET_SECURITY_DATA 0x13
-#define USB_REQ_SET_WUSB_DATA 0x14
-#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
-#define USB_REQ_LOOPBACK_DATA_READ 0x16
-#define USB_REQ_SET_INTERFACE_DS 0x17
-
-/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
- * used by hubs to put ports into a new L1 suspend state, except that it
- * forgot to define its number ...
- */
-
-/*
- * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
- * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
- * are at most sixteen features of each type.) Hubs may also support a
- * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
- */
-#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
-#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
-#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
-#define USB_DEVICE_BATTERY 2 /* (wireless) */
-#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
-#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
-#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
-#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
-#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
-
-/*
- * Test Mode Selectors
- * See USB 2.0 spec Table 9-7
- */
-#define TEST_J 1
-#define TEST_K 2
-#define TEST_SE0_NAK 3
-#define TEST_PACKET 4
-#define TEST_FORCE_EN 5
-
-/*
- * New Feature Selectors as added by USB 3.0
- * See USB 3.0 spec Table 9-7
- */
-#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
-#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
-#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
-#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
-
-#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
-/*
- * Suspend Options, Table 9-8 USB 3.0 spec
- */
-#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
-#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
-
-/*
- * Interface status, Figure 9-5 USB 3.0 spec
- */
-#define USB_INTRF_STAT_FUNC_RW_CAP 1
-#define USB_INTRF_STAT_FUNC_RW 2
-
-#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
-
-/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
-#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
-#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
-#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
-
-/**
- * struct usb_ctrlrequest - SETUP data for a USB device control request
- * @bRequestType: matches the USB bmRequestType field
- * @bRequest: matches the USB bRequest field
- * @wValue: matches the USB wValue field (le16 byte order)
- * @wIndex: matches the USB wIndex field (le16 byte order)
- * @wLength: matches the USB wLength field (le16 byte order)
- *
- * This structure is used to send control requests to a USB device. It matches
- * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
- * USB spec for a fuller description of the different fields, and what they are
- * used for.
- *
- * Note that the driver for any interface can issue control requests.
- * For most devices, interfaces don't coordinate with each other, so
- * such requests may be made at any time.
- */
-struct usb_ctrlrequest {
- __u8 bRequestType;
- __u8 bRequest;
- __le16 wValue;
- __le16 wIndex;
- __le16 wLength;
-} __attribute__ ((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
- * (rarely) accepted by SET_DESCRIPTOR.
- *
- * Note that all multi-byte values here are encoded in little endian
- * byte order "on the wire". Within the kernel and when exposed
- * through the Linux-USB APIs, they are not converted to cpu byte
- * order; it is the responsibility of the client code to do this.
- * The single exception is when device and configuration descriptors (but
- * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
- * in this case the fields are converted to host endianness by the kernel.
- */
-
-/*
- * Descriptor types ... USB 2.0 spec table 9.5
- */
-#define USB_DT_DEVICE 0x01
-#define USB_DT_CONFIG 0x02
-#define USB_DT_STRING 0x03
-#define USB_DT_INTERFACE 0x04
-#define USB_DT_ENDPOINT 0x05
-#define USB_DT_DEVICE_QUALIFIER 0x06
-#define USB_DT_OTHER_SPEED_CONFIG 0x07
-#define USB_DT_INTERFACE_POWER 0x08
-/* these are from a minor usb 2.0 revision (ECN) */
-#define USB_DT_OTG 0x09
-#define USB_DT_DEBUG 0x0a
-#define USB_DT_INTERFACE_ASSOCIATION 0x0b
-/* these are from the Wireless USB spec */
-#define USB_DT_SECURITY 0x0c
-#define USB_DT_KEY 0x0d
-#define USB_DT_ENCRYPTION_TYPE 0x0e
-#define USB_DT_BOS 0x0f
-#define USB_DT_DEVICE_CAPABILITY 0x10
-#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
-#define USB_DT_WIRE_ADAPTER 0x21
-#define USB_DT_RPIPE 0x22
-#define USB_DT_CS_RADIO_CONTROL 0x23
-/* From the T10 UAS specification */
-#define USB_DT_PIPE_USAGE 0x24
-/* From the USB 3.0 spec */
-#define USB_DT_SS_ENDPOINT_COMP 0x30
-/* From the USB 3.1 spec */
-#define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31
-
-/* Conventional codes for class-specific descriptors. The convention is
- * defined in the USB "Common Class" Spec (3.11). Individual class specs
- * are authoritative for their usage, not the "common class" writeup.
- */
-#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
-#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
-#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
-#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
-#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
-
-/* All standard descriptors have these 2 fields at the beginning */
-struct usb_descriptor_header {
- __u8 bLength;
- __u8 bDescriptorType;
-} __attribute__ ((packed));
-
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_DEVICE: Device descriptor */
-struct usb_device_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 bcdUSB;
- __u8 bDeviceClass;
- __u8 bDeviceSubClass;
- __u8 bDeviceProtocol;
- __u8 bMaxPacketSize0;
- __le16 idVendor;
- __le16 idProduct;
- __le16 bcdDevice;
- __u8 iManufacturer;
- __u8 iProduct;
- __u8 iSerialNumber;
- __u8 bNumConfigurations;
-} __attribute__ ((packed));
-
-#define USB_DT_DEVICE_SIZE 18
-
-
-/*
- * Device and/or Interface Class codes
- * as found in bDeviceClass or bInterfaceClass
- * and defined by www.usb.org documents
- */
-#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
-#define USB_CLASS_AUDIO 1
-#define USB_CLASS_COMM 2
-#define USB_CLASS_HID 3
-#define USB_CLASS_PHYSICAL 5
-#define USB_CLASS_STILL_IMAGE 6
-#define USB_CLASS_PRINTER 7
-#define USB_CLASS_MASS_STORAGE 8
-#define USB_CLASS_HUB 9
-#define USB_CLASS_CDC_DATA 0x0a
-#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
-#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
-#define USB_CLASS_VIDEO 0x0e
-#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
-#define USB_CLASS_MISC 0xef
-#define USB_CLASS_APP_SPEC 0xfe
-#define USB_CLASS_VENDOR_SPEC 0xff
-
-#define USB_SUBCLASS_VENDOR_SPEC 0xff
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_CONFIG: Configuration descriptor information.
- *
- * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
- * descriptor type is different. Highspeed-capable devices can look
- * different depending on what speed they're currently running. Only
- * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
- * descriptors.
- */
-struct usb_config_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 wTotalLength;
- __u8 bNumInterfaces;
- __u8 bConfigurationValue;
- __u8 iConfiguration;
- __u8 bmAttributes;
- __u8 bMaxPower;
-} __attribute__ ((packed));
-
-#define USB_DT_CONFIG_SIZE 9
-
-/* from config descriptor bmAttributes */
-#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
-#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
-#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
-#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_STRING: String descriptor */
-struct usb_string_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 wData[1]; /* UTF-16LE encoded */
-} __attribute__ ((packed));
-
-/* note that "string" zero is special, it holds language codes that
- * the device supports, not Unicode characters.
- */
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_INTERFACE: Interface descriptor */
-struct usb_interface_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bInterfaceNumber;
- __u8 bAlternateSetting;
- __u8 bNumEndpoints;
- __u8 bInterfaceClass;
- __u8 bInterfaceSubClass;
- __u8 bInterfaceProtocol;
- __u8 iInterface;
-} __attribute__ ((packed));
-
-#define USB_DT_INTERFACE_SIZE 9
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_ENDPOINT: Endpoint descriptor */
-struct usb_endpoint_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bEndpointAddress;
- __u8 bmAttributes;
- __le16 wMaxPacketSize;
- __u8 bInterval;
-
- /* NOTE: these two are _only_ in audio endpoints. */
- /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
- __u8 bRefresh;
- __u8 bSynchAddress;
-} __attribute__ ((packed));
-
-#define USB_DT_ENDPOINT_SIZE 7
-#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
-
-
-/*
- * Endpoints
- */
-#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
-#define USB_ENDPOINT_DIR_MASK 0x80
-
-#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
-#define USB_ENDPOINT_XFER_CONTROL 0
-#define USB_ENDPOINT_XFER_ISOC 1
-#define USB_ENDPOINT_XFER_BULK 2
-#define USB_ENDPOINT_XFER_INT 3
-#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
-
-#define USB_ENDPOINT_MAXP_MASK 0x07ff
-#define USB_EP_MAXP_MULT_SHIFT 11
-#define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT)
-#define USB_EP_MAXP_MULT(m) \
- (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT)
-
-/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
-#define USB_ENDPOINT_INTRTYPE 0x30
-#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
-#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
-
-#define USB_ENDPOINT_SYNCTYPE 0x0c
-#define USB_ENDPOINT_SYNC_NONE (0 << 2)
-#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
-#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
-#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
-
-#define USB_ENDPOINT_USAGE_MASK 0x30
-#define USB_ENDPOINT_USAGE_DATA 0x00
-#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
-#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
-
-/*-------------------------------------------------------------------------*/
-
-/**
- * usb_endpoint_num - get the endpoint's number
- * @epd: endpoint to be checked
- *
- * Returns @epd's number: 0 to 15.
- */
-static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
-{
- return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
-}
-
-/**
- * usb_endpoint_type - get the endpoint's transfer type
- * @epd: endpoint to be checked
- *
- * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
- * to @epd's transfer type.
- */
-static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
-{
- return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
-}
-
-/**
- * usb_endpoint_dir_in - check if the endpoint has IN direction
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type IN, otherwise it returns false.
- */
-static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
-}
-
-/**
- * usb_endpoint_dir_out - check if the endpoint has OUT direction
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type OUT, otherwise it returns false.
- */
-static inline int usb_endpoint_dir_out(
- const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
-}
-
-/**
- * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type bulk, otherwise it returns false.
- */
-static inline int usb_endpoint_xfer_bulk(
- const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_BULK);
-}
-
-/**
- * usb_endpoint_xfer_control - check if the endpoint has control transfer type
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type control, otherwise it returns false.
- */
-static inline int usb_endpoint_xfer_control(
- const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_CONTROL);
-}
-
-/**
- * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type interrupt, otherwise it returns
- * false.
- */
-static inline int usb_endpoint_xfer_int(
- const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_INT);
-}
-
-/**
- * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint is of type isochronous, otherwise it returns
- * false.
- */
-static inline int usb_endpoint_xfer_isoc(
- const struct usb_endpoint_descriptor *epd)
-{
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
- USB_ENDPOINT_XFER_ISOC);
-}
-
-/**
- * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has bulk transfer type and IN direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_bulk_in(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
-}
-
-/**
- * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has bulk transfer type and OUT direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_bulk_out(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
-}
-
-/**
- * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has interrupt transfer type and IN direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_int_in(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
-}
-
-/**
- * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has interrupt transfer type and OUT direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_int_out(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
-}
-
-/**
- * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has isochronous transfer type and IN direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_isoc_in(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
-}
-
-/**
- * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
- * @epd: endpoint to be checked
- *
- * Returns true if the endpoint has isochronous transfer type and OUT direction,
- * otherwise it returns false.
- */
-static inline int usb_endpoint_is_isoc_out(
- const struct usb_endpoint_descriptor *epd)
-{
- return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
-}
-
-/**
- * usb_endpoint_maxp - get endpoint's max packet size
- * @epd: endpoint to be checked
- *
- * Returns @epd's max packet
- */
-static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
-{
- return __le16_to_cpu(epd->wMaxPacketSize);
-}
-
-/**
- * usb_endpoint_maxp_mult - get endpoint's transactional opportunities
- * @epd: endpoint to be checked
- *
- * Return @epd's wMaxPacketSize[12:11] + 1
- */
-static inline int
-usb_endpoint_maxp_mult(const struct usb_endpoint_descriptor *epd)
-{
- int maxp = __le16_to_cpu(epd->wMaxPacketSize);
-
- return USB_EP_MAXP_MULT(maxp) + 1;
-}
-
-static inline int usb_endpoint_interrupt_type(
- const struct usb_endpoint_descriptor *epd)
-{
- return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
-}
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
-struct usb_ss_ep_comp_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bMaxBurst;
- __u8 bmAttributes;
- __le16 wBytesPerInterval;
-} __attribute__ ((packed));
-
-#define USB_DT_SS_EP_COMP_SIZE 6
-
-/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
-static inline int
-usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
-{
- int max_streams;
-
- if (!comp)
- return 0;
-
- max_streams = comp->bmAttributes & 0x1f;
-
- if (!max_streams)
- return 0;
-
- max_streams = 1 << max_streams;
-
- return max_streams;
-}
-
-/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
-#define USB_SS_MULT(p) (1 + ((p) & 0x3))
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
-struct usb_qualifier_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 bcdUSB;
- __u8 bDeviceClass;
- __u8 bDeviceSubClass;
- __u8 bDeviceProtocol;
- __u8 bMaxPacketSize0;
- __u8 bNumConfigurations;
- __u8 bRESERVED;
-} __attribute__ ((packed));
-
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_OTG (from OTG 1.0a supplement) */
-struct usb_otg_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bmAttributes; /* support for HNP, SRP, etc */
-} __attribute__ ((packed));
-
-/* from usb_otg_descriptor.bmAttributes */
-#define USB_OTG_SRP (1 << 0)
-#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
-struct usb_debug_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- /* bulk endpoints with 8 byte maxpacket */
- __u8 bDebugInEndpoint;
- __u8 bDebugOutEndpoint;
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
-struct usb_interface_assoc_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bFirstInterface;
- __u8 bInterfaceCount;
- __u8 bFunctionClass;
- __u8 bFunctionSubClass;
- __u8 bFunctionProtocol;
- __u8 iFunction;
-} __attribute__ ((packed));
-
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_SECURITY: group of wireless security descriptors, including
- * encryption types available for setting up a CC/association.
- */
-struct usb_security_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 wTotalLength;
- __u8 bNumEncryptionTypes;
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
- * may be retrieved.
- */
-struct usb_key_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 tTKID[3];
- __u8 bReserved;
- __u8 bKeyData[0];
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
-struct usb_encryption_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bEncryptionType;
-#define USB_ENC_TYPE_UNSECURE 0
-#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
-#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
-#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
- __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
- __u8 bAuthKeyIndex;
-} __attribute__((packed));
-
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_BOS: group of device-level capabilities */
-struct usb_bos_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __le16 wTotalLength;
- __u8 bNumDeviceCaps;
-} __attribute__((packed));
-
-#define USB_DT_BOS_SIZE 5
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
-struct usb_dev_cap_header {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDevCapabilityType;
-} __attribute__((packed));
-
-#define USB_CAP_TYPE_WIRELESS_USB 1
-
-struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDevCapabilityType;
-
- __u8 bmAttributes;
-#define USB_WIRELESS_P2P_DRD (1 << 1)
-#define USB_WIRELESS_BEACON_MASK (3 << 2)
-#define USB_WIRELESS_BEACON_SELF (1 << 2)
-#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
-#define USB_WIRELESS_BEACON_NONE (3 << 2)
- __le16 wPHYRates; /* bit rates, Mbps */
-#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
-#define USB_WIRELESS_PHY_80 (1 << 1)
-#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
-#define USB_WIRELESS_PHY_160 (1 << 3)
-#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
-#define USB_WIRELESS_PHY_320 (1 << 5)
-#define USB_WIRELESS_PHY_400 (1 << 6)
-#define USB_WIRELESS_PHY_480 (1 << 7)
- __u8 bmTFITXPowerInfo; /* TFI power levels */
- __u8 bmFFITXPowerInfo; /* FFI power levels */
- __le16 bmBandGroup;
- __u8 bReserved;
-} __attribute__((packed));
-
-/* USB 2.0 Extension descriptor */
-#define USB_CAP_TYPE_EXT 2
-
-struct usb_ext_cap_descriptor { /* Link Power Management */
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDevCapabilityType;
- __le32 bmAttributes;
-#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
-#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
-#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
-#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
-#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
-#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
-} __attribute__((packed));
-
-#define USB_DT_USB_EXT_CAP_SIZE 7
-
-/*
- * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
- * specific device level capabilities
- */
-#define USB_SS_CAP_TYPE 3
-struct usb_ss_cap_descriptor { /* Link Power Management */
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDevCapabilityType;
- __u8 bmAttributes;
-#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
- __le16 wSpeedSupported;
-#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
-#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
-#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
-#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
- __u8 bFunctionalitySupport;
- __u8 bU1devExitLat;
- __le16 bU2DevExitLat;
-} __attribute__((packed));
-
-#define USB_DT_USB_SS_CAP_SIZE 10
-
-/*
- * Container ID Capability descriptor: Defines the instance unique ID used to
- * identify the instance across all operating modes
- */
-#define CONTAINER_ID_TYPE 4
-struct usb_ss_container_id_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
- __u8 bDevCapabilityType;
- __u8 bReserved;
- __u8 ContainerID[16]; /* 128-bit number */
-} __attribute__((packed));
-
-#define USB_DT_USB_SS_CONTN_ID_SIZE 20
-/*-------------------------------------------------------------------------*/
-
-/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
- * each endpoint descriptor for a wireless device
- */
-struct usb_wireless_ep_comp_descriptor {
- __u8 bLength;
- __u8 bDescriptorType;
-
- __u8 bMaxBurst;
- __u8 bMaxSequence;
- __le16 wMaxStreamDelay;
- __le16 wOverTheAirPacketSize;
- __u8 bOverTheAirInterval;
- __u8 bmCompAttributes;
-#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
-#define USB_ENDPOINT_SWITCH_NO 0
-#define USB_ENDPOINT_SWITCH_SWITCH 1
-#define USB_ENDPOINT_SWITCH_SCALE 2
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
- * host and a device for connection set up, mutual authentication, and
- * exchanging short lived session keys. The handshake depends on a CC.
- */
-struct usb_handshake {
- __u8 bMessageNumber;
- __u8 bStatus;
- __u8 tTKID[3];
- __u8 bReserved;
- __u8 CDID[16];
- __u8 nonce[16];
- __u8 MIC[8];
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
- * A CC may also be set up using non-wireless secure channels (including
- * wired USB!), and some devices may support CCs with multiple hosts.
- */
-struct usb_connection_context {
- __u8 CHID[16]; /* persistent host id */
- __u8 CDID[16]; /* device id (unique w/in host context) */
- __u8 CK[16]; /* connection key */
-} __attribute__((packed));
-
-/*-------------------------------------------------------------------------*/
-
-/* USB 2.0 defines three speeds, here's how Linux identifies them */
-
-enum usb_device_speed {
- USB_SPEED_UNKNOWN = 0, /* enumerating */
- USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
- USB_SPEED_HIGH, /* usb 2.0 */
- USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
- USB_SPEED_SUPER, /* usb 3.0 */
- USB_SPEED_SUPER_PLUS, /* usb 3.1 */
-};
-
-
-enum usb_device_state {
- /* NOTATTACHED isn't in the USB spec, and this state acts
- * the same as ATTACHED ... but it's clearer this way.
- */
- USB_STATE_NOTATTACHED = 0,
-
- /* chapter 9 and authentication (wireless) device states */
- USB_STATE_ATTACHED,
- USB_STATE_POWERED, /* wired */
- USB_STATE_RECONNECTING, /* auth */
- USB_STATE_UNAUTHENTICATED, /* auth */
- USB_STATE_DEFAULT, /* limited function */
- USB_STATE_ADDRESS,
- USB_STATE_CONFIGURED, /* most functions */
-
- USB_STATE_SUSPENDED
-
- /* NOTE: there are actually four different SUSPENDED
- * states, returning to POWERED, DEFAULT, ADDRESS, or
- * CONFIGURED respectively when SOF tokens flow again.
- * At this level there's no difference between L1 and L2
- * suspend states. (L2 being original USB 1.1 suspend.)
- */
-};
-
-enum usb3_link_state {
- USB3_LPM_U0 = 0,
- USB3_LPM_U1,
- USB3_LPM_U2,
- USB3_LPM_U3
-};
-
-/*
- * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
- * 0xff means the parent hub will accept transitions to U1, but will not
- * initiate a transition.
- *
- * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
- * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
- * values.
- *
- * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
- * 0xff means the parent hub will accept transitions to U2, but will not
- * initiate a transition.
- *
- * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
- * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
- * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
- * 65.024ms.
- */
-#define USB3_LPM_DISABLED 0x0
-#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
-#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
-#define USB3_LPM_DEVICE_INITIATED 0xFF
-
-struct usb_set_sel_req {
- __u8 u1_sel;
- __u8 u1_pel;
- __le16 u2_sel;
- __le16 u2_pel;
-} __attribute__ ((packed));
-
-/*
- * The Set System Exit Latency control transfer provides one byte each for
- * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
- * are two bytes long.
- */
-#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
-#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
-
-/*-------------------------------------------------------------------------*/
-
-/*
- * As per USB compliance update, a device that is actively drawing
- * more than 100mA from USB must report itself as bus-powered in
- * the GetStatus(DEVICE) call.
- * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
- */
-#define USB_SELF_POWER_VBUS_MAX_DRAW 100
-
-/**
- * usb_speed_string() - Returns human readable-name of the speed.
- * @speed: The speed to return human-readable name for. If it's not
- * any of the speeds defined in usb_device_speed enum, string for
- * USB_SPEED_UNKNOWN will be returned.
- */
-const char *usb_speed_string(enum usb_device_speed speed);
-
-/**
- * usb_speed_by_string() - Get speed from human readable name.
- * @string: The human readable name for the speed. If it is not one of known
- * names, USB_SPEED_UNKNOWN will be returned.
- */
-enum usb_device_speed usb_speed_by_string(const char *string);
-
-/**
- * usb_state_string - Returns human readable name for the state.
- * @state: The state to return a human-readable name for. If it's not
- * any of the states devices in usb_device_state_string enum,
- * the string UNKNOWN will be returned.
- */
-const char *usb_state_string(enum usb_device_state state);
-
-#endif /* _UAPI__LINUX_USB_CH9_H */
diff --git a/include/usb/chipidea-imx.h b/include/usb/chipidea-imx.h
deleted file mode 100644
index b0b75d3bcb..0000000000
--- a/include/usb/chipidea-imx.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __USB_CHIPIDEA_IMX_H
-#define __USB_CHIPIDEA_IMX_H
-
-#include <usb/phy.h>
-
-/*
- * POTSC flags
- */
-#define MXC_EHCI_SERIAL (1 << 29)
-#define MXC_EHCI_MODE_UTMI_8BIT (0 << 30)
-#define MXC_EHCI_MODE_UTMI_16_BIT ((0 << 30) | (1 << 28))
-#define MXC_EHCI_MODE_PHILIPS (1 << 30)
-#define MXC_EHCI_MODE_ULPI (2 << 30)
-#define MXC_EHCI_MODE_HSIC (1 << 25)
-#define MXC_EHCI_MODE_SERIAL (3 << 30)
-#define MXC_EHCI_PFSC (1 << 24)
-
-/*
- * USB misc flags
- */
-#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
-#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
-#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
-#define MXC_EHCI_INTERFACE_MASK (0xf)
-
-#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
-#define MXC_EHCI_PWR_PIN_ACTIVE_HIGH (1 << 6)
-#define MXC_EHCI_OC_PIN_ACTIVE_LOW (1 << 7)
-#define MXC_EHCI_TLL_ENABLED (1 << 8)
-
-#define MXC_EHCI_INTERNAL_PHY (1 << 9)
-#define MXC_EHCI_IPPUE_DOWN (1 << 10)
-#define MXC_EHCI_IPPUE_UP (1 << 11)
-#define MXC_EHCI_WAKEUP_ENABLED (1 << 12)
-#define MXC_EHCI_ITC_NO_THRESHOLD (1 << 13)
-
-#define MXC_EHCI_DISABLE_OVERCURRENT (1 << 14)
-
-struct imxusb_platformdata {
- unsigned long flags;
- enum usb_phy_interface phymode;
- enum usb_dr_mode mode;
-};
-
-#ifdef CONFIG_USB_IMX_CHIPIDEA_USBMISC
-int imx_usbmisc_port_init(struct device *dev, int port, unsigned flags);
-int imx_usbmisc_port_post_init(struct device *dev, int port, unsigned flags);
-#else
-static inline int imx_usbmisc_port_init(struct device *dev, int port,
- unsigned flags)
-{
- return 0;
-}
-static inline int imx_usbmisc_port_post_init(struct device *dev, int port,
- unsigned flags)
-{
- return 0;
-}
-#endif
-
-#endif /* __USB_CHIPIDEA_IMX_H */
diff --git a/include/usb/composite.h b/include/usb/composite.h
deleted file mode 100644
index ec9abe7447..0000000000
--- a/include/usb/composite.h
+++ /dev/null
@@ -1,494 +0,0 @@
-/*
- * composite.h -- framework for usb gadgets which are composite devices
- *
- * Copyright (C) 2006-2008 David Brownell
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that 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 __LINUX_USB_COMPOSITE_H
-#define __LINUX_USB_COMPOSITE_H
-
-/*
- * This framework is an optional layer on top of the USB Gadget interface,
- * making it easier to build (a) Composite devices, supporting multiple
- * functions within any single configuration, and (b) Multi-configuration
- * devices, also supporting multiple functions but without necessarily
- * having more than one function per configuration.
- *
- * Example: a device with a single configuration supporting both network
- * link and mass storage functions is a composite device. Those functions
- * might alternatively be packaged in individual configurations, but in
- * the composite model the host can use both functions at the same time.
- */
-#include <init.h>
-#include <usb/ch9.h>
-#include <usb/gadget.h>
-#include <linux/log2.h>
-#include <linux/stringify.h>
-#include <linux/spinlock.h>
-
-/*
- * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
- * wish to delay the data/status stages of the control transfer till they
- * are ready. The control transfer will then be kept from completing till
- * all the function drivers that requested for USB_GADGET_DELAYED_STAUS
- * invoke usb_composite_setup_continue().
- */
-#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
-
-/* big enough to hold our biggest descriptor */
-#define USB_COMP_EP0_BUFSIZ 1024
-
-#define USB_MS_TO_HS_INTERVAL(x) (ilog2((x * 1000 / 125)) + 1)
-struct usb_configuration;
-
-/**
- * struct usb_function - describes one function of a configuration
- * @name: For diagnostics, identifies the function.
- * @strings: tables of strings, keyed by identifiers assigned during bind()
- * and by language IDs provided in control requests
- * @fs_descriptors: Table of full (or low) speed descriptors, using interface and
- * string identifiers assigned during @bind(). If this pointer is null,
- * the function will not be available at full speed (or at low speed).
- * @hs_descriptors: Table of high speed descriptors, using interface and
- * string identifiers assigned during @bind(). If this pointer is null,
- * the function will not be available at high speed.
- * @ss_descriptors: Table of super speed descriptors, using interface and
- * string identifiers assigned during @bind(). If this
- * pointer is null after initiation, the function will not
- * be available at super speed.
- * @config: assigned when @usb_add_function() is called; this is the
- * configuration with which this function is associated.
- * @bind: Before the gadget can register, all of its functions bind() to the
- * available resources including string and interface identifiers used
- * in interface or class descriptors; endpoints; I/O buffers; and so on.
- * @unbind: Reverses @bind; called as a side effect of unregistering the
- * driver which added this function.
- * @free_func: free the struct usb_function.
- * @mod: (internal) points to the module that created this structure.
- * @set_alt: (REQUIRED) Reconfigures altsettings; function drivers may
- * initialize usb_ep.driver data at this time (when it is used).
- * Note that setting an interface to its current altsetting resets
- * interface state, and that all interfaces have a disabled state.
- * @get_alt: Returns the active altsetting. If this is not provided,
- * then only altsetting zero is supported.
- * @disable: (REQUIRED) Indicates the function should be disabled. Reasons
- * include host resetting or reconfiguring the gadget, and disconnection.
- * @setup: Used for interface-specific control requests.
- * @suspend: Notifies functions when the host stops sending USB traffic.
- * @resume: Notifies functions when the host restarts USB traffic.
- * @get_status: Returns function status as a reply to
- * GetStatus() request when the recipient is Interface.
- * @func_suspend: callback to be called when
- * SetFeature(FUNCTION_SUSPEND) is reseived
- *
- * A single USB function uses one or more interfaces, and should in most
- * cases support operation at both full and high speeds. Each function is
- * associated by @usb_add_function() with a one configuration; that function
- * causes @bind() to be called so resources can be allocated as part of
- * setting up a gadget driver. Those resources include endpoints, which
- * should be allocated using @usb_ep_autoconfig().
- *
- * To support dual speed operation, a function driver provides descriptors
- * for both high and full speed operation. Except in rare cases that don't
- * involve bulk endpoints, each speed needs different endpoint descriptors.
- *
- * Function drivers choose their own strategies for managing instance data.
- * The simplest strategy just declares it "static', which means the function
- * can only be activated once. If the function needs to be exposed in more
- * than one configuration at a given speed, it needs to support multiple
- * usb_function structures (one for each configuration).
- *
- * A more complex strategy might encapsulate a @usb_function structure inside
- * a driver-specific instance structure to allows multiple activations. An
- * example of multiple activations might be a CDC ACM function that supports
- * two or more distinct instances within the same configuration, providing
- * several independent logical data links to a USB host.
- */
-
-struct usb_function {
- const char *name;
- struct usb_gadget_strings **strings;
- struct usb_descriptor_header **fs_descriptors;
- struct usb_descriptor_header **hs_descriptors;
- struct usb_descriptor_header **ss_descriptors;
-
- struct usb_configuration *config;
-
- /* REVISIT: bind() functions can be marked __init, which
- * makes trouble for section mismatch analysis. See if
- * we can't restructure things to avoid mismatching.
- * Related: unbind() may kfree() but bind() won't...
- */
-
- /* configuration management: bind/unbind */
- int (*bind)(struct usb_configuration *,
- struct usb_function *);
- void (*unbind)(struct usb_configuration *,
- struct usb_function *);
- void (*free_func)(struct usb_function *f);
- struct module *mod;
-
- /* runtime state management */
- int (*set_alt)(struct usb_function *,
- unsigned interface, unsigned alt);
- int (*get_alt)(struct usb_function *,
- unsigned interface);
- void (*disable)(struct usb_function *);
- int (*setup)(struct usb_function *,
- const struct usb_ctrlrequest *);
- void (*suspend)(struct usb_function *);
- void (*resume)(struct usb_function *);
-
- /* USB 3.0 additions */
- int (*get_status)(struct usb_function *);
- int (*func_suspend)(struct usb_function *,
- u8 suspend_opt);
- /* private: */
- /* internals */
- struct list_head list;
- DECLARE_BITMAP(endpoints, 32);
- const struct usb_function_instance *fi;
-};
-
-int usb_add_function(struct usb_configuration *, struct usb_function *);
-
-int usb_function_deactivate(struct usb_function *);
-int usb_function_activate(struct usb_function *);
-
-int usb_interface_id(struct usb_configuration *, struct usb_function *);
-
-int config_ep_by_speed(struct usb_gadget *g, struct usb_function *f,
- struct usb_ep *_ep);
-
-#define MAX_CONFIG_INTERFACES 16 /* arbitrary; max 255 */
-
-/**
- * struct usb_configuration - represents one gadget configuration
- * @label: For diagnostics, describes the configuration.
- * @strings: Tables of strings, keyed by identifiers assigned during @bind()
- * and by language IDs provided in control requests.
- * @descriptors: Table of descriptors preceding all function descriptors.
- * Examples include OTG and vendor-specific descriptors.
- * @unbind: Reverses @bind; called as a side effect of unregistering the
- * driver which added this configuration.
- * @setup: Used to delegate control requests that aren't handled by standard
- * device infrastructure or directed at a specific interface.
- * @bConfigurationValue: Copied into configuration descriptor.
- * @iConfiguration: Copied into configuration descriptor.
- * @bmAttributes: Copied into configuration descriptor.
- * @MaxPower: Power consumtion in mA. Used to compute bMaxPower in the
- * configuration descriptor after considering the bus speed.
- * @cdev: assigned by @usb_add_config() before calling @bind(); this is
- * the device associated with this configuration.
- *
- * Configurations are building blocks for gadget drivers structured around
- * function drivers. Simple USB gadgets require only one function and one
- * configuration, and handle dual-speed hardware by always providing the same
- * functionality. Slightly more complex gadgets may have more than one
- * single-function configuration at a given speed; or have configurations
- * that only work at one speed.
- *
- * Composite devices are, by definition, ones with configurations which
- * include more than one function.
- *
- * The lifecycle of a usb_configuration includes allocation, initialization
- * of the fields described above, and calling @usb_add_config() to set up
- * internal data and bind it to a specific device. The configuration's
- * @bind() method is then used to initialize all the functions and then
- * call @usb_add_function() for them.
- *
- * Those functions would normally be independent of each other, but that's
- * not mandatory. CDC WMC devices are an example where functions often
- * depend on other functions, with some functions subsidiary to others.
- * Such interdependency may be managed in any way, so long as all of the
- * descriptors complete by the time the composite driver returns from
- * its bind() routine.
- */
-struct usb_configuration {
- const char *label;
- struct usb_gadget_strings **strings;
- const struct usb_descriptor_header **descriptors;
-
- /* REVISIT: bind() functions can be marked __init, which
- * makes trouble for section mismatch analysis. See if
- * we can't restructure things to avoid mismatching...
- */
-
- /* configuration management: unbind/setup */
- void (*unbind)(struct usb_configuration *);
- int (*setup)(struct usb_configuration *,
- const struct usb_ctrlrequest *);
-
- /* fields in the config descriptor */
- u8 bConfigurationValue;
- u8 iConfiguration;
- u8 bmAttributes;
- u16 MaxPower;
-
- struct usb_composite_dev *cdev;
-
- /* private: */
- /* internals */
- struct list_head list;
- struct list_head functions;
- u8 next_interface_id;
- unsigned superspeed:1;
- unsigned highspeed:1;
- unsigned fullspeed:1;
- struct usb_function *interface[MAX_CONFIG_INTERFACES];
-};
-
-int usb_add_config(struct usb_composite_dev *,
- struct usb_configuration *,
- int (*)(struct usb_configuration *));
-
-void usb_remove_config(struct usb_composite_dev *,
- struct usb_configuration *);
-
-/* predefined index for usb_composite_driver */
-enum {
- USB_GADGET_MANUFACTURER_IDX = 0,
- USB_GADGET_PRODUCT_IDX,
- USB_GADGET_SERIAL_IDX,
- USB_GADGET_FIRST_AVAIL_IDX,
-};
-
-/**
- * struct usb_composite_driver - groups configurations into a gadget
- * @name: For diagnostics, identifies the driver.
- * @dev: Template descriptor for the device, including default device
- * identifiers.
- * @strings: tables of strings, keyed by identifiers assigned during @bind
- * and language IDs provided in control requests. Note: The first entries
- * are predefined. The first entry that may be used is
- * USB_GADGET_FIRST_AVAIL_IDX
- * @max_speed: Highest speed the driver supports.
- * @needs_serial: set to 1 if the gadget needs userspace to provide
- * a serial number. If one is not provided, warning will be printed.
- * @bind: (REQUIRED) Used to allocate resources that are shared across the
- * whole device, such as string IDs, and add its configurations using
- * @usb_add_config(). This may fail by returning a negative errno
- * value; it should return zero on successful initialization.
- * @unbind: Reverses @bind; called as a side effect of unregistering
- * this driver.
- * @disconnect: optional driver disconnect method
- * @suspend: Notifies when the host stops sending USB traffic,
- * after function notifications
- * @resume: Notifies configuration when the host restarts USB traffic,
- * before function notifications
- * @gadget_driver: Gadget driver controlling this driver
- *
- * Devices default to reporting self powered operation. Devices which rely
- * on bus powered operation should report this in their @bind method.
- *
- * Before returning from @bind, various fields in the template descriptor
- * may be overridden. These include the idVendor/idProduct/bcdDevice values
- * normally to bind the appropriate host side driver, and the three strings
- * (iManufacturer, iProduct, iSerialNumber) normally used to provide user
- * meaningful device identifiers. (The strings will not be defined unless
- * they are defined in @dev and @strings.) The correct ep0 maxpacket size
- * is also reported, as defined by the underlying controller driver.
- */
-struct usb_composite_driver {
- const char *name;
- const struct usb_device_descriptor *dev;
- struct usb_gadget_strings **strings;
- enum usb_device_speed max_speed;
- unsigned needs_serial:1;
-
- int (*bind)(struct usb_composite_dev *cdev);
- int (*unbind)(struct usb_composite_dev *);
-
- void (*disconnect)(struct usb_composite_dev *);
-
- /* global suspend hooks */
- void (*suspend)(struct usb_composite_dev *);
- void (*resume)(struct usb_composite_dev *);
- struct usb_gadget_driver gadget_driver;
-};
-
-extern int usb_composite_probe(struct usb_composite_driver *driver);
-extern void usb_composite_unregister(struct usb_composite_driver *driver);
-extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
-extern int composite_dev_prepare(struct usb_composite_driver *composite,
- struct usb_composite_dev *cdev);
-void composite_dev_cleanup(struct usb_composite_dev *cdev);
-
-static inline struct usb_composite_driver *to_cdriver(
- struct usb_gadget_driver *gdrv)
-{
- return container_of(gdrv, struct usb_composite_driver, gadget_driver);
-}
-
-/**
- * struct usb_composite_device - represents one composite usb gadget
- * @gadget: read-only, abstracts the gadget's usb peripheral controller
- * @req: used for control responses; buffer is pre-allocated
- * @config: the currently active configuration
- *
- * One of these devices is allocated and initialized before the
- * associated device driver's bind() is called.
- *
- * OPEN ISSUE: it appears that some WUSB devices will need to be
- * built by combining a normal (wired) gadget with a wireless one.
- * This revision of the gadget framework should probably try to make
- * sure doing that won't hurt too much.
- *
- * One notion for how to handle Wireless USB devices involves:
- * (a) a second gadget here, discovery mechanism TBD, but likely
- * needing separate "register/unregister WUSB gadget" calls;
- * (b) updates to usb_gadget to include flags "is it wireless",
- * "is it wired", plus (presumably in a wrapper structure)
- * bandgroup and PHY info;
- * (c) presumably a wireless_ep wrapping a usb_ep, and reporting
- * wireless-specific parameters like maxburst and maxsequence;
- * (d) configurations that are specific to wireless links;
- * (e) function drivers that understand wireless configs and will
- * support wireless for (additional) function instances;
- * (f) a function to support association setup (like CBAF), not
- * necessarily requiring a wireless adapter;
- * (g) composite device setup that can create one or more wireless
- * configs, including appropriate association setup support;
- * (h) more, TBD.
- */
-struct usb_composite_dev {
- struct usb_gadget *gadget;
- struct usb_request *req;
-
- struct usb_configuration *config;
-
- /* private: */
- /* internals */
- unsigned int suspended:1;
- struct usb_device_descriptor desc;
- struct list_head configs;
- struct list_head gstrings;
- struct usb_composite_driver *driver;
- u8 next_string_id;
- char *def_manufacturer;
-
- /* the gadget driver won't enable the data pullup
- * while the deactivation count is nonzero.
- */
- unsigned deactivations;
-
- /* the composite driver won't complete the control transfer's
- * data/status stages till delayed_status is zero.
- */
- int delayed_status;
-
- /* protects deactivations and delayed_status counts*/
- spinlock_t lock;
-
- int in_reset_config;
-
- /* public: */
- unsigned int setup_pending:1;
-};
-
-extern int usb_string_id(struct usb_composite_dev *c);
-extern int usb_string_ids_tab(struct usb_composite_dev *c,
- struct usb_string *str);
-extern struct usb_string *usb_gstrings_attach(struct usb_composite_dev *cdev,
- struct usb_gadget_strings **sp, unsigned n_strings);
-
-extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n);
-
-extern void composite_disconnect(struct usb_gadget *gadget);
-extern int composite_setup(struct usb_gadget *gadget,
- const struct usb_ctrlrequest *ctrl);
-
-/*
- * Some systems will need runtime overrides for the product identifiers
- * published in the device descriptor, either numbers or strings or both.
- * String parameters are in UTF-8 (superset of ASCII's 7 bit characters).
- */
-struct usb_composite_overwrite {
- u16 idVendor;
- u16 idProduct;
- u16 bcdDevice;
- char *serial_number;
- char *manufacturer;
- char *product;
-};
-
-void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
- struct usb_composite_overwrite *covr);
-
-static inline u16 get_default_bcdDevice(void)
-{
- /* The Kernel version the current USB code is based on */
- return 0x0316;
-}
-
-struct usb_function_driver {
- const char *name;
- struct module *mod;
- struct list_head list;
- struct usb_function_instance *(*alloc_inst)(void);
- struct usb_function *(*alloc_func)(struct usb_function_instance *inst);
-};
-
-struct usb_function_instance {
- struct list_head cfs_list;
- struct usb_function_driver *fd;
- int (*set_inst_name)(struct usb_function_instance *inst,
- const char *name);
- void (*free_func_inst)(struct usb_function_instance *inst);
-};
-
-void usb_function_unregister(struct usb_function_driver *f);
-int usb_function_register(struct usb_function_driver *newf);
-void usb_put_function_instance(struct usb_function_instance *fi);
-void usb_put_function(struct usb_function *f);
-struct usb_function_instance *usb_get_function_instance(const char *name);
-struct usb_function *usb_get_function(struct usb_function_instance *fi);
-
-struct usb_configuration *usb_get_config(struct usb_composite_dev *cdev,
- int val);
-int usb_add_config_only(struct usb_composite_dev *cdev,
- struct usb_configuration *config);
-void usb_remove_function(struct usb_configuration *c, struct usb_function *f);
-
-#define DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
- static struct usb_function_driver _name ## usb_func = { \
- .name = __stringify(_name), \
- .alloc_inst = _inst_alloc, \
- .alloc_func = _func_alloc, \
- };
-
-#define DECLARE_USB_FUNCTION_INIT(_name, _inst_alloc, _func_alloc) \
- DECLARE_USB_FUNCTION(_name, _inst_alloc, _func_alloc) \
- static int _name ## mod_init(void) \
- { \
- return usb_function_register(&_name ## usb_func); \
- } \
- device_initcall(_name ## mod_init)
-
-/* messaging utils */
-#define DBG(d, fmt, args...) \
- dev_dbg(&(d)->gadget->dev , fmt , ## args)
-#define VDBG(d, fmt, args...) \
- dev_vdbg(&(d)->gadget->dev , fmt , ## args)
-#define ERROR(d, fmt, args...) \
- dev_err(&(d)->gadget->dev , fmt , ## args)
-#define WARNING(d, fmt, args...) \
- dev_warn(&(d)->gadget->dev , fmt , ## args)
-#define INFO(d, fmt, args...) \
- dev_info(&(d)->gadget->dev , fmt , ## args)
-
-#endif /* __LINUX_USB_COMPOSITE_H */
diff --git a/include/usb/dfu.h b/include/usb/dfu.h
deleted file mode 100644
index 81425f7c62..0000000000
--- a/include/usb/dfu.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _USB_DFU_H
-#define _USB_DFU_H
-/* USB Device Firmware Update Implementation for OpenPCD
- * (C) 2006 by Harald Welte <hwelte@hmw-consulting.de>
- *
- * Protocol definitions for USB DFU
- *
- * This ought to be compliant to the USB DFU Spec 1.0 as available from
- * http://www.usb.org/developers/devclass_docs/usbdfu10.pdf
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that 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.
- *
- */
-
-#include <linux/types.h>
-#include <file-list.h>
-#include <usb/composite.h>
-
-struct f_dfu_opts {
- struct usb_function_instance func_inst;
- struct file_list *files;
-};
-
-int usb_dfu_detached(void);
-
-#endif /* _USB_DFU_H */
diff --git a/include/usb/ehci.h b/include/usb/ehci.h
deleted file mode 100644
index 9ce6c98ace..0000000000
--- a/include/usb/ehci.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __USB_EHCI_H
-#define __USB_EHCI_H
-
-#define EHCI_HAS_TT (1 << 0)
-
-struct ehci_platform_data {
- unsigned long flags;
-};
-
-struct ehci_data {
- void __iomem *hccr;
- void __iomem *hcor;
- unsigned long flags;
- struct usb_phy *usbphy;
-
- /* platform specific init functions */
- int (*init)(void *drvdata);
- int (*post_init)(void *drvdata);
- void *drvdata;
-};
-
-struct ehci_host;
-
-#ifdef CONFIG_USB_EHCI
-struct ehci_host *ehci_register(struct device *dev, struct ehci_data *data);
-void ehci_unregister(struct ehci_host *);
-#else
-static inline struct ehci_host *ehci_register(struct device *dev,
- struct ehci_data *data)
-{
- return ERR_PTR(-ENOSYS);
-}
-
-static inline void ehci_unregister(struct ehci_host *ehci)
-{
-}
-#endif
-
-#endif /* __USB_EHCI_H */
diff --git a/include/usb/fastboot.h b/include/usb/fastboot.h
deleted file mode 100644
index 7dc445455a..0000000000
--- a/include/usb/fastboot.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef _USB_FASTBOOT_H
-#define _USB_FASTBOOT_H
-
-#include <usb/composite.h>
-#include <fastboot.h>
-
-/**
- * struct f_fastboot_opts - options to configure the fastboot gadget
- * @common: Options common to all fastboot protocol variants
- * @func_inst: The USB function instance to register on
- */
-struct f_fastboot_opts {
- struct fastboot_opts common;
- struct usb_function_instance func_inst;
-};
-
-#endif /* _USB_FASTBOOT_H */
diff --git a/include/usb/fsl_usb2.h b/include/usb/fsl_usb2.h
deleted file mode 100644
index 1d5effb0d6..0000000000
--- a/include/usb/fsl_usb2.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __USB_FSL_USB2_H
-#define __USB_FSL_USB2_H
-
-enum fsl_usb2_operating_modes {
- FSL_USB2_MPH_HOST,
- FSL_USB2_DR_HOST,
- FSL_USB2_DR_DEVICE,
- FSL_USB2_DR_OTG,
-};
-
-enum fsl_usb2_phy_modes {
- FSL_USB2_PHY_NONE,
- FSL_USB2_PHY_ULPI,
- FSL_USB2_PHY_UTMI,
- FSL_USB2_PHY_UTMI_WIDE,
- FSL_USB2_PHY_SERIAL,
-};
-
-struct fsl_usb2_platform_data {
- /* board specific information */
- enum fsl_usb2_operating_modes operating_mode;
- enum fsl_usb2_phy_modes phy_mode;
- unsigned int port_enables;
-};
-
-struct fsl_udc;
-
-struct fsl_udc *ci_udc_register(struct device *dev, void __iomem *regs);
-void ci_udc_unregister(struct fsl_udc *);
-
-#endif /* __USB_FSL_USB2_H */
diff --git a/include/usb/gadget-multi.h b/include/usb/gadget-multi.h
deleted file mode 100644
index e67ca165c1..0000000000
--- a/include/usb/gadget-multi.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __USB_GADGET_MULTI_H
-#define __USB_GADGET_MULTI_H
-
-#include <linux/types.h>
-#include <usb/fastboot.h>
-#include <usb/dfu.h>
-#include <usb/usbserial.h>
-#include <usb/mass_storage.h>
-
-struct f_multi_opts {
- struct fastboot_opts fastboot_opts;
- struct f_dfu_opts dfu_opts;
- struct f_ums_opts ums_opts;
- bool create_acm;
- void (*release)(struct f_multi_opts *opts);
-};
-
-int usb_multi_register(struct f_multi_opts *opts);
-void usb_multi_unregister(void);
-void usb_multi_opts_release(struct f_multi_opts *opts);
-unsigned usb_multi_count_functions(struct f_multi_opts *opts);
-
-#define USBGADGET_EXPORT_BBU (1 << 0)
-#define USBGADGET_ACM (1 << 1)
-#define USBGADGET_DFU (1 << 2)
-#define USBGADGET_FASTBOOT (1 << 3)
-#define USBGADGET_MASS_STORAGE (1 << 4)
-
-struct usbgadget_funcs {
- int flags;
- const char *fastboot_opts;
- const char *dfu_opts;
- const char *ums_opts;
-};
-
-int usbgadget_register(const struct usbgadget_funcs *funcs);
-
-void usbgadget_autostart(bool enable);
-
-#endif /* __USB_GADGET_MULTI_H */
diff --git a/include/usb/gadget.h b/include/usb/gadget.h
deleted file mode 100644
index 830e3dfe83..0000000000
--- a/include/usb/gadget.h
+++ /dev/null
@@ -1,1030 +0,0 @@
-/*
- * <linux/usb/gadget.h>
- *
- * We call the USB code inside a Linux-based peripheral device a "gadget"
- * driver, except for the hardware-specific bus glue. One USB host can
- * master many USB gadgets, but the gadgets are only slaved to one host.
- *
- *
- * (C) Copyright 2002-2004 by David Brownell
- * All Rights Reserved.
- *
- * This software is licensed under the GNU GPL version 2.
- */
-
-#ifndef __LINUX_USB_GADGET_H
-#define __LINUX_USB_GADGET_H
-
-#include <common.h>
-#include <malloc.h>
-#include <driver.h>
-#include <linux/list.h>
-#include <usb/ch9.h>
-
-struct usb_ep;
-
-/**
- * struct usb_request - describes one i/o request
- * @buf: Buffer used for data. Always provide this; some controllers
- * only use PIO, or don't use DMA for some endpoints.
- * @dma: DMA address corresponding to 'buf'. If you don't set this
- * field, and the usb controller needs one, it is responsible
- * for mapping and unmapping the buffer.
- * @sg: a scatterlist for SG-capable controllers.
- * @num_sgs: number of SG entries
- * @num_mapped_sgs: number of SG entries mapped to DMA (internal)
- * @length: Length of that data
- * @stream_id: The stream id, when USB3.0 bulk streams are being used
- * @no_interrupt: If true, hints that no completion irq is needed.
- * Helpful sometimes with deep request queues that are handled
- * directly by DMA controllers.
- * @zero: If true, when writing data, makes the last packet be "short"
- * by adding a zero length packet as needed;
- * @short_not_ok: When reading data, makes short packets be
- * treated as errors (queue stops advancing till cleanup).
- * @complete: Function called when request completes, so this request and
- * its buffer may be re-used. The function will always be called with
- * interrupts disabled, and it must not sleep.
- * Reads terminate with a short packet, or when the buffer fills,
- * whichever comes first. When writes terminate, some data bytes
- * will usually still be in flight (often in a hardware fifo).
- * Errors (for reads or writes) stop the queue from advancing
- * until the completion function returns, so that any transfers
- * invalidated by the error may first be dequeued.
- * @context: For use by the completion callback
- * @list: For use by the gadget driver.
- * @status: Reports completion code, zero or a negative errno.
- * Normally, faults block the transfer queue from advancing until
- * the completion callback returns.
- * Code "-ESHUTDOWN" indicates completion caused by device disconnect,
- * or when the driver disabled the endpoint.
- * @actual: Reports bytes transferred to/from the buffer. For reads (OUT
- * transfers) this may be less than the requested length. If the
- * short_not_ok flag is set, short reads are treated as errors
- * even when status otherwise indicates successful completion.
- * Note that for writes (IN transfers) some data bytes may still
- * reside in a device-side FIFO when the request is reported as
- * complete.
- *
- * These are allocated/freed through the endpoint they're used with. The
- * hardware's driver can add extra per-request data to the memory it returns,
- * which often avoids separate memory allocations (potential failures),
- * later when the request is queued.
- *
- * Request flags affect request handling, such as whether a zero length
- * packet is written (the "zero" flag), whether a short read should be
- * treated as an error (blocking request queue advance, the "short_not_ok"
- * flag), or hinting that an interrupt is not required (the "no_interrupt"
- * flag, for use with deep request queues).
- *
- * Bulk endpoints can use any size buffers, and can also be used for interrupt
- * transfers. interrupt-only endpoints can be much less functional.
- *
- * NOTE: this is analogous to 'struct urb' on the host side, except that
- * it's thinner and promotes more pre-allocation.
- */
-
-struct usb_request {
- void *buf;
- unsigned length;
- dma_addr_t dma;
-
- struct scatterlist *sg;
- unsigned num_sgs;
- unsigned num_mapped_sgs;
-
- unsigned stream_id:16;
- unsigned no_interrupt:1;
- unsigned zero:1;
- unsigned short_not_ok:1;
-
- void (*complete)(struct usb_ep *ep,
- struct usb_request *req);
- void *context;
- struct list_head list;
-
- int status;
- unsigned actual;
-};
-
-/*-------------------------------------------------------------------------*/
-
-/* endpoint-specific parts of the api to the usb controller hardware.
- * unlike the urb model, (de)multiplexing layers are not required.
- * (so this api could slash overhead if used on the host side...)
- *
- * note that device side usb controllers commonly differ in how many
- * endpoints they support, as well as their capabilities.
- */
-struct usb_ep_ops {
- int (*enable) (struct usb_ep *ep,
- const struct usb_endpoint_descriptor *desc);
- int (*disable) (struct usb_ep *ep);
-
- struct usb_request *(*alloc_request) (struct usb_ep *ep);
- void (*free_request) (struct usb_ep *ep, struct usb_request *req);
-
- int (*queue) (struct usb_ep *ep, struct usb_request *req);
- int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
-
- int (*set_halt) (struct usb_ep *ep, int value);
- int (*set_wedge) (struct usb_ep *ep);
-
- int (*fifo_status) (struct usb_ep *ep);
- void (*fifo_flush) (struct usb_ep *ep);
-};
-
-/**
- * struct usb_ep - device side representation of USB endpoint
- * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
- * @ops: Function pointers used to access hardware-specific operations.
- * @ep_list:the gadget's ep_list holds all of its endpoints
- * @maxpacket:The maximum packet size used on this endpoint. The initial
- * value can sometimes be reduced (hardware allowing), according to
- * the endpoint descriptor used to configure the endpoint.
- * @maxpacket_limit:The maximum packet size value which can be handled by this
- * endpoint. It's set once by UDC driver when endpoint is initialized, and
- * should not be changed. Should not be confused with maxpacket.
- * @max_streams: The maximum number of streams supported
- * by this EP (0 - 16, actual number is 2^n)
- * @mult: multiplier, 'mult' value for SS Isoc EPs
- * @maxburst: the maximum number of bursts supported by this EP (for usb3)
- * @driver_data:for use by the gadget driver.
- * @address: used to identify the endpoint when finding descriptor that
- * matches connection speed
- * @desc: endpoint descriptor. This pointer is set before the endpoint is
- * enabled and remains valid until the endpoint is disabled.
- * @comp_desc: In case of SuperSpeed support, this is the endpoint companion
- * descriptor that is used to configure the endpoint
- *
- * the bus controller driver lists all the general purpose endpoints in
- * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
- * and is accessed only in response to a driver setup() callback.
- */
-struct usb_ep {
- void *driver_data;
-
- const char *name;
- const struct usb_ep_ops *ops;
- struct list_head ep_list;
- unsigned maxpacket:16;
- unsigned maxpacket_limit:16;
- unsigned max_streams:16;
- unsigned mult:2;
- unsigned maxburst:5;
- u8 address;
- const struct usb_endpoint_descriptor *desc;
- const struct usb_ss_ep_comp_descriptor *comp_desc;
-};
-
-/*-------------------------------------------------------------------------*/
-
-/**
- * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
- * @ep:the endpoint being configured
- * @maxpacket_limit:value of maximum packet size limit
- *
- * This function shoud be used only in UDC drivers to initialize endpoint
- * (usually in probe function).
- */
-static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
- unsigned maxpacket_limit)
-{
- ep->maxpacket_limit = maxpacket_limit;
- ep->maxpacket = maxpacket_limit;
-}
-
-/**
- * usb_ep_enable - configure endpoint, making it usable
- * @ep:the endpoint being configured. may not be the endpoint named "ep0".
- * drivers discover endpoints through the ep_list of a usb_gadget.
- *
- * When configurations are set, or when interface settings change, the driver
- * will enable or disable the relevant endpoints. while it is enabled, an
- * endpoint may be used for i/o until the driver receives a disconnect() from
- * the host or until the endpoint is disabled.
- *
- * the ep0 implementation (which calls this routine) must ensure that the
- * hardware capabilities of each endpoint match the descriptor provided
- * for it. for example, an endpoint named "ep2in-bulk" would be usable
- * for interrupt transfers as well as bulk, but it likely couldn't be used
- * for iso transfers or for endpoint 14. some endpoints are fully
- * configurable, with more generic names like "ep-a". (remember that for
- * USB, "in" means "towards the USB master".)
- *
- * returns zero, or a negative error code.
- */
-static inline int usb_ep_enable(struct usb_ep *ep)
-{
- return ep->ops->enable(ep, ep->desc);
-}
-
-/**
- * usb_ep_disable - endpoint is no longer usable
- * @ep:the endpoint being unconfigured. may not be the endpoint named "ep0".
- *
- * no other task may be using this endpoint when this is called.
- * any pending and uncompleted requests will complete with status
- * indicating disconnect (-ESHUTDOWN) before this call returns.
- * gadget drivers must call usb_ep_enable() again before queueing
- * requests to the endpoint.
- *
- * returns zero, or a negative error code.
- */
-static inline int usb_ep_disable(struct usb_ep *ep)
-{
- return ep->ops->disable(ep);
-}
-
-/**
- * usb_ep_alloc_request - allocate a request object to use with this endpoint
- * @ep:the endpoint to be used with with the request
- * @gfp_flags:GFP_* flags to use
- *
- * Request objects must be allocated with this call, since they normally
- * need controller-specific setup and may even need endpoint-specific
- * resources such as allocation of DMA descriptors.
- * Requests may be submitted with usb_ep_queue(), and receive a single
- * completion callback. Free requests with usb_ep_free_request(), when
- * they are no longer needed.
- *
- * Returns the request, or null if one could not be allocated.
- */
-static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep)
-{
- return ep->ops->alloc_request(ep);
-}
-
-/**
- * usb_ep_free_request - frees a request object
- * @ep:the endpoint associated with the request
- * @req:the request being freed
- *
- * Reverses the effect of usb_ep_alloc_request().
- * Caller guarantees the request is not queued, and that it will
- * no longer be requeued (or otherwise used).
- */
-static inline void usb_ep_free_request(struct usb_ep *ep,
- struct usb_request *req)
-{
- ep->ops->free_request(ep, req);
-}
-
-/**
- * usb_ep_queue - queues (submits) an I/O request to an endpoint.
- * @ep:the endpoint associated with the request
- * @req:the request being submitted
- * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't
- * pre-allocate all necessary memory with the request.
- *
- * This tells the device controller to perform the specified request through
- * that endpoint (reading or writing a buffer). When the request completes,
- * including being canceled by usb_ep_dequeue(), the request's completion
- * routine is called to return the request to the driver. Any endpoint
- * (except control endpoints like ep0) may have more than one transfer
- * request queued; they complete in FIFO order. Once a gadget driver
- * submits a request, that request may not be examined or modified until it
- * is given back to that driver through the completion callback.
- *
- * Each request is turned into one or more packets. The controller driver
- * never merges adjacent requests into the same packet. OUT transfers
- * will sometimes use data that's already buffered in the hardware.
- * Drivers can rely on the fact that the first byte of the request's buffer
- * always corresponds to the first byte of some USB packet, for both
- * IN and OUT transfers.
- *
- * Bulk endpoints can queue any amount of data; the transfer is packetized
- * automatically. The last packet will be short if the request doesn't fill it
- * out completely. Zero length packets (ZLPs) should be avoided in portable
- * protocols since not all usb hardware can successfully handle zero length
- * packets. (ZLPs may be explicitly written, and may be implicitly written if
- * the request 'zero' flag is set.) Bulk endpoints may also be used
- * for interrupt transfers; but the reverse is not true, and some endpoints
- * won't support every interrupt transfer. (Such as 768 byte packets.)
- *
- * Interrupt-only endpoints are less functional than bulk endpoints, for
- * example by not supporting queueing or not handling buffers that are
- * larger than the endpoint's maxpacket size. They may also treat data
- * toggle differently.
- *
- * Control endpoints ... after getting a setup() callback, the driver queues
- * one response (even if it would be zero length). That enables the
- * status ack, after transferring data as specified in the response. Setup
- * functions may return negative error codes to generate protocol stalls.
- * (Note that some USB device controllers disallow protocol stall responses
- * in some cases.) When control responses are deferred (the response is
- * written after the setup callback returns), then usb_ep_set_halt() may be
- * used on ep0 to trigger protocol stalls. Depending on the controller,
- * it may not be possible to trigger a status-stage protocol stall when the
- * data stage is over, that is, from within the response's completion
- * routine.
- *
- * For periodic endpoints, like interrupt or isochronous ones, the usb host
- * arranges to poll once per interval, and the gadget driver usually will
- * have queued some data to transfer at that time.
- *
- * Returns zero, or a negative error code. Endpoints that are not enabled
- * report errors; errors will also be
- * reported when the usb peripheral is disconnected.
- */
-static inline int usb_ep_queue(struct usb_ep *ep,
- struct usb_request *req)
-{
- return ep->ops->queue(ep, req);
-}
-
-/**
- * usb_ep_dequeue - dequeues (cancels, unlinks) an I/O request from an endpoint
- * @ep:the endpoint associated with the request
- * @req:the request being canceled
- *
- * if the request is still active on the endpoint, it is dequeued and its
- * completion routine is called (with status -ECONNRESET); else a negative
- * error code is returned.
- *
- * note that some hardware can't clear out write fifos (to unlink the request
- * at the head of the queue) except as part of disconnecting from usb. such
- * restrictions prevent drivers from supporting configuration changes,
- * even to configuration zero (a "chapter 9" requirement).
- */
-static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
-{
- return ep->ops->dequeue(ep, req);
-}
-
-/**
- * usb_ep_set_halt - sets the endpoint halt feature.
- * @ep: the non-isochronous endpoint being stalled
- *
- * Use this to stall an endpoint, perhaps as an error report.
- * Except for control endpoints,
- * the endpoint stays halted (will not stream any data) until the host
- * clears this feature; drivers may need to empty the endpoint's request
- * queue first, to make sure no inappropriate transfers happen.
- *
- * Note that while an endpoint CLEAR_FEATURE will be invisible to the
- * gadget driver, a SET_INTERFACE will not be. To reset endpoints for the
- * current altsetting, see usb_ep_clear_halt(). When switching altsettings,
- * it's simplest to use usb_ep_enable() or usb_ep_disable() for the endpoints.
- *
- * Returns zero, or a negative error code. On success, this call sets
- * underlying hardware state that blocks data transfers.
- * Attempts to halt IN endpoints will fail (returning -EAGAIN) if any
- * transfer requests are still queued, or if the controller hardware
- * (usually a FIFO) still holds bytes that the host hasn't collected.
- */
-static inline int usb_ep_set_halt(struct usb_ep *ep)
-{
- return ep->ops->set_halt(ep, 1);
-}
-
-/**
- * usb_ep_clear_halt - clears endpoint halt, and resets toggle
- * @ep:the bulk or interrupt endpoint being reset
- *
- * Use this when responding to the standard usb "set interface" request,
- * for endpoints that aren't reconfigured, after clearing any other state
- * in the endpoint's i/o queue.
- *
- * Returns zero, or a negative error code. On success, this call clears
- * the underlying hardware state reflecting endpoint halt and data toggle.
- * Note that some hardware can't support this request (like pxa2xx_udc),
- * and accordingly can't correctly implement interface altsettings.
- */
-static inline int usb_ep_clear_halt(struct usb_ep *ep)
-{
- return ep->ops->set_halt(ep, 0);
-}
-
-/**
- * usb_ep_set_wedge - sets the halt feature and ignores clear requests
- * @ep: the endpoint being wedged
- *
- * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT)
- * requests. If the gadget driver clears the halt status, it will
- * automatically unwedge the endpoint.
- *
- * Returns zero on success, else negative errno.
- */
-static inline int
-usb_ep_set_wedge(struct usb_ep *ep)
-{
- if (ep->ops->set_wedge)
- return ep->ops->set_wedge(ep);
- else
- return ep->ops->set_halt(ep, 1);
-}
-
-/**
- * usb_ep_fifo_status - returns number of bytes in fifo, or error
- * @ep: the endpoint whose fifo status is being checked.
- *
- * FIFO endpoints may have "unclaimed data" in them in certain cases,
- * such as after aborted transfers. Hosts may not have collected all
- * the IN data written by the gadget driver (and reported by a request
- * completion). The gadget driver may not have collected all the data
- * written OUT to it by the host. Drivers that need precise handling for
- * fault reporting or recovery may need to use this call.
- *
- * This returns the number of such bytes in the fifo, or a negative
- * errno if the endpoint doesn't use a FIFO or doesn't support such
- * precise handling.
- */
-static inline int usb_ep_fifo_status(struct usb_ep *ep)
-{
- if (ep->ops->fifo_status)
- return ep->ops->fifo_status(ep);
- else
- return -EOPNOTSUPP;
-}
-
-/**
- * usb_ep_fifo_flush - flushes contents of a fifo
- * @ep: the endpoint whose fifo is being flushed.
- *
- * This call may be used to flush the "unclaimed data" that may exist in
- * an endpoint fifo after abnormal transaction terminations. The call
- * must never be used except when endpoint is not being used for any
- * protocol translation.
- */
-static inline void usb_ep_fifo_flush(struct usb_ep *ep)
-{
- if (ep->ops->fifo_flush)
- ep->ops->fifo_flush(ep);
-}
-
-
-/*-------------------------------------------------------------------------*/
-
-struct usb_dcd_config_params {
- __u8 bU1devExitLat; /* U1 Device exit Latency */
-#define USB_DEFAULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
- __le16 bU2DevExitLat; /* U2 Device exit Latency */
-#define USB_DEFAULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
-};
-
-
-struct usb_gadget;
-struct usb_gadget_driver;
-
-/* the rest of the api to the controller hardware: device operations,
- * which don't involve endpoints (or i/o).
- */
-struct usb_gadget_ops {
- int (*get_frame)(struct usb_gadget *);
- int (*wakeup)(struct usb_gadget *);
- int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered);
- int (*vbus_session) (struct usb_gadget *, int is_active);
- int (*vbus_draw) (struct usb_gadget *, unsigned mA);
- int (*pullup) (struct usb_gadget *, int is_on);
- int (*ioctl)(struct usb_gadget *,
- unsigned code, unsigned long param);
- void (*get_config_params)(struct usb_dcd_config_params *);
- int (*udc_start)(struct usb_gadget *,
- struct usb_gadget_driver *);
- int (*udc_stop)(struct usb_gadget *,
- struct usb_gadget_driver *);
- void (*udc_poll)(struct usb_gadget *);
-};
-
-/**
- * struct usb_gadget - represents a usb slave device
- * @work: (internal use) Workqueue to be used for sysfs_notify()
- * @ops: Function pointers used to access hardware-specific operations.
- * @ep0: Endpoint zero, used when reading or writing responses to
- * driver setup() requests
- * @ep_list: List of other endpoints supported by the device.
- * @speed: Speed of current connection to USB host.
- * @max_speed: Maximal speed the UDC can handle. UDC must support this
- * and all slower speeds.
- * @state: the state we are now (attached, suspended, configured, etc)
- * @name: Identifies the controller hardware type. Used in diagnostics
- * and sometimes configuration.
- * @dev: Driver model state for this abstract device.
- * @out_epnum: last used out ep number
- * @in_epnum: last used in ep number
- * @sg_supported: true if we can handle scatter-gather
- * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
- * gadget driver must provide a USB OTG descriptor.
- * @is_a_peripheral: False unless is_otg, the "A" end of a USB cable
- * is in the Mini-AB jack, and HNP has been used to switch roles
- * so that the "A" device currently acts as A-Peripheral, not A-Host.
- * @a_hnp_support: OTG device feature flag, indicating that the A-Host
- * supports HNP at this port.
- * @a_alt_hnp_support: OTG device feature flag, indicating that the A-Host
- * only supports HNP on a different root port.
- * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
- * enabled HNP support.
- * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
- * MaxPacketSize.
- *
- * Gadgets have a mostly-portable "gadget driver" implementing device
- * functions, handling all usb configurations and interfaces. Gadget
- * drivers talk to hardware-specific code indirectly, through ops vectors.
- * That insulates the gadget driver from hardware details, and packages
- * the hardware endpoints through generic i/o queues. The "usb_gadget"
- * and "usb_ep" interfaces provide that insulation from the hardware.
- *
- * Except for the driver data, all fields in this structure are
- * read-only to the gadget driver. That driver data is part of the
- * "driver model" infrastructure in 2.6 (and later) kernels, and for
- * earlier systems is grouped in a similar structure that's not known
- * to the rest of the kernel.
- *
- * Values of the three OTG device feature flags are updated before the
- * setup() call corresponding to USB_REQ_SET_CONFIGURATION, and before
- * driver suspend() calls. They are valid only when is_otg, and when the
- * device is acting as a B-Peripheral (so is_a_peripheral is false).
- */
-struct usb_gadget {
- /* readonly to gadget driver */
- const struct usb_gadget_ops *ops;
- struct usb_ep *ep0;
- struct list_head ep_list; /* of usb_ep */
- enum usb_device_speed speed;
- enum usb_device_speed max_speed;
- enum usb_device_state state;
- const char *name;
- struct device dev;
- unsigned out_epnum;
- unsigned in_epnum;
-
- unsigned sg_supported:1;
- unsigned is_otg:1;
- unsigned is_a_peripheral:1;
- unsigned b_hnp_enable:1;
- unsigned a_hnp_support:1;
- unsigned a_alt_hnp_support:1;
- unsigned quirk_ep_out_aligned_size:1;
-
- uint32_t vendor_id;
- uint32_t product_id;
- char *manufacturer;
- char *productname;
- char *serialnumber;
-};
-#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
-
-static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
-{
- gadget->dev.priv = data;
-}
-
-static inline void *get_gadget_data(struct usb_gadget *gadget)
-{
- return gadget->dev.priv;
-}
-
-static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
-{
- return container_of(dev, struct usb_gadget, dev);
-}
-
-/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
-#define gadget_for_each_ep(tmp, gadget) \
- list_for_each_entry(tmp, &(gadget)->ep_list, ep_list)
-
-
-/**
- * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
- * requires quirk_ep_out_aligned_size, otherwise reguens len.
- * @g: controller to check for quirk
- * @ep: the endpoint whose maxpacketsize is used to align @len
- * @len: buffer size's length to align to @ep's maxpacketsize
- *
- * This helper is used in case it's required for any reason to check and maybe
- * align buffer's size to an ep's maxpacketsize.
- */
-static inline size_t
-usb_ep_align_maybe(struct usb_gadget *g, struct usb_ep *ep, size_t len)
-{
- return !g->quirk_ep_out_aligned_size ? len :
- round_up(len, (size_t)ep->desc->wMaxPacketSize);
-}
-
-/**
- * gadget_is_dualspeed - return true iff the hardware handles high speed
- * @g: controller that might support both high and full speeds
- */
-static inline int gadget_is_dualspeed(struct usb_gadget *g)
-{
- return g->max_speed >= USB_SPEED_HIGH;
-}
-
-/**
- * gadget_is_superspeed() - return true if the hardware handles superspeed
- * @g: controller that might support superspeed
- */
-static inline int gadget_is_superspeed(struct usb_gadget *g)
-{
- return g->max_speed >= USB_SPEED_SUPER;
-}
-
-/**
- * gadget_is_otg - return true iff the hardware is OTG-ready
- * @g: controller that might have a Mini-AB connector
- *
- * This is a runtime test, since kernels with a USB-OTG stack sometimes
- * run on boards which only have a Mini-B (or Mini-A) connector.
- */
-static inline int gadget_is_otg(struct usb_gadget *g)
-{
-#ifdef CONFIG_USB_OTG
- return g->is_otg;
-#else
- return 0;
-#endif
-}
-
-/**
- * usb_gadget_frame_number - returns the current frame number
- * @gadget: controller that reports the frame number
- *
- * Returns the usb frame number, normally eleven bits from a SOF packet,
- * or negative errno if this device doesn't support this capability.
- */
-static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
-{
- return gadget->ops->get_frame(gadget);
-}
-
-/**
- * usb_gadget_wakeup - tries to wake up the host connected to this gadget
- * @gadget: controller used to wake up the host
- *
- * Returns zero on success, else negative error code if the hardware
- * doesn't support such attempts, or its support has not been enabled
- * by the usb host. Drivers must return device descriptors that report
- * their ability to support this, or hosts won't enable it.
- *
- * This may also try to use SRP to wake the host and start enumeration,
- * even if OTG isn't otherwise in use. OTG devices may also start
- * remote wakeup even when hosts don't explicitly enable it.
- */
-static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
-{
- if (!gadget->ops->wakeup)
- return -EOPNOTSUPP;
- return gadget->ops->wakeup(gadget);
-}
-
-/**
- * usb_gadget_set_selfpowered - sets the device selfpowered feature.
- * @gadget:the device being declared as self-powered
- *
- * this affects the device status reported by the hardware driver
- * to reflect that it now has a local power supply.
- *
- * returns zero on success, else negative errno.
- */
-static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
-{
- if (!gadget->ops->set_selfpowered)
- return -EOPNOTSUPP;
- return gadget->ops->set_selfpowered(gadget, 1);
-}
-
-/**
- * usb_gadget_clear_selfpowered - clear the device selfpowered feature.
- * @gadget:the device being declared as bus-powered
- *
- * this affects the device status reported by the hardware driver.
- * some hardware may not support bus-powered operation, in which
- * case this feature's value can never change.
- *
- * returns zero on success, else negative errno.
- */
-static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
-{
- if (!gadget->ops->set_selfpowered)
- return -EOPNOTSUPP;
- return gadget->ops->set_selfpowered(gadget, 0);
-}
-
-/**
- * usb_gadget_vbus_connect - Notify controller that VBUS is powered
- * @gadget:The device which now has VBUS power.
- * Context: can sleep
- *
- * This call is used by a driver for an external transceiver (or GPIO)
- * that detects a VBUS power session starting. Common responses include
- * resuming the controller, activating the D+ (or D-) pullup to let the
- * host detect that a USB device is attached, and starting to draw power
- * (8mA or possibly more, especially after SET_CONFIGURATION).
- *
- * Returns zero on success, else negative errno.
- */
-static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
-{
- if (!gadget->ops->vbus_session)
- return -EOPNOTSUPP;
- return gadget->ops->vbus_session(gadget, 1);
-}
-
-/**
- * usb_gadget_vbus_draw - constrain controller's VBUS power usage
- * @gadget:The device whose VBUS usage is being described
- * @mA:How much current to draw, in milliAmperes. This should be twice
- * the value listed in the configuration descriptor bMaxPower field.
- *
- * This call is used by gadget drivers during SET_CONFIGURATION calls,
- * reporting how much power the device may consume. For example, this
- * could affect how quickly batteries are recharged.
- *
- * Returns zero on success, else negative errno.
- */
-static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
-{
- if (!gadget->ops->vbus_draw)
- return -EOPNOTSUPP;
- return gadget->ops->vbus_draw(gadget, mA);
-}
-
-/**
- * usb_gadget_vbus_disconnect - notify controller about VBUS session end
- * @gadget:the device whose VBUS supply is being described
- * Context: can sleep
- *
- * This call is used by a driver for an external transceiver (or GPIO)
- * that detects a VBUS power session ending. Common responses include
- * reversing everything done in usb_gadget_vbus_connect().
- *
- * Returns zero on success, else negative errno.
- */
-static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
-{
- if (!gadget->ops->vbus_session)
- return -EOPNOTSUPP;
- return gadget->ops->vbus_session(gadget, 0);
-}
-
-/**
- * usb_gadget_connect - software-controlled connect to USB host
- * @gadget:the peripheral being connected
- *
- * Enables the D+ (or potentially D-) pullup. The host will start
- * enumerating this gadget when the pullup is active and a VBUS session
- * is active (the link is powered). This pullup is always enabled unless
- * usb_gadget_disconnect() has been used to disable it.
- *
- * Returns zero on success, else negative errno.
- */
-static inline int usb_gadget_connect(struct usb_gadget *gadget)
-{
- if (!gadget->ops->pullup)
- return -EOPNOTSUPP;
- return gadget->ops->pullup(gadget, 1);
-}
-
-/**
- * usb_gadget_disconnect - software-controlled disconnect from USB host
- * @gadget:the peripheral being disconnected
- *
- * Disables the D+ (or potentially D-) pullup, which the host may see
- * as a disconnect (when a VBUS session is active). Not all systems
- * support software pullup controls.
- *
- * This routine may be used during the gadget driver bind() call to prevent
- * the peripheral from ever being visible to the USB host, unless later
- * usb_gadget_connect() is called. For example, user mode components may
- * need to be activated before the system can talk to hosts.
- *
- * Returns zero on success, else negative errno.
- */
-static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
-{
- if (!gadget->ops->pullup)
- return -EOPNOTSUPP;
- return gadget->ops->pullup(gadget, 0);
-}
-
-int usb_gadget_poll(void);
-
-/*-------------------------------------------------------------------------*/
-
-/**
- * struct usb_gadget_driver - driver for usb 'slave' devices
- * @function: String describing the gadget's function
- * @max_speed: Highest speed the driver handles.
- * @setup: Invoked for ep0 control requests that aren't handled by
- * the hardware level driver. Most calls must be handled by
- * the gadget driver, including descriptor and configuration
- * management. The 16 bit members of the setup data are in
- * USB byte order. Called in_interrupt; this may not sleep. Driver
- * queues a response to ep0, or returns negative to stall.
- * @disconnect: Invoked after all transfers have been stopped,
- * when the host is disconnected. May be called in_interrupt; this
- * may not sleep. Some devices can't detect disconnect, so this might
- * not be called except as part of controller shutdown.
- * @bind: the driver's bind callback
- * @unbind: Invoked when the driver is unbound from a gadget,
- * usually from rmmod (after a disconnect is reported).
- * Called in a context that permits sleeping.
- * @suspend: Invoked on USB suspend. May be called in_interrupt.
- * @resume: Invoked on USB resume. May be called in_interrupt.
- * @driver: Driver model state for this driver.
- *
- * Devices are disabled till a gadget driver successfully bind()s, which
- * means the driver will handle setup() requests needed to enumerate (and
- * meet "chapter 9" requirements) then do some useful work.
- *
- * If gadget->is_otg is true, the gadget driver must provide an OTG
- * descriptor during enumeration, or else fail the bind() call. In such
- * cases, no USB traffic may flow until both bind() returns without
- * having called usb_gadget_disconnect(), and the USB host stack has
- * initialized.
- *
- * Drivers use hardware-specific knowledge to configure the usb hardware.
- * endpoint addressing is only one of several hardware characteristics that
- * are in descriptors the ep0 implementation returns from setup() calls.
- *
- * Except for ep0 implementation, most driver code shouldn't need change to
- * run on top of different usb controllers. It'll use endpoints set up by
- * that ep0 implementation.
- *
- * The usb controller driver handles a few standard usb requests. Those
- * include set_address, and feature flags for devices, interfaces, and
- * endpoints (the get_status, set_feature, and clear_feature requests).
- *
- * Accordingly, the driver's setup() callback must always implement all
- * get_descriptor requests, returning at least a device descriptor and
- * a configuration descriptor. Drivers must make sure the endpoint
- * descriptors match any hardware constraints. Some hardware also constrains
- * other descriptors. (The pxa250 allows only configurations 1, 2, or 3).
- *
- * The driver's setup() callback must also implement set_configuration,
- * and should also implement set_interface, get_configuration, and
- * get_interface. Setting a configuration (or interface) is where
- * endpoints should be activated or (config 0) shut down.
- *
- * (Note that only the default control endpoint is supported. Neither
- * hosts nor devices generally support control traffic except to ep0.)
- *
- * Most devices will ignore USB suspend/resume operations, and so will
- * not provide those callbacks. However, some may need to change modes
- * when the host is not longer directing those activities. For example,
- * local controls (buttons, dials, etc) may need to be re-enabled since
- * the (remote) host can't do that any longer; or an error state might
- * be cleared, to make the device behave identically whether or not
- * power is maintained.
- */
-struct usb_gadget_driver {
- char *function;
- enum usb_device_speed max_speed;
- int (*bind)(struct usb_gadget *gadget,
- struct usb_gadget_driver *driver);
- void (*unbind)(struct usb_gadget *);
- int (*setup)(struct usb_gadget *,
- const struct usb_ctrlrequest *);
- void (*disconnect)(struct usb_gadget *);
- void (*suspend)(struct usb_gadget *);
- void (*resume)(struct usb_gadget *);
-
- /* FIXME support safe rmmod */
- struct driver driver;
-};
-
-
-
-/*-------------------------------------------------------------------------*/
-
-/* driver modules register and unregister, as usual.
- * these calls must be made in a context that can sleep.
- *
- * these will usually be implemented directly by the hardware-dependent
- * usb bus interface driver, which will only support a single driver.
- */
-
-/**
- * usb_gadget_probe_driver - probe a gadget driver
- * @driver: the driver being registered
- * Context: can sleep
- *
- * Call this in your gadget driver's module initialization function,
- * to tell the underlying usb controller driver about your driver.
- * The @bind() function will be called to bind it to a gadget before this
- * registration call returns. It's expected that the @bind() function will
- * be in init sections.
- */
-int usb_gadget_probe_driver(struct usb_gadget_driver *driver);
-
-/**
- * usb_gadget_unregister_driver - unregister a gadget driver
- * @driver:the driver being unregistered
- * Context: can sleep
- *
- * Call this in your gadget driver's module cleanup function,
- * to tell the underlying usb controller that your driver is
- * going away. If the controller is connected to a USB host,
- * it will first disconnect(). The driver is also requested
- * to unbind() and clean up any device state, before this procedure
- * finally returns. It's expected that the unbind() functions
- * will in in exit sections, so may not be linked in some kernels.
- */
-int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
-
-extern int usb_add_gadget_udc_release(struct device *parent,
- struct usb_gadget *gadget,
- void (*release)(struct device *dev));
-extern int usb_add_gadget_udc(struct device *parent,
- struct usb_gadget *gadget);
-extern void usb_del_gadget_udc(struct usb_gadget *gadget);
-extern int udc_attach_driver(const char *name,
- struct usb_gadget_driver *driver);
-
-/*-------------------------------------------------------------------------*/
-
-/* utility to simplify dealing with string descriptors */
-
-/**
- * struct usb_string - wraps a C string and its USB id
- * @id:the (nonzero) ID for this string
- * @s:the string, in UTF-8 encoding
- *
- * If you're using usb_gadget_get_string(), use this to wrap a string
- * together with its ID.
- */
-struct usb_string {
- u8 id;
- const char *s;
-};
-
-/**
- * struct usb_gadget_strings - a set of USB strings in a given language
- * @language:identifies the strings' language (0x0409 for en-us)
- * @strings:array of strings with their ids
- *
- * If you're using usb_gadget_get_string(), use this to wrap all the
- * strings for a given language.
- */
-struct usb_gadget_strings {
- u16 language; /* 0x0409 for en-us */
- struct usb_string *strings;
-};
-
-struct usb_gadget_string_container {
- struct list_head list;
- u8 *stash[0];
-};
-
-/* put descriptor for string with that id into buf (buflen >= 256) */
-int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
-
-/*-------------------------------------------------------------------------*/
-
-/* utility to simplify managing config descriptors */
-
-/* write vector of descriptors into buffer */
-int usb_descriptor_fillbuf(void *, unsigned,
- const struct usb_descriptor_header **);
-
-/* build config descriptor from single descriptor vector */
-int usb_gadget_config_buf(const struct usb_config_descriptor *config,
- void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
-
-/* copy a NULL-terminated vector of descriptors */
-struct usb_descriptor_header **usb_copy_descriptors(
- struct usb_descriptor_header **);
-
-/**
- * usb_free_descriptors - free descriptors returned by usb_copy_descriptors()
- * @v: vector of descriptors
- */
-static inline void usb_free_descriptors(struct usb_descriptor_header **v)
-{
- kfree(v);
-}
-
-struct usb_function;
-int usb_assign_descriptors(struct usb_function *f,
- struct usb_descriptor_header **fs,
- struct usb_descriptor_header **hs,
- struct usb_descriptor_header **ss);
-void usb_free_all_descriptors(struct usb_function *f);
-
-/*-------------------------------------------------------------------------*/
-
-/* utility to set gadget state properly */
-
-extern void usb_gadget_set_state(struct usb_gadget *gadget,
- enum usb_device_state state);
-
-/*-------------------------------------------------------------------------*/
-
-/* utility to tell udc core that the bus reset occurs */
-extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
- struct usb_gadget_driver *driver);
-
-/* utility wrapping a simple endpoint selection policy */
-
-extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
- struct usb_endpoint_descriptor *);
-
-
-extern struct usb_ep *usb_ep_autoconfig_ss(struct usb_gadget *,
- struct usb_endpoint_descriptor *,
- struct usb_ss_ep_comp_descriptor *);
-
-extern void usb_ep_autoconfig_reset(struct usb_gadget *);
-
-#endif /* __LINUX_USB_GADGET_H */
diff --git a/include/usb/mass_storage.h b/include/usb/mass_storage.h
deleted file mode 100644
index 7be665ee47..0000000000
--- a/include/usb/mass_storage.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2011 Samsung Electrnoics
- * Lukasz Majewski <l.majewski@samsung.com>
- */
-
-#ifndef __USB_MASS_STORAGE_H__
-#define __USB_MASS_STORAGE_H__
-
-#include <usb/composite.h>
-
-/* Wait at maximum 60 seconds for cable connection */
-#define UMS_CABLE_READY_TIMEOUT 60
-
-struct fsg_common;
-
-struct f_ums_opts {
- struct usb_function_instance func_inst;
- struct fsg_common *common;
- struct file_list *files;
- unsigned int num_sectors;
- int fd;
- int refcnt;
- char name[16];
-};
-
-int usb_ums_register(struct f_ums_opts *);
-
-#endif /* __USB_MASS_STORAGE_H__ */
diff --git a/include/usb/musb.h b/include/usb/musb.h
deleted file mode 100644
index fb846dd30b..0000000000
--- a/include/usb/musb.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/*
- * This is used to for host and peripheral modes of the driver for
- * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
- *
- * Board initialization should put one of these into dev->platform_data,
- * probably on some platform_device named "musb-hdrc". It encapsulates
- * key configuration differences between boards.
- */
-
-#ifndef __LINUX_USB_MUSB_H
-#define __LINUX_USB_MUSB_H
-
-/* The USB role is defined by the connector used on the board, so long as
- * standards are being followed. (Developer boards sometimes won't.)
- */
-enum musb_mode {
- MUSB_UNDEFINED = 0,
- MUSB_HOST, /* A or Mini-A connector */
- MUSB_PERIPHERAL, /* B or Mini-B connector */
- MUSB_OTG /* Mini-AB connector */
-};
-
-struct clk;
-
-enum musb_fifo_style {
- FIFO_RXTX,
- FIFO_TX,
- FIFO_RX
-} __attribute__ ((packed));
-
-enum musb_buf_mode {
- BUF_SINGLE,
- BUF_DOUBLE
-} __attribute__ ((packed));
-
-struct musb_fifo_cfg {
- u8 hw_ep_num;
- enum musb_fifo_style style;
- enum musb_buf_mode mode;
- u16 maxpacket;
-};
-
-#define MUSB_EP_FIFO(ep, st, m, pkt) \
-{ \
- .hw_ep_num = ep, \
- .style = st, \
- .mode = m, \
- .maxpacket = pkt, \
-}
-
-#define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
- MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
-
-#define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
- MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
-
-struct musb_hdrc_eps_bits {
- const char name[16];
- u8 bits;
-};
-
-struct musb_hdrc_config {
- struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
- unsigned fifo_cfg_size; /* size of the fifo configuration */
-
- /* MUSB configuration-specific details */
- unsigned multipoint:1; /* multipoint device */
- unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
- unsigned soft_con:1 __deprecated; /* soft connect required */
- unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
- unsigned big_endian:1; /* true if CPU uses big-endian */
- unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
- unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
- unsigned high_iso_tx:1; /* Tx ep required for HB iso */
- unsigned high_iso_rx:1; /* Rx ep required for HD iso */
- unsigned dma:1 __deprecated; /* supports DMA */
- unsigned vendor_req:1 __deprecated; /* vendor registers required */
-
- u8 num_eps; /* number of endpoints _with_ ep0 */
- u8 dma_channels __deprecated; /* number of dma channels */
- u8 dyn_fifo_size; /* dynamic size in bytes */
- u8 vendor_ctrl __deprecated; /* vendor control reg width */
- u8 vendor_stat __deprecated; /* vendor status reg witdh */
- u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
- u8 ram_bits; /* ram address size */
-
- struct musb_hdrc_eps_bits *eps_bits __deprecated;
-};
-
-struct musb_hdrc_platform_data {
- /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
- u8 mode;
-
- /* for clk_get() */
- const char *clock;
-
- /* (HOST or OTG) switch VBUS on/off */
- int (*set_vbus)(struct device *dev, int is_on);
-
- /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
- u8 power;
-
- /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
- u8 min_power;
-
- /* (HOST or OTG) msec/2 after VBUS on till power good */
- u8 potpgt;
-
- /* (HOST or OTG) program PHY for external Vbus */
- unsigned extvbus:1;
-
- /* Power the device on or off */
- int (*set_power)(int state);
-
- /* MUSB configuration-specific details */
- struct musb_hdrc_config *config;
-
- /* Architecture specific board data */
- void *board_data;
-
- /* Platform specific struct musb_ops pointer */
- const void *platform_ops;
-};
-
-
-/* TUSB 6010 support */
-
-#define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */
-#define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */
-#define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */
-
-#ifdef CONFIG_ARCH_OMAP2
-
-extern int __init tusb6010_setup_interface(
- struct musb_hdrc_platform_data *data,
- unsigned ps_refclk, unsigned waitpin,
- unsigned async_cs, unsigned sync_cs,
- unsigned irq, unsigned dmachan);
-
-extern int tusb6010_platform_retime(unsigned is_refclk);
-
-#endif /* OMAP2 */
-
-#endif /* __LINUX_USB_MUSB_H */
diff --git a/include/usb/phy.h b/include/usb/phy.h
deleted file mode 100644
index 98a4ce087f..0000000000
--- a/include/usb/phy.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-/* USB OTG (On The Go) defines */
-/*
- *
- * These APIs may be used between USB controllers. USB device drivers
- * (for either host or peripheral roles) don't use these calls; they
- * continue to use just usb_device and usb_gadget.
- */
-
-#ifndef __LINUX_USB_PHY_H
-#define __LINUX_USB_PHY_H
-
-#include <notifier.h>
-#include <usb/usb.h>
-#include <linux/err.h>
-
-enum usb_phy_interface {
- USBPHY_INTERFACE_MODE_UNKNOWN,
- USBPHY_INTERFACE_MODE_UTMI,
- USBPHY_INTERFACE_MODE_UTMIW,
- USBPHY_INTERFACE_MODE_ULPI,
- USBPHY_INTERFACE_MODE_SERIAL,
- USBPHY_INTERFACE_MODE_HSIC,
-};
-
-enum usb_phy_events {
- USB_EVENT_NONE, /* no events or cable disconnected */
- USB_EVENT_VBUS, /* vbus valid event */
- USB_EVENT_ID, /* id was grounded */
- USB_EVENT_CHARGER, /* usb dedicated charger */
- USB_EVENT_ENUMERATED, /* gadget driver enumerated */
-};
-
-/* associate a type with PHY */
-enum usb_phy_type {
- USB_PHY_TYPE_UNDEFINED,
- USB_PHY_TYPE_USB2,
- USB_PHY_TYPE_USB3,
-};
-
-struct usb_phy;
-
-/* for transceivers connected thru an ULPI interface, the user must
- * provide access ops
- */
-struct usb_phy_io_ops {
- int (*read)(struct usb_phy *x, u32 reg);
- int (*write)(struct usb_phy *x, u32 val, u32 reg);
-};
-
-struct usb_phy {
- struct device *dev;
- const char *label;
- unsigned int flags;
-
- enum usb_phy_type type;
- enum usb_phy_events last_event;
-
- struct usb_phy_io_ops *io_ops;
- void __iomem *io_priv;
-
- /* to pass extra port status to the root hub */
- u16 port_status;
- u16 port_change;
-
- /* to support controllers that have multiple transceivers */
- struct list_head head;
-
- /* initialize/shutdown the OTG controller */
- int (*init)(struct usb_phy *x);
- void (*shutdown)(struct usb_phy *x);
-
- /* enable/disable VBUS */
- int (*set_vbus)(struct usb_phy *x, int on);
-
- /* effective for B devices, ignored for A-peripheral */
- int (*set_power)(struct usb_phy *x,
- unsigned mA);
-
- /* for non-OTG B devices: set transceiver into suspend mode */
- int (*set_suspend)(struct usb_phy *x,
- int suspend);
-
- /*
- * Set wakeup enable for PHY, in that case, the PHY can be
- * woken up from suspend status due to external events,
- * like vbus change, dp/dm change and id.
- */
- int (*set_wakeup)(struct usb_phy *x, bool enabled);
-
- /* notify phy connect status change */
- int (*notify_connect)(struct usb_phy *x,
- enum usb_device_speed speed);
- int (*notify_disconnect)(struct usb_phy *x,
- enum usb_device_speed speed);
-};
-
-/**
- * struct usb_phy_bind - represent the binding for the phy
- * @dev_name: the device name of the device that will bind to the phy
- * @phy_dev_name: the device name of the phy
- * @index: used if a single controller uses multiple phys
- * @phy: reference to the phy
- * @list: to maintain a linked list of the binding information
- */
-struct usb_phy_bind {
- const char *dev_name;
- const char *phy_dev_name;
- u8 index;
- struct usb_phy *phy;
- struct list_head list;
-};
-
-/* helpers for direct access thru low-level io interface */
-static inline int usb_phy_io_read(struct usb_phy *x, u32 reg)
-{
- if (x && x->io_ops && x->io_ops->read)
- return x->io_ops->read(x, reg);
-
- return -EINVAL;
-}
-
-static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg)
-{
- if (x && x->io_ops && x->io_ops->write)
- return x->io_ops->write(x, val, reg);
-
- return -EINVAL;
-}
-
-static inline int
-usb_phy_init(struct usb_phy *x)
-{
- if (x && x->init)
- return x->init(x);
-
- return 0;
-}
-
-static inline void
-usb_phy_shutdown(struct usb_phy *x)
-{
- if (x && x->shutdown)
- x->shutdown(x);
-}
-
-static inline int
-usb_phy_vbus_on(struct usb_phy *x)
-{
- if (!x || !x->set_vbus)
- return 0;
-
- return x->set_vbus(x, true);
-}
-
-static inline int
-usb_phy_vbus_off(struct usb_phy *x)
-{
- if (!x || !x->set_vbus)
- return 0;
-
- return x->set_vbus(x, false);
-}
-
-static inline int
-usb_phy_set_power(struct usb_phy *x, unsigned mA)
-{
- if (x && x->set_power)
- return x->set_power(x, mA);
- return 0;
-}
-
-/* Context: can sleep */
-static inline int
-usb_phy_set_suspend(struct usb_phy *x, int suspend)
-{
- if (x && x->set_suspend != NULL)
- return x->set_suspend(x, suspend);
- else
- return 0;
-}
-
-static inline int
-usb_phy_set_wakeup(struct usb_phy *x, bool enabled)
-{
- if (x && x->set_wakeup)
- return x->set_wakeup(x, enabled);
- else
- return 0;
-}
-
-static inline int
-usb_phy_notify_connect(struct usb_phy *x, enum usb_device_speed speed)
-{
- if (x && x->notify_connect)
- return x->notify_connect(x, speed);
- else
- return 0;
-}
-
-static inline int
-usb_phy_notify_disconnect(struct usb_phy *x, enum usb_device_speed speed)
-{
- if (x && x->notify_disconnect)
- return x->notify_disconnect(x, speed);
- else
- return 0;
-}
-
-static inline const char *usb_phy_type_string(enum usb_phy_type type)
-{
- switch (type) {
- case USB_PHY_TYPE_USB2:
- return "USB2 PHY";
- case USB_PHY_TYPE_USB3:
- return "USB3 PHY";
- default:
- return "UNKNOWN PHY TYPE";
- }
-}
-#endif /* __LINUX_USB_PHY_H */
diff --git a/include/usb/storage.h b/include/usb/storage.h
deleted file mode 100644
index e0240f8645..0000000000
--- a/include/usb/storage.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#ifndef __LINUX_USB_STORAGE_H
-#define __LINUX_USB_STORAGE_H
-
-/*
- * linux/usb/storage.h
- *
- * Copyright Matthew Wilcox for Intel Corp, 2010
- *
- * This file contains definitions taken from the
- * USB Mass Storage Class Specification Overview
- *
- * Distributed under the terms of the GNU GPL, version two.
- */
-
-/* Storage subclass codes */
-
-#define USB_SC_RBC 0x01 /* Typically, flash devices */
-#define USB_SC_8020 0x02 /* CD-ROM */
-#define USB_SC_QIC 0x03 /* QIC-157 Tapes */
-#define USB_SC_UFI 0x04 /* Floppy */
-#define USB_SC_8070 0x05 /* Removable media */
-#define USB_SC_SCSI 0x06 /* Transparent */
-#define USB_SC_LOCKABLE 0x07 /* Password-protected */
-
-#define USB_SC_ISD200 0xf0 /* ISD200 ATA */
-#define USB_SC_CYP_ATACB 0xf1 /* Cypress ATACB */
-#define USB_SC_DEVICE 0xff /* Use device's value */
-
-/* Storage protocol codes */
-
-#define USB_PR_CBI 0x00 /* Control/Bulk/Interrupt */
-#define USB_PR_CB 0x01 /* Control/Bulk w/o interrupt */
-#define USB_PR_BULK 0x50 /* bulk only */
-#define USB_PR_UAS 0x62 /* USB Attached SCSI */
-
-#define USB_PR_USBAT 0x80 /* SCM-ATAPI bridge */
-#define USB_PR_EUSB_SDDR09 0x81 /* SCM-SCSI bridge for SDDR-09 */
-#define USB_PR_SDDR55 0x82 /* SDDR-55 (made up) */
-#define USB_PR_DPCM_USB 0xf0 /* Combination CB/SDDR09 */
-#define USB_PR_FREECOM 0xf1 /* Freecom */
-#define USB_PR_DATAFAB 0xf2 /* Datafab chipsets */
-#define USB_PR_JUMPSHOT 0xf3 /* Lexar Jumpshot */
-#define USB_PR_ALAUDA 0xf4 /* Alauda chipsets */
-#define USB_PR_KARMA 0xf5 /* Rio Karma */
-
-#define USB_PR_DEVICE 0xff /* Use device's value */
-
-/*
- * Bulk only data structures
- */
-
-/* command block wrapper */
-struct bulk_cb_wrap {
- __le32 Signature; /* contains 'USBC' */
- __u32 Tag; /* unique per command id */
- __le32 DataTransferLength; /* size of data */
- __u8 Flags; /* direction in bit 0 */
- __u8 Lun; /* LUN normally 0 */
- __u8 Length; /* length of the CDB */
- __u8 CDB[16]; /* max command */
-};
-
-#define US_BULK_CB_WRAP_LEN 31
-#define US_BULK_CB_SIGN 0x43425355 /* spells out 'USBC' */
-#define US_BULK_FLAG_IN (1 << 7)
-#define US_BULK_FLAG_OUT 0
-
-/* command status wrapper */
-struct bulk_cs_wrap {
- __le32 Signature; /* contains 'USBS' */
- __u32 Tag; /* same as original command */
- __le32 Residue; /* amount not transferred */
- __u8 Status; /* see below */
-};
-
-#define US_BULK_CS_WRAP_LEN 13
-#define US_BULK_CS_SIGN 0x53425355 /* spells out 'USBS' */
-#define US_BULK_STAT_OK 0
-#define US_BULK_STAT_FAIL 1
-#define US_BULK_STAT_PHASE 2
-
-/* bulk-only class specific requests */
-#define US_BULK_RESET_REQUEST 0xff
-#define US_BULK_GET_MAX_LUN 0xfe
-
-#endif
diff --git a/include/usb/twl4030.h b/include/usb/twl4030.h
deleted file mode 100644
index 66f5156f9e..0000000000
--- a/include/usb/twl4030.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2010 Michael Grzeschik <mgr@pengutronix.de>
- * Copyright (C) 2010 Sascha Hauer <sha@pengutronix.de>
- *
- * This file is released under the GPLv2
- *
- */
-
-#ifndef __USB_TWL4030_H
-#define __USB_TWL4030_H
-
-/* Defines for bits in registers */
-#define OPMODE_MASK (3 << 3)
-#define XCVRSELECT_MASK (3 << 0)
-#define CARKITMODE (1 << 2)
-#define OTG_ENAB (1 << 5)
-#define PHYPWD (1 << 0)
-#define CLOCKGATING_EN (1 << 2)
-#define CLK32K_EN (1 << 1)
-#define REQ_PHY_DPLL_CLK (1 << 0)
-#define PHY_DPLL_CLK (1 << 0)
-
-/*
- * USB
- */
-int twl4030_usb_ulpi_init(void);
-
-#endif /* __USB_TWL4030_H */
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
deleted file mode 100644
index efbfc63208..0000000000
--- a/include/usb/ulpi.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef __MACH_ULPI_H
-#define __MACH_ULPI_H
-
-int ulpi_write(u8 bits, int reg, void __iomem *view);
-int ulpi_set(u8 bits, int reg, void __iomem *view);
-int ulpi_clear(u8 bits, int reg, void __iomem *view);
-int ulpi_read(int reg, void __iomem *view);
-int ulpi_setup(void __iomem *view, int on);
-
-/* ULPI register addresses */
-#define ULPI_VID_LOW 0x00 /* Vendor ID low */
-#define ULPI_VID_HIGH 0x01 /* Vendor ID high */
-#define ULPI_PID_LOW 0x02 /* Product ID low */
-#define ULPI_PID_HIGH 0x03 /* Product ID high */
-#define ULPI_FUNCTION_CTRL 0x04
-#define ULPI_ITFCTL 0x07 /* Interface Control */
-#define ULPI_OTGCTL 0x0A /* OTG Control */
-
-/* add to above register address to access Set/Clear functions */
-#define ULPI_REG_SET 0x01
-#define ULPI_REG_CLEAR 0x02
-
-/* Function Control */
-#define ULPI_FC_XCVRSEL_MASK (3 << 0)
-#define ULPI_FC_HIGH_SPEED (0 << 0)
-#define ULPI_FC_FULL_SPEED (1 << 0)
-#define ULPI_FC_LOW_SPEED (2 << 0)
-#define ULPI_FC_FS4LS (3 << 0)
-#define ULPI_FC_TERMSELECT (1 << 2)
-#define ULPI_FC_OPMODE_MASK (3 << 3)
-#define ULPI_FC_OPMODE_NORMAL (0 << 3)
-#define ULPI_FC_OPMODE_NONDRIVING (1 << 3)
-#define ULPI_FC_OPMODE_DISABLE_NRZI (2 << 3)
-#define ULPI_FC_OPMODE_NOSYNC_NOEOP (3 << 3)
-#define ULPI_FC_RESET (1 << 5)
-#define ULPI_FC_SUSPENDM (1 << 6)
-
-/* Interface Control */
-#define ULPI_IFACE_6_PIN_SERIAL_MODE (1 << 0)
-#define ULPI_IFACE_3_PIN_SERIAL_MODE (1 << 1)
-#define ULPI_IFACE_CARKITMODE (1 << 2)
-#define ULPI_IFACE_CLOCKSUSPENDM (1 << 3)
-#define ULPI_IFACE_AUTORESUME (1 << 4)
-#define ULPI_IFACE_EXTVBUS_COMPLEMENT (1 << 5)
-#define ULPI_IFACE_PASSTHRU (1 << 6)
-#define ULPI_IFACE_PROTECT_IFC_DISABLE (1 << 7)
-
-/* ULPI OTG Control Register bits */
-#define ULPI_OTG_USE_EXT_VBUS_IND (1 << 7) /* Use ext. Vbus indicator */
-#define ULPI_OTG_DRV_VBUS_EXT (1 << 6) /* Drive Vbus external */
-#define ULPI_OTG_DRV_VBUS (1 << 5) /* Drive Vbus */
-#define ULPI_OTG_CHRG_VBUS (1 << 4) /* Charge Vbus */
-#define ULPI_OTG_DISCHRG_VBUS (1 << 3) /* Discharge Vbus */
-#define ULPI_OTG_DM_PULL_DOWN (1 << 2) /* enable DM Pull Down */
-#define ULPI_OTG_DP_PULL_DOWN (1 << 1) /* enable DP Pull Down */
-#define ULPI_OTG_ID_PULL_UP (1 << 0) /* enable ID Pull Up */
-
-#endif /* __MACH_ULPI_H */
-
diff --git a/include/usb/usb.h b/include/usb/usb.h
deleted file mode 100644
index 717bcf935a..0000000000
--- a/include/usb/usb.h
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- * (C) Copyright 2001
- * Denis Peter, MPL AG Switzerland
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that 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.
- *
- *
- * Note: Part of this code has been derived from linux
- *
- */
-#ifndef _USB_H_
-#define _USB_H_
-
-#include <driver.h>
-#include <slice.h>
-#include <usb/ch9.h>
-#include <usb/ch11.h>
-#include <usb/usb_defs.h>
-#include <asm/byteorder.h>
-
-/* Everything is aribtrary */
-#define USB_ALTSETTINGALLOC 4
-#define USB_MAXALTSETTING 128 /* Hard limit */
-
-#define USB_MAX_DEVICE 32
-#define USB_MAXCONFIG 8
-#define USB_MAXINTERFACES 16
-#define USB_MAXENDPOINTS 16
-#define USB_MAXCHILDREN 8 /* This is arbitrary */
-#define USB_MAX_HUB 16
-
-#define USB_CNTL_TIMEOUT 5000 /* 5000ms timeout */
-
-/* device request (setup) */
-struct devrequest {
- unsigned char requesttype;
- unsigned char request;
- unsigned short value;
- unsigned short index;
- unsigned short length;
-} __attribute__ ((packed));
-
-enum {
- /* Maximum packet size; encoded as 0,1,2,3 = 8,16,32,64 */
- PACKET_SIZE_8 = 0,
- PACKET_SIZE_16 = 1,
- PACKET_SIZE_32 = 2,
- PACKET_SIZE_64 = 3,
-};
-
-struct usb_interface {
- struct usb_interface_descriptor desc;
-
- unsigned char no_of_ep;
- unsigned char num_altsetting;
- unsigned char act_altsetting;
-
- struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
- /*
- * Super Speed Device will have Super Speed Endpoint
- * Companion Descriptor (section 9.6.7 of usb 3.0 spec)
- * Revision 1.0 June 6th 2011
- */
- struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS];
-};
-
-struct usb_config {
- struct usb_config_descriptor desc;
-
- unsigned char no_of_if; /* number of interfaces */
- struct usb_interface interface[USB_MAXINTERFACES];
-};
-
-struct usb_device {
- int devnum; /* Device number on USB bus */
- int speed; /* full/low/high */
- char mf[32]; /* manufacturer */
- char prod[32]; /* product */
- char serial[32]; /* serial number */
-
- /* Maximum packet size; one of: PACKET_SIZE_* */
- int maxpacketsize;
- /* one bit for each endpoint ([0] = IN, [1] = OUT) */
- unsigned int toggle[2];
- /* endpoint halts; one bit per endpoint # & direction;
- * [0] = IN, [1] = OUT
- */
- unsigned int halted[2];
- int epmaxpacketin[16]; /* INput endpoint specific maximums */
- int epmaxpacketout[16]; /* OUTput endpoint specific maximums */
-
- int configno; /* selected config number */
- struct usb_device_descriptor *descriptor; /* Device Descriptor */
- struct usb_config config; /* config descriptor */
- struct devrequest *setup_packet;
-
- int have_langid; /* whether string_langid is valid yet */
- int string_langid; /* language ID for strings */
- /*
- * Child devices - if this is a hub device
- * Each instance needs its own set of data structures.
- */
- unsigned long status;
- int act_len; /* transfered bytes */
- int maxchild; /* Number of ports if hub */
- int portnr;
- int level;
- struct usb_device *parent;
- struct usb_device *children[USB_MAXCHILDREN];
-
- struct device dev;
-
- struct usb_host *host;
-
- struct list_head list;
- void *drv_data;
- struct usb_hub_device *hub;
-
- /* slot_id - for xHCI enabled devices */
- unsigned int slot_id;
-};
-
-struct usb_device_id;
-
-struct usb_driver {
- const char *name;
- int (*probe) (struct usb_device *, const struct usb_device_id *);
- void (*disconnect)(struct usb_device *);
-
- const struct usb_device_id *id_table;
-
- struct driver driver;
-};
-
-extern struct bus_type usb_bus_type;
-
-int usb_driver_register(struct usb_driver *);
-
-struct usb_host {
- int (*init)(struct usb_host *);
- int (*exit)(struct usb_host *);
- int (*submit_bulk_msg)(struct usb_device *dev, unsigned long pipe,
- void *buffer, int transfer_len, int timeout_ms);
- int (*submit_control_msg)(struct usb_device *dev, unsigned long pipe, void *buffer,
- int transfer_len, struct devrequest *setup, int timeout_ms);
- int (*submit_int_msg)(struct usb_device *dev, unsigned long pipe, void *buffer,
- int transfer_len, int interval);
- void (*usb_event_poll)(void);
- int (*alloc_device)(struct usb_device *dev);
- int (*update_hub_device)(struct usb_device *dev);
-
- bool no_desc_before_addr;
-
- struct list_head list;
-
- struct device *hw_dev;
- int busnum;
- struct usb_device *root_dev;
- struct usb_phy *usbphy;
- struct slice slice;
-};
-
-int usb_register_host(struct usb_host *);
-void usb_unregister_host(struct usb_host *host);
-
-static inline struct slice *usb_device_slice(struct usb_device *udev)
-{
- return &udev->host->slice;
-}
-
-int usb_host_detect(struct usb_host *host);
-
-int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
-int usb_set_idle(struct usb_device *dev, int ifnum, int duration,
- int report_id);
-int usb_control_msg(struct usb_device *dev, unsigned int pipe,
- unsigned char request, unsigned char requesttype,
- unsigned short value, unsigned short index,
- void *data, unsigned short size, int timeout_ms);
-int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
- void *data, int len, int *actual_length, int timeout_ms);
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
- void *buffer, int transfer_len, int interval);
-int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
-int usb_get_configuration_no(struct usb_device *dev, unsigned char *buffer,
- int cfgno);
-int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
- unsigned char id, void *buf, int size);
-int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
- unsigned char type, unsigned char id, void *buf,
- int size);
-int usb_clear_halt(struct usb_device *dev, int pipe);
-int usb_string(struct usb_device *dev, int index, char *buf, size_t size);
-int usb_set_interface(struct usb_device *dev, int interface, int alternate);
-
-int usb_rescan(void);
-
-/* big endian -> little endian conversion */
-/* some CPUs are already little endian e.g. the ARM920T */
-#define __swap_16(x) \
- ({ unsigned short x_ = (unsigned short)x; \
- (unsigned short)( \
- ((x_ & 0x00FFU) << 8) | ((x_ & 0xFF00U) >> 8)); \
- })
-#define __swap_32(x) \
- ({ unsigned long x_ = (unsigned long)x; \
- (unsigned long)( \
- ((x_ & 0x000000FFUL) << 24) | \
- ((x_ & 0x0000FF00UL) << 8) | \
- ((x_ & 0x00FF0000UL) >> 8) | \
- ((x_ & 0xFF000000UL) >> 24)); \
- })
-
-#ifdef __LITTLE_ENDIAN
-# define swap_16(x) (x)
-# define swap_32(x) (x)
-#elif defined __BIG_ENDIAN
-# define swap_16(x) __swap_16(x)
-# define swap_32(x) __swap_32(x)
-#else
-#error "could not determine byte order"
-#endif
-
-/*
- * Calling this entity a "pipe" is glorifying it. A USB pipe
- * is something embarrassingly simple: it basically consists
- * of the following information:
- * - device number (7 bits)
- * - endpoint number (4 bits)
- * - current Data0/1 state (1 bit)
- * - direction (1 bit)
- * - speed (2 bits)
- * - max packet size (2 bits: 8, 16, 32 or 64)
- * - pipe type (2 bits: control, interrupt, bulk, isochronous)
- *
- * That's 18 bits. Really. Nothing more. And the USB people have
- * documented these eighteen bits as some kind of glorious
- * virtual data structure.
- *
- * Let's not fall in that trap. We'll just encode it as a simple
- * unsigned int. The encoding is:
- *
- * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64)
- * - direction: bit 7 (0 = Host-to-Device [Out],
- * (1 = Device-to-Host [In])
- * - device: bits 8-14
- * - endpoint: bits 15-18
- * - Data0/1: bit 19
- * - speed: bit 26 (0 = Full, 1 = Low Speed, 2 = High)
- * - pipe type: bits 30-31 (00 = isochronous, 01 = interrupt,
- * 10 = control, 11 = bulk)
- *
- * Why? Because it's arbitrary, and whatever encoding we select is really
- * up to us. This one happens to share a lot of bit positions with the UHCI
- * specification, so that much of the uhci driver can just mask the bits
- * appropriately.
- */
-/* Create various pipes... */
-#define create_pipe(dev,endpoint) \
- (((dev)->devnum << 8) | ((endpoint) << 15) | \
- ((dev)->speed << 26) | (dev)->maxpacketsize)
-#define default_pipe(dev) ((dev)->speed << 26)
-
-#define usb_sndctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
- create_pipe(dev, (endpoint)))
-#define usb_rcvctrlpipe(dev, endpoint) ((PIPE_CONTROL << 30) | \
- create_pipe(dev, (endpoint)) | \
- USB_DIR_IN)
-#define usb_sndisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
- create_pipe(dev, (endpoint)))
-#define usb_rcvisocpipe(dev, endpoint) ((PIPE_ISOCHRONOUS << 30) | \
- create_pipe(dev, (endpoint)) | \
- USB_DIR_IN)
-#define usb_sndbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
- create_pipe(dev, (endpoint)))
-#define usb_rcvbulkpipe(dev, endpoint) ((PIPE_BULK << 30) | \
- create_pipe(dev, (endpoint)) | \
- USB_DIR_IN)
-#define usb_sndintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
- create_pipe(dev, (endpoint)))
-#define usb_rcvintpipe(dev, endpoint) ((PIPE_INTERRUPT << 30) | \
- create_pipe(dev, (endpoint)) | \
- USB_DIR_IN)
-#define usb_snddefctrl(dev) ((PIPE_CONTROL << 30) | \
- default_pipe(dev))
-#define usb_rcvdefctrl(dev) ((PIPE_CONTROL << 30) | \
- default_pipe(dev) | \
- USB_DIR_IN)
-
-/* The D0/D1 toggle bits */
-#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> ep) & 1)
-#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << ep))
-#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = \
- ((dev)->toggle[out] & \
- ~(1 << ep)) | ((bit) << ep))
-
-/* Endpoint halt control/status */
-#define usb_endpoint_out(ep_dir) (((ep_dir >> 7) & 1) ^ 1)
-#define usb_endpoint_halt(dev, ep, out) ((dev)->halted[out] |= (1 << (ep)))
-#define usb_endpoint_running(dev, ep, out) ((dev)->halted[out] &= ~(1 << (ep)))
-#define usb_endpoint_halted(dev, ep, out) ((dev)->halted[out] & (1 << (ep)))
-
-#define usb_packetid(pipe) (((pipe) & USB_DIR_IN) ? USB_PID_IN : \
- USB_PID_OUT)
-
-#define usb_pipeout(pipe) ((((pipe) >> 7) & 1) ^ 1)
-#define usb_pipein(pipe) (((pipe) >> 7) & 1)
-#define usb_pipedevice(pipe) (((pipe) >> 8) & 0x7f)
-#define usb_pipe_endpdev(pipe) (((pipe) >> 8) & 0x7ff)
-#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)
-#define usb_pipedata(pipe) (((pipe) >> 19) & 1)
-#define usb_pipetype(pipe) (((pipe) >> 30) & 3)
-#define usb_pipeisoc(pipe) (usb_pipetype((pipe)) == PIPE_ISOCHRONOUS)
-#define usb_pipeint(pipe) (usb_pipetype((pipe)) == PIPE_INTERRUPT)
-#define usb_pipecontrol(pipe) (usb_pipetype((pipe)) == PIPE_CONTROL)
-#define usb_pipebulk(pipe) (usb_pipetype((pipe)) == PIPE_BULK)
-
-#define usb_pipe_ep_index(pipe) \
- usb_pipecontrol(pipe) ? (usb_pipeendpoint(pipe) * 2) : \
- ((usb_pipeendpoint(pipe) * 2) - \
- (usb_pipein(pipe) ? 0 : 1))
-
-/*
- * As of USB 2.0, full/low speed devices are segregated into trees.
- * One type grows from USB 1.1 host controllers (OHCI, UHCI etc).
- * The other type grows from high speed hubs when they connect to
- * full/low speed devices using "Transaction Translators" (TTs).
- */
-struct usb_tt {
- bool multi; /* true means one TT per port */
- unsigned think_time; /* think time in ns */
-};
-
-/*************************************************************************
- * Hub Stuff
- */
-struct usb_hub_device {
- struct usb_device *pusb_dev;
- struct usb_hub_descriptor desc;
- uint64_t connect_timeout; /* Device connection timeout in ns */
- uint64_t query_delay; /* Device query delay in ns */
- int overcurrent_count[USB_MAXCHILDREN]; /* Over-current counter */
- struct usb_tt tt; /* Transaction Translator */
-};
-
-/**
- * struct usb_device_id - identifies USB devices for probing and hotplugging
- * @match_flags: Bit mask controlling of the other fields are used to match
- * against new devices. Any field except for driver_info may be used,
- * although some only make sense in conjunction with other fields.
- * This is usually set by a USB_DEVICE_*() macro, which sets all
- * other fields in this structure except for driver_info.
- * @idVendor: USB vendor ID for a device; numbers are assigned
- * by the USB forum to its members.
- * @idProduct: Vendor-assigned product ID.
- * @bcdDevice_lo: Low end of range of vendor-assigned product version numbers.
- * This is also used to identify individual product versions, for
- * a range consisting of a single device.
- * @bcdDevice_hi: High end of version number range. The range of product
- * versions is inclusive.
- * @bDeviceClass: Class of device; numbers are assigned
- * by the USB forum. Products may choose to implement classes,
- * or be vendor-specific. Device classes specify behavior of all
- * the interfaces on a devices.
- * @bDeviceSubClass: Subclass of device; associated with bDeviceClass.
- * @bDeviceProtocol: Protocol of device; associated with bDeviceClass.
- * @bInterfaceClass: Class of interface; numbers are assigned
- * by the USB forum. Products may choose to implement classes,
- * or be vendor-specific. Interface classes specify behavior only
- * of a given interface; other interfaces may support other classes.
- * @bInterfaceSubClass: Subclass of interface; associated with bInterfaceClass.
- * @bInterfaceProtocol: Protocol of interface; associated with bInterfaceClass.
- * @driver_info: Holds information used by the driver. Usually it holds
- * a pointer to a descriptor understood by the driver, or perhaps
- * device flags.
- *
- * In most cases, drivers will create a table of device IDs by using
- * USB_DEVICE(), or similar macros designed for that purpose.
- * They will then export it to userspace using MODULE_DEVICE_TABLE(),
- * and provide it to the USB core through their usb_driver structure.
- *
- * See the usb_match_id() function for information about how matches are
- * performed. Briefly, you will normally use one of several macros to help
- * construct these entries. Each entry you provide will either identify
- * one or more specific products, or will identify a class of products
- * which have agreed to behave the same. You should put the more specific
- * matches towards the beginning of your table, so that driver_info can
- * record quirks of specific products.
- */
-struct usb_device_id {
- /* which fields to match against? */
- __u16 match_flags;
-
- /* Used for product specific matches; range is inclusive */
- __u16 idVendor;
- __u16 idProduct;
- __u16 bcdDevice_lo;
- __u16 bcdDevice_hi;
-
- /* Used for device class matches */
- __u8 bDeviceClass;
- __u8 bDeviceSubClass;
- __u8 bDeviceProtocol;
-
- /* Used for interface class matches */
- __u8 bInterfaceClass;
- __u8 bInterfaceSubClass;
- __u8 bInterfaceProtocol;
-
- const void *driver_info;
-};
-
-#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
-#define USB_DEVICE_ID_MATCH_VENDOR 0x0001
-#define USB_DEVICE_ID_MATCH_DEVICE \
- (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
-#define USB_DEVICE_ID_MATCH_INT_CLASS 0x0080
-#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
-#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
-#define USB_DEVICE_ID_MATCH_INT_INFO \
- (USB_DEVICE_ID_MATCH_INT_CLASS | \
- USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
- USB_DEVICE_ID_MATCH_INT_PROTOCOL)
-
-/**
- * USB_DEVICE - macro used to describe a specific usb device
- * @vend: the 16 bit USB Vendor ID
- * @prod: the 16 bit USB Product ID
- *
- * This macro is used to create a struct usb_device_id that matches a
- * specific device.
- */
-#define USB_DEVICE(vend,prod) \
- .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
- .idVendor = (vend), \
- .idProduct = (prod)
-
-/**
- * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
- * @cl: bInterfaceClass value
- * @sc: bInterfaceSubClass value
- * @pr: bInterfaceProtocol value
- *
- * This macro is used to create a struct usb_device_id that matches a
- * specific class of interfaces.
- */
-#define USB_INTERFACE_INFO(cl, sc, pr) \
- .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \
- .bInterfaceClass = (cl), \
- .bInterfaceSubClass = (sc), \
- .bInterfaceProtocol = (pr)
-
-#define USB_CTRL_SET_TIMEOUT 5000
-#define USB_CTRL_GET_TIMEOUT 5000
-
-enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np,
- const char *propname);
-
-enum usb_dr_mode {
- USB_DR_MODE_UNKNOWN,
- USB_DR_MODE_HOST,
- USB_DR_MODE_PERIPHERAL,
- USB_DR_MODE_OTG,
-};
-
-enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np,
- const char *propname);
-
-enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np,
- const char *propname);
-
-int usb_register_otg_device(struct device *parent,
- int (*set_mode)(void *ctx, enum usb_dr_mode mode), void *ctx);
-
-extern struct list_head usb_device_list;
-
-bool usb_hub_is_root_hub(struct usb_device *hdev);
-
-#ifdef CONFIG_USB_ONBOARD_HUB
-void of_usb_host_probe_hubs(struct usb_host *host);
-#else
-static inline void of_usb_host_probe_hubs(struct usb_host *host)
-{
-}
-#endif
-
-#endif /*_USB_H_ */
diff --git a/include/usb/usb_defs.h b/include/usb/usb_defs.h
deleted file mode 100644
index 731bc51c76..0000000000
--- a/include/usb/usb_defs.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * (C) Copyright 2001
- * Denis Peter, MPL AG Switzerland
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that 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.
- *
- *
- * Note: Part of this code has been derived from linux
- *
- */
-#ifndef _USB_DEFS_H_
-#define _USB_DEFS_H_
-
-/* USB constants */
-
-/* some HID sub classes */
-#define USB_SUB_HID_NONE 0
-#define USB_SUB_HID_BOOT 1
-
-/* some UID Protocols */
-#define USB_PROT_HID_NONE 0
-#define USB_PROT_HID_KEYBOARD 1
-#define USB_PROT_HID_MOUSE 2
-
-
-/* Sub STORAGE Classes */
-#define US_SC_RBC 1 /* Typically, flash devices */
-#define US_SC_8020 2 /* CD-ROM */
-#define US_SC_QIC 3 /* QIC-157 Tapes */
-#define US_SC_UFI 4 /* Floppy */
-#define US_SC_8070 5 /* Removable media */
-#define US_SC_SCSI 6 /* Transparent */
-#define US_SC_MIN US_SC_RBC
-#define US_SC_MAX US_SC_SCSI
-
-/* STORAGE Protocols */
-#define US_PR_CB 1 /* Control/Bulk w/o interrupt */
-#define US_PR_CBI 0 /* Control/Bulk/Interrupt */
-#define US_PR_BULK 0x50 /* bulk only */
-
-/* Descriptor types */
-#define USB_DT_HID (USB_TYPE_CLASS | 0x01)
-#define USB_DT_REPORT (USB_TYPE_CLASS | 0x02)
-#define USB_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
-
-/* Descriptor sizes per descriptor type */
-#define USB_DT_HID_SIZE 9
-
-/* USB Packet IDs (PIDs) */
-#define USB_PID_UNDEF_0 0xf0
-#define USB_PID_OUT 0xe1
-#define USB_PID_ACK 0xd2
-#define USB_PID_DATA0 0xc3
-#define USB_PID_UNDEF_4 0xb4
-#define USB_PID_SOF 0xa5
-#define USB_PID_UNDEF_6 0x96
-#define USB_PID_UNDEF_7 0x87
-#define USB_PID_UNDEF_8 0x78
-#define USB_PID_IN 0x69
-#define USB_PID_NAK 0x5a
-#define USB_PID_DATA1 0x4b
-#define USB_PID_PREAMBLE 0x3c
-#define USB_PID_SETUP 0x2d
-#define USB_PID_STALL 0x1e
-#define USB_PID_UNDEF_F 0x0f
-
-/* HID requests */
-#define USB_REQ_GET_REPORT 0x01
-#define USB_REQ_GET_IDLE 0x02
-#define USB_REQ_GET_PROTOCOL 0x03
-#define USB_REQ_SET_REPORT 0x09
-#define USB_REQ_SET_IDLE 0x0A
-#define USB_REQ_SET_PROTOCOL 0x0B
-
-
-/* "pipe" definitions */
-
-#define PIPE_ISOCHRONOUS 0
-#define PIPE_INTERRUPT 1
-#define PIPE_CONTROL 2
-#define PIPE_BULK 3
-#define PIPE_DEVEP_MASK 0x0007ff00
-
-#define USB_ISOCHRONOUS 0
-#define USB_INTERRUPT 1
-#define USB_CONTROL 2
-#define USB_BULK 3
-
-/* USB-status codes: */
-#define USB_ST_ACTIVE 0x1 /* TD is active */
-#define USB_ST_STALLED 0x2 /* TD is stalled */
-#define USB_ST_BUF_ERR 0x4 /* buffer error */
-#define USB_ST_BABBLE_DET 0x8 /* Babble detected */
-#define USB_ST_NAK_REC 0x10 /* NAK Received*/
-#define USB_ST_CRC_ERR 0x20 /* CRC/timeout Error */
-#define USB_ST_BIT_ERR 0x40 /* Bitstuff error */
-#define USB_ST_NOT_PROC 0x80000000L /* Not yet processed */
-
-
-/*************************************************************************
- * Hub defines
- */
-
-/*
- * Port feature numbers
- */
-#define USB_PORT_FEAT_HIGHSPEED 10
-
-/* wPortStatus bits */
-#define USB_PORT_STAT_SPEED \
- (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)
-
-/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
-#define DeviceRequest \
- ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
-
-#define DeviceOutRequest \
- ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE) << 8)
-
-#define InterfaceRequest \
- ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
-
-#define EndpointRequest \
- ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
-
-#define EndpointOutRequest \
- ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8)
-
-/* class requests from the USB 2.0 hub spec, table 11-15 */
-/* GetBusState and SetHubDescriptor are optional, omitted */
-#define ClearHubFeature (0x2000 | USB_REQ_CLEAR_FEATURE)
-#define ClearPortFeature (0x2300 | USB_REQ_CLEAR_FEATURE)
-#define GetHubDescriptor (0xa000 | USB_REQ_GET_DESCRIPTOR)
-#define GetHubStatus (0xa000 | USB_REQ_GET_STATUS)
-#define GetPortStatus (0xa300 | USB_REQ_GET_STATUS)
-#define SetHubFeature (0x2000 | USB_REQ_SET_FEATURE)
-#define SetPortFeature (0x2300 | USB_REQ_SET_FEATURE)
-
-#define USB_PORT_STAT_SUPER_SPEED 0x0600 /* faking support to XHCI */
-#define USB_PORT_STAT_SPEED_MASK (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)
-
-#endif /*_USB_DEFS_H_ */
diff --git a/include/usb/usbnet.h b/include/usb/usbnet.h
deleted file mode 100644
index 450db47b40..0000000000
--- a/include/usb/usbnet.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * USB Networking Link Interface
- *
- * Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net>
- * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that 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.
- *
- */
-
-#ifndef __LINUX_USB_USBNET_H
-#define __LINUX_USB_USBNET_H
-
-#include <net.h>
-#include <linux/phy.h>
-
-/* interface from usbnet core to each USB networking link we handle */
-struct usbnet {
- /* housekeeping */
- struct usb_device *udev;
- struct usb_interface *intf;
- struct driver_info *driver_info;
- const char *driver_name;
- void *driver_priv;
-
- /* i/o info: pipes etc */
- unsigned in, out, status;
- unsigned maxpacket;
-
- /* protocol/interface state */
- struct eth_device edev;
- struct mii_bus miibus;
- int phy_addr;
-
- int msg_enable;
- unsigned long data [5];
- u32 xid;
- u32 hard_mtu; /* count any extra framing */
- size_t rx_urb_size; /* size for rx urbs */
- void *rx_buf;
- void *tx_buf;
-
- unsigned long flags;
-# define EVENT_TX_HALT 0
-# define EVENT_RX_HALT 1
-# define EVENT_RX_MEMORY 2
-# define EVENT_STS_SPLIT 3
-# define EVENT_LINK_RESET 4
-};
-
-#if 0
-static inline struct usb_driver *driver_of(struct usb_interface *intf)
-{
- return to_usb_driver(intf->dev.driver);
-}
-#endif
-
-/* interface from the device/framing level "minidriver" to core */
-struct driver_info {
- char *description;
-
- int flags;
-/* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */
-#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
-#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */
-#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
-#define FLAG_FRAMING_RN 0x0008 /* RNDIS batches, plus huge header */
-
-#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
-#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
-
-#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
-#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
-
-
- /* init device ... can sleep, or cause probe() failure */
- int (*bind)(struct usbnet *);
-
- /* cleanup device ... can sleep, but can't fail */
- void (*unbind)(struct usbnet *);
-
- /* reset device ... can sleep */
- int (*reset)(struct usbnet *);
-
- /* see if peer is connected ... can sleep */
- int (*check_connect)(struct usbnet *);
-
- /* for status polling */
-// void (*status)(struct usbnet *, struct urb *);
-
- /* link reset handling, called from defer_kevent */
- int (*link_reset)(struct usbnet *);
-
- /* fixup rx packet (strip framing) */
- int (*rx_fixup)(struct usbnet *dev, void *buf, int len);
-
- int (*tx_fixup)(struct usbnet *dev, void *buf, int len, void *nbuf, int *nlen);
-
- /* early initialization code, can sleep. This is for minidrivers
- * having 'subminidrivers' that need to do extra initialization
- * right after minidriver have initialized hardware. */
- int (*early_init)(struct usbnet *dev);
-
- /* called by minidriver when link state changes, state: 0=disconnect,
- * 1=connect */
- void (*link_change)(struct usbnet *dev, int state);
-
- /* for new devices, use the descriptor-reading code instead */
- int in; /* rx endpoint */
- int out; /* tx endpoint */
-
- unsigned long data; /* Misc driver specific data */
-};
-
-/* Minidrivers are just drivers using the "usbnet" core as a powerful
- * network-specific subroutine library ... that happens to do pretty
- * much everything except custom framing and chip-specific stuff.
- */
-extern int usbnet_probe(struct usb_device *, const struct usb_device_id *);
-extern void usbnet_disconnect(struct usb_device *);
-
-
-/* Drivers that reuse some of the standard USB CDC infrastructure
- * (notably, using multiple interfaces according to the CDC
- * union descriptor) get some helper code.
- */
-struct cdc_state {
- struct usb_cdc_header_desc *header;
- struct usb_cdc_union_desc *u;
- struct usb_cdc_ether_desc *ether;
- struct usb_interface *control;
- struct usb_interface *data;
-};
-
-extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_device *);
-extern void usbnet_cdc_unbind (struct usbnet *, struct usb_device *);
-
-/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
-#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
- |USB_CDC_PACKET_TYPE_ALL_MULTICAST \
- |USB_CDC_PACKET_TYPE_PROMISCUOUS \
- |USB_CDC_PACKET_TYPE_DIRECTED)
-
-
-/* we record the state for each of our queued skbs */
-enum skb_state {
- illegal = 0,
- tx_start, tx_done,
- rx_start, rx_done, rx_cleanup
-};
-
-struct skb_data { /* skb->cb is one of these */
- struct urb *urb;
- struct usbnet *dev;
- enum skb_state state;
- size_t length;
-};
-
-
-extern int usbnet_get_endpoints(struct usbnet *dev);
-#if 0
-extern void usbnet_defer_kevent (struct usbnet *, int);
-extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
-extern void usbnet_unlink_rx_urbs(struct usbnet *);
-
-extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
-extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
-extern u32 usbnet_get_link (struct net_device *net);
-extern u32 usbnet_get_msglevel (struct net_device *);
-extern void usbnet_set_msglevel (struct net_device *, u32);
-extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
-extern int usbnet_nway_reset(struct net_device *net);
-#endif
-
-#endif /* __LINUX_USB_USBNET_H */
diff --git a/include/usb/usbroothubdes.h b/include/usb/usbroothubdes.h
deleted file mode 100644
index e743555d8e..0000000000
--- a/include/usb/usbroothubdes.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * USB virtual root hub descriptors
- *
- * (C) Copyright 2014
- * Stephen Warren swarren@wwwdotorg.org
- *
- * Based on ohci-hcd.c
- */
-
-#ifndef __USBROOTHUBDES_H__
-#define __USBROOTHUBDES_H__
-
-/* Device descriptor */
-static __u8 root_hub_dev_des[] = {
- 0x12, /* __u8 bLength; */
- 0x01, /* __u8 bDescriptorType; Device */
- 0x10, /* __u16 bcdUSB; v1.1 */
- 0x01,
- 0x09, /* __u8 bDeviceClass; HUB_CLASSCODE */
- 0x00, /* __u8 bDeviceSubClass; */
- 0x00, /* __u8 bDeviceProtocol; */
- 0x08, /* __u8 bMaxPacketSize0; 8 Bytes */
- 0x00, /* __u16 idVendor; */
- 0x00,
- 0x00, /* __u16 idProduct; */
- 0x00,
- 0x00, /* __u16 bcdDevice; */
- 0x00,
- 0x00, /* __u8 iManufacturer; */
- 0x01, /* __u8 iProduct; */
- 0x00, /* __u8 iSerialNumber; */
- 0x01, /* __u8 bNumConfigurations; */
-};
-
-/* Configuration descriptor */
-static __u8 root_hub_config_des[] = {
- 0x09, /* __u8 bLength; */
- 0x02, /* __u8 bDescriptorType; Configuration */
- 0x19, /* __u16 wTotalLength; */
- 0x00,
- 0x01, /* __u8 bNumInterfaces; */
- 0x01, /* __u8 bConfigurationValue; */
- 0x00, /* __u8 iConfiguration; */
- 0x40, /* __u8 bmAttributes;
- * Bit 7: Bus-powered
- * 6: Self-powered,
- * 5 Remote-wakwup,
- * 4..0: resvd
- */
- 0x00, /* __u8 MaxPower; */
- /* interface */
- 0x09, /* __u8 if_bLength; */
- 0x04, /* __u8 if_bDescriptorType; Interface */
- 0x00, /* __u8 if_bInterfaceNumber; */
- 0x00, /* __u8 if_bAlternateSetting; */
- 0x01, /* __u8 if_bNumEndpoints; */
- 0x09, /* __u8 if_bInterfaceClass; HUB_CLASSCODE */
- 0x00, /* __u8 if_bInterfaceSubClass; */
- 0x00, /* __u8 if_bInterfaceProtocol; */
- 0x00, /* __u8 if_iInterface; */
- /* endpoint */
- 0x07, /* __u8 ep_bLength; */
- 0x05, /* __u8 ep_bDescriptorType; Endpoint */
- 0x81, /* __u8 ep_bEndpointAddress; IN Endpoint 1 */
- 0x03, /* __u8 ep_bmAttributes; Interrupt */
- 0x02, /* __u16 ep_wMaxPacketSize; ((MAX_ROOT_PORTS + 1) / 8 */
- 0x00,
- 0xff, /* __u8 ep_bInterval; 255 ms */
-};
-
-#ifdef WANT_USB_ROOT_HUB_HUB_DES
-static unsigned char root_hub_hub_des[] = {
- 0x09, /* __u8 bLength; */
- 0x29, /* __u8 bDescriptorType; Hub-descriptor */
- 0x02, /* __u8 bNbrPorts; */
- 0x00, /* __u16 wHubCharacteristics; */
- 0x00,
- 0x01, /* __u8 bPwrOn2pwrGood; 2ms */
- 0x00, /* __u8 bHubContrCurrent; 0 mA */
- 0x00, /* __u8 DeviceRemovable; *** 7 Ports max *** */
- 0xff, /* __u8 PortPwrCtrlMask; *** 7 ports max *** */
-};
-#endif
-
-static unsigned char root_hub_str_index0[] = {
- 0x04, /* __u8 bLength; */
- 0x03, /* __u8 bDescriptorType; String-descriptor */
- 0x09, /* __u8 lang ID */
- 0x04, /* __u8 lang ID */
-};
-
-static unsigned char root_hub_str_index1[] = {
- 32, /* __u8 bLength; */
- 0x03, /* __u8 bDescriptorType; String-descriptor */
- 'U', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- '-', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'B', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'o', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'o', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 't', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- ' ', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'R', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'o', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'o', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 't', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- ' ', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'H', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'u', /* __u8 Unicode */
- 0, /* __u8 Unicode */
- 'b', /* __u8 Unicode */
- 0, /* __u8 Unicode */
-};
-
-#endif
diff --git a/include/usb/usbserial.h b/include/usb/usbserial.h
deleted file mode 100644
index e1375c489a..0000000000
--- a/include/usb/usbserial.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#ifndef _USB_SERIAL_H
-#define _USB_SERIAL_H
-
-struct usb_serial_pdata {
- bool acm;
-};
-
-int usb_serial_register(struct usb_serial_pdata *pdata);
-void usb_serial_unregister(void);
-
-#endif /* _USB_SERIAL_H */
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
deleted file mode 100644
index b1ad0185b9..0000000000
--- a/include/usb/xhci.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * xHCI host controller driver
- *
- * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
- *
- * Some code borrowed from the Linux xHCI driver
- * Author: Sarah Sharp
- * Copyright (C) 2008 Intel Corp.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __XHCI_HCD_H
-#define __XHCI_HCD_H
-
-#endif