0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __DRIVERS_USB_CHIPIDEA_UDC_H
0011 #define __DRIVERS_USB_CHIPIDEA_UDC_H
0012
0013 #include <linux/list.h>
0014
0015 #define CTRL_PAYLOAD_MAX 64
0016 #define RX 0
0017 #define TX 1
0018
0019
0020 struct ci_hw_td {
0021
0022 __le32 next;
0023 #define TD_TERMINATE BIT(0)
0024 #define TD_ADDR_MASK (0xFFFFFFEUL << 5)
0025
0026 __le32 token;
0027 #define TD_STATUS (0x00FFUL << 0)
0028 #define TD_STATUS_TR_ERR BIT(3)
0029 #define TD_STATUS_DT_ERR BIT(5)
0030 #define TD_STATUS_HALTED BIT(6)
0031 #define TD_STATUS_ACTIVE BIT(7)
0032 #define TD_MULTO (0x0003UL << 10)
0033 #define TD_IOC BIT(15)
0034 #define TD_TOTAL_BYTES (0x7FFFUL << 16)
0035
0036 __le32 page[5];
0037 #define TD_CURR_OFFSET (0x0FFFUL << 0)
0038 #define TD_FRAME_NUM (0x07FFUL << 0)
0039 #define TD_RESERVED_MASK (0x0FFFUL << 0)
0040 } __attribute__ ((packed, aligned(4)));
0041
0042
0043 struct ci_hw_qh {
0044
0045 __le32 cap;
0046 #define QH_IOS BIT(15)
0047 #define QH_MAX_PKT (0x07FFUL << 16)
0048 #define QH_ZLT BIT(29)
0049 #define QH_MULT (0x0003UL << 30)
0050 #define QH_ISO_MULT(x) ((x >> 11) & 0x03)
0051
0052 __le32 curr;
0053
0054 struct ci_hw_td td;
0055
0056 __le32 RESERVED;
0057 struct usb_ctrlrequest setup;
0058 } __attribute__ ((packed, aligned(4)));
0059
0060 struct td_node {
0061 struct list_head td;
0062 dma_addr_t dma;
0063 struct ci_hw_td *ptr;
0064 int td_remaining_size;
0065 };
0066
0067
0068
0069
0070
0071
0072
0073 struct ci_hw_req {
0074 struct usb_request req;
0075 struct list_head queue;
0076 struct list_head tds;
0077 };
0078
0079 #ifdef CONFIG_USB_CHIPIDEA_UDC
0080
0081 int ci_hdrc_gadget_init(struct ci_hdrc *ci);
0082 void ci_hdrc_gadget_destroy(struct ci_hdrc *ci);
0083
0084 #else
0085
0086 static inline int ci_hdrc_gadget_init(struct ci_hdrc *ci)
0087 {
0088 return -ENXIO;
0089 }
0090
0091 static inline void ci_hdrc_gadget_destroy(struct ci_hdrc *ci)
0092 {
0093
0094 }
0095
0096 #endif
0097
0098 #endif