blob: 8f190c44cb762ecd71af910035d6c928f4a7b74d [file] [log] [blame]
Amitkumar Karward930fae2011-10-11 17:41:21 -07001/* @file mwifiex_pcie.h
2 *
3 * @brief This file contains definitions for PCI-E interface.
4 * driver.
5 *
Xinming Hu65da33f2014-06-19 21:38:57 -07006 * Copyright (C) 2011-2014, Marvell International Ltd.
Amitkumar Karward930fae2011-10-11 17:41:21 -07007 *
8 * This software file (the "File") is distributed by Marvell International
9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
10 * (the "License"). You may use, redistribute and/or modify this File in
11 * accordance with the terms and conditions of the License, a copy of which
12 * is available by writing to the Free Software Foundation, Inc.,
13 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
14 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
15 *
16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
19 * this warranty disclaimer.
20 */
21
22#ifndef _MWIFIEX_PCIE_H
23#define _MWIFIEX_PCIE_H
24
25#include <linux/pci.h>
26#include <linux/pcieport_if.h>
27#include <linux/interrupt.h>
28
Xinming Hu9a862322016-02-02 22:05:05 -080029#include "decl.h"
Amitkumar Karward930fae2011-10-11 17:41:21 -070030#include "main.h"
31
32#define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin"
Avinash Patilca8f2112013-02-08 18:18:09 -080033#define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin"
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -070034#define PCIE8997_DEFAULT_FW_NAME "mrvl/pcie8997_uapsta.bin"
Avinash Patilca8f2112013-02-08 18:18:09 -080035
36#define PCIE_VENDOR_ID_MARVELL (0x11ab)
37#define PCIE_DEVICE_ID_MARVELL_88W8766P (0x2b30)
38#define PCIE_DEVICE_ID_MARVELL_88W8897 (0x2b38)
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -070039#define PCIE_DEVICE_ID_MARVELL_88W8997 (0x2b42)
Amitkumar Karward930fae2011-10-11 17:41:21 -070040
41/* Constants for Buffer Descriptor (BD) rings */
42#define MWIFIEX_MAX_TXRX_BD 0x20
43#define MWIFIEX_TXBD_MASK 0x3F
44#define MWIFIEX_RXBD_MASK 0x3F
45
Avinash Patil2703a662014-09-12 20:08:49 +053046#define MWIFIEX_MAX_EVT_BD 0x08
47#define MWIFIEX_EVTBD_MASK 0x0f
Amitkumar Karward930fae2011-10-11 17:41:21 -070048
49/* PCIE INTERNAL REGISTERS */
50#define PCIE_SCRATCH_0_REG 0xC10
51#define PCIE_SCRATCH_1_REG 0xC14
52#define PCIE_CPU_INT_EVENT 0xC18
53#define PCIE_CPU_INT_STATUS 0xC1C
54#define PCIE_HOST_INT_STATUS 0xC30
55#define PCIE_HOST_INT_MASK 0xC34
56#define PCIE_HOST_INT_STATUS_MASK 0xC3C
57#define PCIE_SCRATCH_2_REG 0xC40
58#define PCIE_SCRATCH_3_REG 0xC44
Bing Zhao428ca8a2012-04-12 19:00:35 -070059#define PCIE_SCRATCH_4_REG 0xCD0
60#define PCIE_SCRATCH_5_REG 0xCD4
61#define PCIE_SCRATCH_6_REG 0xCD8
62#define PCIE_SCRATCH_7_REG 0xCDC
63#define PCIE_SCRATCH_8_REG 0xCE0
64#define PCIE_SCRATCH_9_REG 0xCE4
65#define PCIE_SCRATCH_10_REG 0xCE8
66#define PCIE_SCRATCH_11_REG 0xCEC
67#define PCIE_SCRATCH_12_REG 0xCF0
Avinash Patilca8f2112013-02-08 18:18:09 -080068#define PCIE_RD_DATA_PTR_Q0_Q1 0xC08C
69#define PCIE_WR_DATA_PTR_Q0_Q1 0xC05C
Amitkumar Karward930fae2011-10-11 17:41:21 -070070
71#define CPU_INTR_DNLD_RDY BIT(0)
72#define CPU_INTR_DOOR_BELL BIT(1)
73#define CPU_INTR_SLEEP_CFM_DONE BIT(2)
74#define CPU_INTR_RESET BIT(3)
Avinash Patil2703a662014-09-12 20:08:49 +053075#define CPU_INTR_EVENT_DONE BIT(5)
Amitkumar Karward930fae2011-10-11 17:41:21 -070076
77#define HOST_INTR_DNLD_DONE BIT(0)
78#define HOST_INTR_UPLD_RDY BIT(1)
79#define HOST_INTR_CMD_DONE BIT(2)
80#define HOST_INTR_EVENT_RDY BIT(3)
81#define HOST_INTR_MASK (HOST_INTR_DNLD_DONE | \
82 HOST_INTR_UPLD_RDY | \
83 HOST_INTR_CMD_DONE | \
84 HOST_INTR_EVENT_RDY)
85
86#define MWIFIEX_BD_FLAG_ROLLOVER_IND BIT(7)
87#define MWIFIEX_BD_FLAG_FIRST_DESC BIT(0)
88#define MWIFIEX_BD_FLAG_LAST_DESC BIT(1)
Avinash Patilca8f2112013-02-08 18:18:09 -080089#define MWIFIEX_BD_FLAG_SOP BIT(0)
90#define MWIFIEX_BD_FLAG_EOP BIT(1)
91#define MWIFIEX_BD_FLAG_XS_SOP BIT(2)
92#define MWIFIEX_BD_FLAG_XS_EOP BIT(3)
93#define MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND BIT(7)
94#define MWIFIEX_BD_FLAG_RX_ROLLOVER_IND BIT(10)
95#define MWIFIEX_BD_FLAG_TX_START_PTR BIT(16)
96#define MWIFIEX_BD_FLAG_TX_ROLLOVER_IND BIT(26)
Amitkumar Karward930fae2011-10-11 17:41:21 -070097
98/* Max retry number of command write */
99#define MAX_WRITE_IOMEM_RETRY 2
100/* Define PCIE block size for firmware download */
101#define MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD 256
102/* FW awake cookie after FW ready */
103#define FW_AWAKE_COOKIE (0xAA55AA55)
Avinash Patilc4bc9802014-03-18 22:19:17 -0700104#define MWIFIEX_DEF_SLEEP_COOKIE 0xBEEFBEEF
105#define MWIFIEX_MAX_DELAY_COUNT 5
Amitkumar Karward930fae2011-10-11 17:41:21 -0700106
Avinash Patildd04e6a2013-02-08 18:18:06 -0800107struct mwifiex_pcie_card_reg {
108 u16 cmd_addr_lo;
109 u16 cmd_addr_hi;
110 u16 fw_status;
111 u16 cmd_size;
112 u16 cmdrsp_addr_lo;
113 u16 cmdrsp_addr_hi;
114 u16 tx_rdptr;
115 u16 tx_wrptr;
116 u16 rx_rdptr;
117 u16 rx_wrptr;
118 u16 evt_rdptr;
119 u16 evt_wrptr;
120 u16 drv_rdy;
121 u16 tx_start_ptr;
122 u32 tx_mask;
123 u32 tx_wrap_mask;
124 u32 rx_mask;
125 u32 rx_wrap_mask;
126 u32 tx_rollover_ind;
127 u32 rx_rollover_ind;
128 u32 evt_rollover_ind;
129 u8 ring_flag_sop;
130 u8 ring_flag_eop;
131 u8 ring_flag_xs_sop;
132 u8 ring_flag_xs_eop;
133 u32 ring_tx_start_ptr;
134 u8 pfu_enabled;
Avinash Patil52301a82013-02-12 14:38:32 -0800135 u8 sleep_cookie;
Amitkumar Karwar92c25382014-06-19 21:38:52 -0700136 u16 fw_dump_ctrl;
137 u16 fw_dump_start;
138 u16 fw_dump_end;
Xinming Hu99074fc2016-01-11 02:16:40 -0800139 u8 msix_support;
Avinash Patildd04e6a2013-02-08 18:18:06 -0800140};
141
142static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = {
143 .cmd_addr_lo = PCIE_SCRATCH_0_REG,
144 .cmd_addr_hi = PCIE_SCRATCH_1_REG,
145 .cmd_size = PCIE_SCRATCH_2_REG,
146 .fw_status = PCIE_SCRATCH_3_REG,
147 .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
148 .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
149 .tx_rdptr = PCIE_SCRATCH_6_REG,
150 .tx_wrptr = PCIE_SCRATCH_7_REG,
151 .rx_rdptr = PCIE_SCRATCH_8_REG,
152 .rx_wrptr = PCIE_SCRATCH_9_REG,
153 .evt_rdptr = PCIE_SCRATCH_10_REG,
154 .evt_wrptr = PCIE_SCRATCH_11_REG,
155 .drv_rdy = PCIE_SCRATCH_12_REG,
156 .tx_start_ptr = 0,
157 .tx_mask = MWIFIEX_TXBD_MASK,
158 .tx_wrap_mask = 0,
159 .rx_mask = MWIFIEX_RXBD_MASK,
160 .rx_wrap_mask = 0,
161 .tx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
162 .rx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
163 .evt_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND,
164 .ring_flag_sop = 0,
165 .ring_flag_eop = 0,
166 .ring_flag_xs_sop = 0,
167 .ring_flag_xs_eop = 0,
168 .ring_tx_start_ptr = 0,
169 .pfu_enabled = 0,
Avinash Patil52301a82013-02-12 14:38:32 -0800170 .sleep_cookie = 1,
Xinming Hu99074fc2016-01-11 02:16:40 -0800171 .msix_support = 0,
Avinash Patildd04e6a2013-02-08 18:18:06 -0800172};
173
Avinash Patilca8f2112013-02-08 18:18:09 -0800174static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = {
175 .cmd_addr_lo = PCIE_SCRATCH_0_REG,
176 .cmd_addr_hi = PCIE_SCRATCH_1_REG,
177 .cmd_size = PCIE_SCRATCH_2_REG,
178 .fw_status = PCIE_SCRATCH_3_REG,
179 .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
180 .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
181 .tx_rdptr = PCIE_RD_DATA_PTR_Q0_Q1,
182 .tx_wrptr = PCIE_WR_DATA_PTR_Q0_Q1,
183 .rx_rdptr = PCIE_WR_DATA_PTR_Q0_Q1,
184 .rx_wrptr = PCIE_RD_DATA_PTR_Q0_Q1,
185 .evt_rdptr = PCIE_SCRATCH_10_REG,
186 .evt_wrptr = PCIE_SCRATCH_11_REG,
187 .drv_rdy = PCIE_SCRATCH_12_REG,
188 .tx_start_ptr = 16,
189 .tx_mask = 0x03FF0000,
190 .tx_wrap_mask = 0x07FF0000,
191 .rx_mask = 0x000003FF,
192 .rx_wrap_mask = 0x000007FF,
193 .tx_rollover_ind = MWIFIEX_BD_FLAG_TX_ROLLOVER_IND,
194 .rx_rollover_ind = MWIFIEX_BD_FLAG_RX_ROLLOVER_IND,
195 .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND,
196 .ring_flag_sop = MWIFIEX_BD_FLAG_SOP,
197 .ring_flag_eop = MWIFIEX_BD_FLAG_EOP,
198 .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP,
199 .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP,
200 .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
201 .pfu_enabled = 1,
Avinash Patil52301a82013-02-12 14:38:32 -0800202 .sleep_cookie = 0,
Amitkumar Karwar92c25382014-06-19 21:38:52 -0700203 .fw_dump_ctrl = 0xcf4,
204 .fw_dump_start = 0xcf8,
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700205 .fw_dump_end = 0xcff,
Xinming Hu99074fc2016-01-11 02:16:40 -0800206 .msix_support = 0,
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700207};
208
209static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = {
210 .cmd_addr_lo = PCIE_SCRATCH_0_REG,
211 .cmd_addr_hi = PCIE_SCRATCH_1_REG,
212 .cmd_size = PCIE_SCRATCH_2_REG,
213 .fw_status = PCIE_SCRATCH_3_REG,
214 .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG,
215 .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG,
216 .tx_rdptr = 0xC1A4,
Amitkumar Karwarce0c58d2015-12-16 04:21:43 -0800217 .tx_wrptr = 0xC174,
218 .rx_rdptr = 0xC174,
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700219 .rx_wrptr = 0xC1A4,
220 .evt_rdptr = PCIE_SCRATCH_10_REG,
221 .evt_wrptr = PCIE_SCRATCH_11_REG,
222 .drv_rdy = PCIE_SCRATCH_12_REG,
223 .tx_start_ptr = 16,
224 .tx_mask = 0x0FFF0000,
Amitkumar Karwarce0c58d2015-12-16 04:21:43 -0800225 .tx_wrap_mask = 0x1FFF0000,
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700226 .rx_mask = 0x00000FFF,
Amitkumar Karwarce0c58d2015-12-16 04:21:43 -0800227 .rx_wrap_mask = 0x00001FFF,
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700228 .tx_rollover_ind = BIT(28),
229 .rx_rollover_ind = BIT(12),
230 .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND,
231 .ring_flag_sop = MWIFIEX_BD_FLAG_SOP,
232 .ring_flag_eop = MWIFIEX_BD_FLAG_EOP,
233 .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP,
234 .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP,
235 .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR,
236 .pfu_enabled = 1,
237 .sleep_cookie = 0,
Xinming Hu99074fc2016-01-11 02:16:40 -0800238 .msix_support = 1,
Avinash Patilca8f2112013-02-08 18:18:09 -0800239};
240
Avinash Patildd04e6a2013-02-08 18:18:06 -0800241struct mwifiex_pcie_device {
242 const char *firmware;
243 const struct mwifiex_pcie_card_reg *reg;
244 u16 blksz_fw_dl;
Amitkumar Karwar828cf222014-02-27 19:35:13 -0800245 u16 tx_buf_size;
Avinash Patilb4e8aeb2015-02-11 23:12:26 +0530246 bool can_dump_fw;
Avinash Patil1fe192d2015-01-23 17:09:19 +0530247 bool can_ext_scan;
Avinash Patildd04e6a2013-02-08 18:18:06 -0800248};
249
250static const struct mwifiex_pcie_device mwifiex_pcie8766 = {
251 .firmware = PCIE8766_DEFAULT_FW_NAME,
252 .reg = &mwifiex_reg_8766,
253 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
Amitkumar Karwar828cf222014-02-27 19:35:13 -0800254 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K,
Avinash Patilb4e8aeb2015-02-11 23:12:26 +0530255 .can_dump_fw = false,
Avinash Patil1fe192d2015-01-23 17:09:19 +0530256 .can_ext_scan = true,
Avinash Patildd04e6a2013-02-08 18:18:06 -0800257};
258
Avinash Patilca8f2112013-02-08 18:18:09 -0800259static const struct mwifiex_pcie_device mwifiex_pcie8897 = {
260 .firmware = PCIE8897_DEFAULT_FW_NAME,
261 .reg = &mwifiex_reg_8897,
262 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
Amitkumar Karwar828cf222014-02-27 19:35:13 -0800263 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
Avinash Patilb4e8aeb2015-02-11 23:12:26 +0530264 .can_dump_fw = true,
Avinash Patil1fe192d2015-01-23 17:09:19 +0530265 .can_ext_scan = true,
Avinash Patilca8f2112013-02-08 18:18:09 -0800266};
267
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700268static const struct mwifiex_pcie_device mwifiex_pcie8997 = {
269 .firmware = PCIE8997_DEFAULT_FW_NAME,
270 .reg = &mwifiex_reg_8997,
271 .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD,
272 .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K,
273 .can_dump_fw = false,
274 .can_ext_scan = true,
275};
276
Avinash Patile05dc3e2013-02-08 18:18:08 -0800277struct mwifiex_evt_buf_desc {
278 u64 paddr;
279 u16 len;
280 u16 flags;
281} __packed;
282
Amitkumar Karward930fae2011-10-11 17:41:21 -0700283struct mwifiex_pcie_buf_desc {
284 u64 paddr;
285 u16 len;
286 u16 flags;
287} __packed;
288
Avinash Patilca8f2112013-02-08 18:18:09 -0800289struct mwifiex_pfu_buf_desc {
290 u16 flags;
291 u16 offset;
292 u16 frag_len;
293 u16 len;
294 u64 paddr;
295 u32 reserved;
296} __packed;
297
Xinming Hu99074fc2016-01-11 02:16:40 -0800298#define MWIFIEX_NUM_MSIX_VECTORS 4
299
300struct mwifiex_msix_context {
301 struct pci_dev *dev;
302 u16 msg_id;
303};
304
Amitkumar Karward930fae2011-10-11 17:41:21 -0700305struct pcie_service_card {
306 struct pci_dev *dev;
307 struct mwifiex_adapter *adapter;
Avinash Patildd04e6a2013-02-08 18:18:06 -0800308 struct mwifiex_pcie_device pcie;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700309
Avinash Patilfbd7e7a2013-01-03 21:21:31 -0800310 u8 txbd_flush;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700311 u32 txbd_wrptr;
312 u32 txbd_rdptr;
313 u32 txbd_ring_size;
314 u8 *txbd_ring_vbase;
Avinash Patilfc331462013-01-03 21:21:30 -0800315 dma_addr_t txbd_ring_pbase;
Avinash Patile05dc3e2013-02-08 18:18:08 -0800316 void *txbd_ring[MWIFIEX_MAX_TXRX_BD];
Amitkumar Karward930fae2011-10-11 17:41:21 -0700317 struct sk_buff *tx_buf_list[MWIFIEX_MAX_TXRX_BD];
318
319 u32 rxbd_wrptr;
320 u32 rxbd_rdptr;
321 u32 rxbd_ring_size;
322 u8 *rxbd_ring_vbase;
Avinash Patilfc331462013-01-03 21:21:30 -0800323 dma_addr_t rxbd_ring_pbase;
Avinash Patile05dc3e2013-02-08 18:18:08 -0800324 void *rxbd_ring[MWIFIEX_MAX_TXRX_BD];
Amitkumar Karward930fae2011-10-11 17:41:21 -0700325 struct sk_buff *rx_buf_list[MWIFIEX_MAX_TXRX_BD];
326
327 u32 evtbd_wrptr;
328 u32 evtbd_rdptr;
329 u32 evtbd_ring_size;
330 u8 *evtbd_ring_vbase;
Avinash Patilfc331462013-01-03 21:21:30 -0800331 dma_addr_t evtbd_ring_pbase;
Avinash Patile05dc3e2013-02-08 18:18:08 -0800332 void *evtbd_ring[MWIFIEX_MAX_EVT_BD];
Amitkumar Karward930fae2011-10-11 17:41:21 -0700333 struct sk_buff *evt_buf_list[MWIFIEX_MAX_EVT_BD];
334
335 struct sk_buff *cmd_buf;
336 struct sk_buff *cmdrsp_buf;
Avinash Patilfc331462013-01-03 21:21:30 -0800337 u8 *sleep_cookie_vbase;
338 dma_addr_t sleep_cookie_pbase;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700339 void __iomem *pci_mmap;
340 void __iomem *pci_mmap1;
Avinash Patil7be0f5b2015-12-16 04:21:45 -0800341 int msi_enable;
Xinming Hu99074fc2016-01-11 02:16:40 -0800342 int msix_enable;
343#ifdef CONFIG_PCI
344 struct msix_entry msix_entries[MWIFIEX_NUM_MSIX_VECTORS];
345#endif
346 struct mwifiex_msix_context msix_ctx[MWIFIEX_NUM_MSIX_VECTORS];
347 struct mwifiex_msix_context share_irq_ctx;
Amitkumar Karward930fae2011-10-11 17:41:21 -0700348};
349
Avinash Patilfbd7e7a2013-01-03 21:21:31 -0800350static inline int
351mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr)
352{
Avinash Patildd04e6a2013-02-08 18:18:06 -0800353 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
354
Avinash Patilca8f2112013-02-08 18:18:09 -0800355 switch (card->dev->device) {
356 case PCIE_DEVICE_ID_MARVELL_88W8766P:
357 if (((card->txbd_wrptr & reg->tx_mask) ==
358 (rdptr & reg->tx_mask)) &&
359 ((card->txbd_wrptr & reg->tx_rollover_ind) !=
360 (rdptr & reg->tx_rollover_ind)))
361 return 1;
362 break;
363 case PCIE_DEVICE_ID_MARVELL_88W8897:
Amitkumar Karwarf3b35f22015-12-16 04:21:44 -0800364 case PCIE_DEVICE_ID_MARVELL_88W8997:
Avinash Patilca8f2112013-02-08 18:18:09 -0800365 if (((card->txbd_wrptr & reg->tx_mask) ==
366 (rdptr & reg->tx_mask)) &&
367 ((card->txbd_wrptr & reg->tx_rollover_ind) ==
Avinash Patildd04e6a2013-02-08 18:18:06 -0800368 (rdptr & reg->tx_rollover_ind)))
Avinash Patilca8f2112013-02-08 18:18:09 -0800369 return 1;
370 break;
371 }
Avinash Patilfbd7e7a2013-01-03 21:21:31 -0800372
373 return 0;
374}
375
Avinash Patile7f767a2013-01-03 21:21:32 -0800376static inline int
377mwifiex_pcie_txbd_not_full(struct pcie_service_card *card)
378{
Avinash Patildd04e6a2013-02-08 18:18:06 -0800379 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
380
Avinash Patilca8f2112013-02-08 18:18:09 -0800381 switch (card->dev->device) {
382 case PCIE_DEVICE_ID_MARVELL_88W8766P:
383 if (((card->txbd_wrptr & reg->tx_mask) !=
384 (card->txbd_rdptr & reg->tx_mask)) ||
385 ((card->txbd_wrptr & reg->tx_rollover_ind) !=
386 (card->txbd_rdptr & reg->tx_rollover_ind)))
387 return 1;
388 break;
389 case PCIE_DEVICE_ID_MARVELL_88W8897:
Zhaoyang Liu6d85ef02015-08-05 06:09:40 -0700390 case PCIE_DEVICE_ID_MARVELL_88W8997:
Avinash Patilca8f2112013-02-08 18:18:09 -0800391 if (((card->txbd_wrptr & reg->tx_mask) !=
392 (card->txbd_rdptr & reg->tx_mask)) ||
393 ((card->txbd_wrptr & reg->tx_rollover_ind) ==
394 (card->txbd_rdptr & reg->tx_rollover_ind)))
395 return 1;
396 break;
397 }
Avinash Patile7f767a2013-01-03 21:21:32 -0800398
399 return 0;
400}
Amitkumar Karwar92c25382014-06-19 21:38:52 -0700401
Amitkumar Karward930fae2011-10-11 17:41:21 -0700402#endif /* _MWIFIEX_PCIE_H */