39 #ifndef __DRIVERS_USB_DWC3_GADGET_H
40 #define __DRIVERS_USB_DWC3_GADGET_H
42 #include <linux/list.h>
47 #define to_dwc3_ep(ep) (container_of(ep, struct dwc3_ep, endpoint))
48 #define gadget_to_dwc(g) (container_of(g, struct dwc3, gadget))
51 #define DWC3_DEPCFG_INT_NUM(n) ((n) << 0)
52 #define DWC3_DEPCFG_XFER_COMPLETE_EN (1 << 8)
53 #define DWC3_DEPCFG_XFER_IN_PROGRESS_EN (1 << 9)
54 #define DWC3_DEPCFG_XFER_NOT_READY_EN (1 << 10)
55 #define DWC3_DEPCFG_FIFO_ERROR_EN (1 << 11)
56 #define DWC3_DEPCFG_STREAM_EVENT_EN (1 << 13)
57 #define DWC3_DEPCFG_BINTERVAL_M1(n) ((n) << 16)
58 #define DWC3_DEPCFG_STREAM_CAPABLE (1 << 24)
59 #define DWC3_DEPCFG_EP_NUMBER(n) ((n) << 25)
60 #define DWC3_DEPCFG_BULK_BASED (1 << 30)
61 #define DWC3_DEPCFG_FIFO_BASED (1 << 31)
64 #define DWC3_DEPCFG_EP_TYPE(n) ((n) << 1)
65 #define DWC3_DEPCFG_MAX_PACKET_SIZE(n) ((n) << 3)
66 #define DWC3_DEPCFG_FIFO_NUMBER(n) ((n) << 17)
67 #define DWC3_DEPCFG_BURST_SIZE(n) ((n) << 22)
68 #define DWC3_DEPCFG_DATA_SEQ_NUM(n) ((n) << 26)
70 #define DWC3_DEPCFG_IGN_SEQ_NUM (1 << 31)
72 #define DWC3_DEPCFG_ACTION_INIT (0 << 30)
73 #define DWC3_DEPCFG_ACTION_RESTORE (1 << 30)
74 #define DWC3_DEPCFG_ACTION_MODIFY (2 << 30)
77 #define DWC3_DEPXFERCFG_NUM_XFER_RES(n) ((n) & 0xffff)
87 #define to_dwc3_request(r) (container_of(r, struct dwc3_request, request))
97 static inline void dwc3_gadget_move_request_queued(
struct dwc3_request *
req)
142 static inline const char *dwc3_gadget_event_string(
u8 event)
150 return "Connection Done";
152 return "Link Status Change";
156 return "End-Of-Frame";
158 return "Start-Of-Frame";
160 return "Erratic Error";
162 return "Command Complete";
174 static inline const char *dwc3_ep_event_string(
u8 event)
178 return "Transfer Complete";
180 return "Transfer In-Progress";
182 return "Transfer Not Ready";
188 return "Endpoint Command Complete";