summaryrefslogtreecommitdiffstats
path: root/include/usb
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-04-16 18:40:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-04-16 18:40:51 +0200
commitf079a386bfb4991d71798e92b44a19c6f4f7493e (patch)
treeb063fb08483c99024b23fcbed282d96711a26e17 /include/usb
parenta1f5e9f895c704f068cf038bc05cbac6f7c9f310 (diff)
parent105b2eabd55aa0d6f548ce29e487c9dd98836ec5 (diff)
downloadbarebox-f079a386bfb4991d71798e92b44a19c6f4f7493e.tar.gz
barebox-f079a386bfb4991d71798e92b44a19c6f4f7493e.tar.xz
Merge branch 'for-next/usb'
Diffstat (limited to 'include/usb')
-rw-r--r--include/usb/ch9.h20
-rw-r--r--include/usb/usb.h34
-rw-r--r--include/usb/usb_defs.h3
-rw-r--r--include/usb/usbnet.h2
-rw-r--r--include/usb/xhci.h6
5 files changed, 58 insertions, 7 deletions
diff --git a/include/usb/ch9.h b/include/usb/ch9.h
index 85f3e64cac..2e06dd89fd 100644
--- a/include/usb/ch9.h
+++ b/include/usb/ch9.h
@@ -400,6 +400,12 @@ struct usb_endpoint_descriptor {
#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)
@@ -607,6 +613,20 @@ 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)
{
diff --git a/include/usb/usb.h b/include/usb/usb.h
index 8225f6af09..82a4736445 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -66,6 +66,12 @@ struct usb_interface {
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 {
@@ -108,6 +114,7 @@ struct usb_device {
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];
@@ -118,6 +125,9 @@ struct usb_device {
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;
@@ -146,6 +156,10 @@ struct usb_host {
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;
@@ -306,6 +320,21 @@ void usb_rescan(void);
#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
@@ -316,6 +345,7 @@ struct usb_hub_device {
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 */
};
/**
@@ -382,7 +412,7 @@ struct usb_device_id {
__u8 bInterfaceSubClass;
__u8 bInterfaceProtocol;
- void *driver_info;
+ const void *driver_info;
};
#define USB_DEVICE_ID_MATCH_PRODUCT 0x0002
@@ -449,4 +479,6 @@ int usb_register_otg_device(struct device_d *parent,
extern struct list_head usb_device_list;
+bool usb_hub_is_root_hub(struct usb_device *hdev);
+
#endif /*_USB_H_ */
diff --git a/include/usb/usb_defs.h b/include/usb/usb_defs.h
index 8e32379c63..cfde278a33 100644
--- a/include/usb/usb_defs.h
+++ b/include/usb/usb_defs.h
@@ -147,4 +147,7 @@
#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
index 386c2164bd..450db47b40 100644
--- a/include/usb/usbnet.h
+++ b/include/usb/usbnet.h
@@ -45,6 +45,8 @@ struct usbnet {
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
diff --git a/include/usb/xhci.h b/include/usb/xhci.h
index 1a3138b132..b1ad0185b9 100644
--- a/include/usb/xhci.h
+++ b/include/usb/xhci.h
@@ -24,10 +24,4 @@
#ifndef __XHCI_HCD_H
#define __XHCI_HCD_H
-struct xhci_data {
- void __iomem *regs;
-};
-
-int xhci_register(struct device_d *dev, struct xhci_data *data);
-
#endif