2 ******************************************************************************
6 * @brief usb driver definitions
8 * Copyright (C) ESWIN 2015-2020
10 ******************************************************************************
16 #include "ecrnx_defs.h"
17 #include <linux/usb.h>
19 #define USB_INFAC_DATA 0
20 #define USB_INFAC_MSG 1
22 #define USB_DIR_MASK 0x80
23 #define USB_NUM_MASK 0x7F
25 #define USB_DATA_URB_NUM 64
26 #define USB_MSG_URB_NUM 16
31 #define USB_RX_MAX_BUF_SIZE 4096
33 struct usb_infac_pipe {
36 struct usb_infac_data_t *infac;
38 struct usb_anchor urb_submitted;
39 unsigned int usb_pipe_handle;
40 struct list_head urb_list_head;
41 #ifdef CONFIG_ECRNX_WORKQUEUE
42 struct work_struct io_complete_work;
44 #ifdef CONFIG_ECRNX_TASKLET
45 struct tasklet_struct tx_tasklet;
46 struct tasklet_struct rx_tasklet;
48 struct sk_buff_head io_comp_queue;
49 unsigned int err_count;
54 struct usb_infac_data_t {
55 struct usb_interface *interface;
56 struct usb_device *udev;
59 struct usb_infac_pipe pipe_rx;
60 struct usb_infac_pipe pipe_tx;
64 struct eswin * p_eswin;
66 struct usb_infac_data_t infac_data;
67 struct usb_infac_data_t infac_msg;
68 #ifdef CONFIG_ECRNX_KTHREAD
69 struct task_struct *kthread_tx_comp;
70 struct task_struct *kthread_rx_comp;
72 wait_queue_head_t wait_tx_comp;
73 wait_queue_head_t wait_rx_comp;
79 struct usb_urb_context {
80 struct list_head link;
83 struct usb_infac_pipe * pipe;
88 int (*start)(struct eswin *tr);
89 int (*xmit)(struct eswin *tr, struct sk_buff *skb);
90 int (*suspend)(struct eswin *tr);
91 int (*resume)(struct eswin *tr);
92 int (*write)(struct eswin *tr, const void* data, const u32 len);
93 int (*wait_ack)(struct eswin *tr, void* data, const u32 len);
98 extern int ecrnx_usb_register_drv(void);
99 extern void ecrnx_usb_unregister_drv(void);
101 #endif /* __SDIO_H */