2 ******************************************************************************
6 * @brief sdio driver definitions
8 * Copyright (C) ESWIN 2015-2020
10 ******************************************************************************
16 #include "ecrnx_defs.h"
19 #define ESWIN_SDIO_VENDER 0x0296
20 #define ESWIN_SDIO_DEVICE 0x5347
22 #define ESWIN_SDIO_BLK_SIZE 512
27 #define CREDIT_QUEUE_MAX (12)
33 #define CREDIT_AC0 4//(TCN*4+TCNE) /* BK */
34 #define CREDIT_AC1 30//(TCN*3+TCNE) /* BE */
35 #define CREDIT_AC2 4//(TCN*2+TCNE) /* VI */
36 #define CREDIT_AC3 4//(TCN*1+TCNE) /* VO */
41 u16 chip_id; /* 0x2-0x3 */
42 u32 modem_id; /* 0x4-0x7 */
43 u32 sw_id; /* 0x8-0xb */
44 u32 board_id; /* 0xc-0xf */
47 struct sdio_status_reg {
58 #define EIRQ_IO_ENABLE (1<<2)
59 #define EIRQ_EDGE (1<<1)
60 #define EIRQ_ACTIVE_LO (1<<0)
62 #define EIRQ_DEV_SLEEP (1<<3)
63 #define EIRQ_DEV_READY (1<<2)
64 #define EIRQ_RXQ (1<<1)
65 #define EIRQ_TXQ (1<<0)
67 #define TXQ_ERROR (1<<7)
68 #define TXQ_SLOT_COUNT (0x7F)
69 #define RXQ_SLOT_COUNT (0x7F)
73 struct sdio_rx_head_t {
74 unsigned int next_rx_len;
75 unsigned short data_len;
76 unsigned short avl_len;
80 unsigned int credit_vif0;
81 unsigned int credit_vif1;
88 struct sdio_func *func;
89 struct sdio_func *func2;
91 /* work, kthread, ... */
92 struct delayed_work work;
93 struct task_struct *kthread;
94 wait_queue_head_t wait; /* wait queue */
96 struct task_struct *kthread_unpack;
97 wait_queue_head_t wait_unpack;
100 struct sdio_sys_reg sys;
101 struct sdio_status_reg status;
111 /* VIF0(AC0~AC3), BCN, CONC, VIF1(AC0~AC3), padding*/
112 u8 front[CREDIT_QUEUE_MAX];
113 u8 rear[CREDIT_QUEUE_MAX];
114 u8 credit_max[CREDIT_QUEUE_MAX];
117 unsigned long loopback_prev_cnt;
118 unsigned long loopback_total_cnt;
119 unsigned long loopback_last_jiffies;
120 unsigned long loopback_read_usec;
121 unsigned long loopback_write_usec;
122 unsigned long loopback_measure_cnt;
124 //struct eswin_sdio_ops_t *ops;
125 unsigned int recv_len;
126 unsigned int recv_num;
127 // struct dentry *debugfs;
129 unsigned int credit_vif0;
130 unsigned int credit_vif1;
132 struct sdio_data_t sdio_info;
133 unsigned int slave_avl_buf;
134 atomic_t slave_buf_suspend;
135 unsigned int curr_tx_size;
136 unsigned int next_rx_size;
137 // struct sk_buff *skb_tx_last;
139 struct sk_buff_head skb_rx_list;
140 //struct sk_buff_head *skb_rx_unpack_list;
145 int (*start)(struct eswin *tr);
146 int (*xmit)(struct eswin *tr, struct tx_buff_pkg_node * node);
147 int (*suspend)(struct eswin *tr);
148 int (*resume)(struct eswin *tr);
149 int (*write)(struct eswin *tr, const void* data, const u32 len);
150 int (*wait_ack)(struct eswin *tr);
153 extern int ecrnx_sdio_register_drv(void);
154 extern void ecrnx_sdio_unregister_drv(void);
156 #endif /* __SDIO_H */