浏览代码

usb: gadget: add endpoint capabilities flags

Introduce struct usb_ep_caps which contains information about capabilities
of usb endpoints - supported transfer types and directions. This structure
should be filled by UDC driver for each of its endpoints, and will be
used in epautoconf in new ep matching mechanism which will replace ugly
guessing of endpoint capabilities basing on its name.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Robert Baldyga 10 年之前
父节点
当前提交
734b5a2add
共有 1 个文件被更改,包括 21 次插入0 次删除
  1. 21 0
      include/linux/usb/gadget.h

+ 21 - 0
include/linux/usb/gadget.h

@@ -140,11 +140,30 @@ struct usb_ep_ops {
 	void (*fifo_flush) (struct usb_ep *ep);
 	void (*fifo_flush) (struct usb_ep *ep);
 };
 };
 
 
+/**
+ * struct usb_ep_caps - endpoint capabilities description
+ * @type_control:Endpoint supports control type (reserved for ep0).
+ * @type_iso:Endpoint supports isochronous transfers.
+ * @type_bulk:Endpoint supports bulk transfers.
+ * @type_int:Endpoint supports interrupt transfers.
+ * @dir_in:Endpoint supports IN direction.
+ * @dir_out:Endpoint supports OUT direction.
+ */
+struct usb_ep_caps {
+	unsigned type_control:1;
+	unsigned type_iso:1;
+	unsigned type_bulk:1;
+	unsigned type_int:1;
+	unsigned dir_in:1;
+	unsigned dir_out:1;
+};
+
 /**
 /**
  * struct usb_ep - device side representation of USB endpoint
  * struct usb_ep - device side representation of USB endpoint
  * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
  * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk"
  * @ops: Function pointers used to access hardware-specific operations.
  * @ops: Function pointers used to access hardware-specific operations.
  * @ep_list:the gadget's ep_list holds all of its endpoints
  * @ep_list:the gadget's ep_list holds all of its endpoints
+ * @caps:The structure describing types and directions supported by endoint.
  * @maxpacket:The maximum packet size used on this endpoint.  The initial
  * @maxpacket:The maximum packet size used on this endpoint.  The initial
  *	value can sometimes be reduced (hardware allowing), according to
  *	value can sometimes be reduced (hardware allowing), according to
  *      the endpoint descriptor used to configure the endpoint.
  *      the endpoint descriptor used to configure the endpoint.
@@ -167,12 +186,14 @@ struct usb_ep_ops {
  * gadget->ep_list.  the control endpoint (gadget->ep0) is not in that list,
  * gadget->ep_list.  the control endpoint (gadget->ep0) is not in that list,
  * and is accessed only in response to a driver setup() callback.
  * and is accessed only in response to a driver setup() callback.
  */
  */
+
 struct usb_ep {
 struct usb_ep {
 	void			*driver_data;
 	void			*driver_data;
 
 
 	const char		*name;
 	const char		*name;
 	const struct usb_ep_ops	*ops;
 	const struct usb_ep_ops	*ops;
 	struct list_head	ep_list;
 	struct list_head	ep_list;
+	struct usb_ep_caps	caps;
 	bool			claimed;
 	bool			claimed;
 	unsigned		maxpacket:16;
 	unsigned		maxpacket:16;
 	unsigned		maxpacket_limit:16;
 	unsigned		maxpacket_limit:16;