aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/ch9.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/ch9.h')
-rw-r--r--include/linux/usb/ch9.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 0fd3fbdd8283..d5da6c68c250 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -34,6 +34,7 @@
34#define __LINUX_USB_CH9_H 34#define __LINUX_USB_CH9_H
35 35
36#include <linux/types.h> /* __u8 etc */ 36#include <linux/types.h> /* __u8 etc */
37#include <asm/byteorder.h> /* le16_to_cpu */
37 38
38/*-------------------------------------------------------------------------*/ 39/*-------------------------------------------------------------------------*/
39 40
@@ -143,6 +144,11 @@
143#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */ 144#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
144 145
145#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 146#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
147/*
148 * Suspend Options, Table 9-7 USB 3.0 spec
149 */
150#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
151#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
146 152
147#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */ 153#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
148 154
@@ -377,12 +383,6 @@ struct usb_endpoint_descriptor {
377#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */ 383#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
378#define USB_ENDPOINT_DIR_MASK 0x80 384#define USB_ENDPOINT_DIR_MASK 0x80
379 385
380#define USB_ENDPOINT_SYNCTYPE 0x0c
381#define USB_ENDPOINT_SYNC_NONE (0 << 2)
382#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
383#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
384#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
385
386#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ 386#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
387#define USB_ENDPOINT_XFER_CONTROL 0 387#define USB_ENDPOINT_XFER_CONTROL 0
388#define USB_ENDPOINT_XFER_ISOC 1 388#define USB_ENDPOINT_XFER_ISOC 1
@@ -390,6 +390,17 @@ struct usb_endpoint_descriptor {
390#define USB_ENDPOINT_XFER_INT 3 390#define USB_ENDPOINT_XFER_INT 3
391#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 391#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
392 392
393#define USB_ENDPOINT_SYNCTYPE 0x0c
394#define USB_ENDPOINT_SYNC_NONE (0 << 2)
395#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
396#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
397#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
398
399#define USB_ENDPOINT_USAGE_MASK 0x30
400#define USB_ENDPOINT_USAGE_DATA 0x00
401#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
402#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
403
393/*-------------------------------------------------------------------------*/ 404/*-------------------------------------------------------------------------*/
394 405
395/** 406/**
@@ -570,6 +581,17 @@ static inline int usb_endpoint_is_isoc_out(
570 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd); 581 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
571} 582}
572 583
584/**
585 * usb_endpoint_maxp - get endpoint's max packet size
586 * @epd: endpoint to be checked
587 *
588 * Returns @epd's max packet
589 */
590static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
591{
592 return le16_to_cpu(epd->wMaxPacketSize);
593}
594
573/*-------------------------------------------------------------------------*/ 595/*-------------------------------------------------------------------------*/
574 596
575/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ 597/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
@@ -851,6 +873,18 @@ enum usb_device_speed {
851 USB_SPEED_SUPER, /* usb 3.0 */ 873 USB_SPEED_SUPER, /* usb 3.0 */
852}; 874};
853 875
876#ifdef __KERNEL__
877
878/**
879 * usb_speed_string() - Returns human readable-name of the speed.
880 * @speed: The speed to return human-readable name for. If it's not
881 * any of the speeds defined in usb_device_speed enum, string for
882 * USB_SPEED_UNKNOWN will be returned.
883 */
884extern const char *usb_speed_string(enum usb_device_speed speed);
885
886#endif
887
854enum usb_device_state { 888enum usb_device_state {
855 /* NOTATTACHED isn't in the USB spec, and this state acts 889 /* NOTATTACHED isn't in the USB spec, and this state acts
856 * the same as ATTACHED ... but it's clearer this way. 890 * the same as ATTACHED ... but it's clearer this way.