diff options
author | Avinash Patil <patila@marvell.com> | 2013-02-08 21:18:09 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-02-11 15:34:57 -0500 |
commit | ca8f21127883f8c1ea48b9ce8f93ead2175142a7 (patch) | |
tree | ed2e9a71c0871e396115f8010993926fbbf43ea2 /drivers/net/wireless/mwifiex/pcie.h | |
parent | e05dc3e93c136ecd329ed2d57d4eb2e82f530304 (diff) |
mwifiex: add PCIe8897 support
This patch adds PCIe8897 support to mwifiex.
In PCIe8897 PFU (pre-fetch unit) is enabled by default.
This patch adds support to accommodate this feaure as well.
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Frank Huang <frankh@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/pcie.h')
-rw-r--r-- | drivers/net/wireless/mwifiex/pcie.h | 99 |
1 files changed, 91 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 7ebdc74f2bbf..608061578b37 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -29,6 +29,11 @@ | |||
29 | #include "main.h" | 29 | #include "main.h" |
30 | 30 | ||
31 | #define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin" | 31 | #define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin" |
32 | #define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin" | ||
33 | |||
34 | #define PCIE_VENDOR_ID_MARVELL (0x11ab) | ||
35 | #define PCIE_DEVICE_ID_MARVELL_88W8766P (0x2b30) | ||
36 | #define PCIE_DEVICE_ID_MARVELL_88W8897 (0x2b38) | ||
32 | 37 | ||
33 | /* Constants for Buffer Descriptor (BD) rings */ | 38 | /* Constants for Buffer Descriptor (BD) rings */ |
34 | #define MWIFIEX_MAX_TXRX_BD 0x20 | 39 | #define MWIFIEX_MAX_TXRX_BD 0x20 |
@@ -57,6 +62,8 @@ | |||
57 | #define PCIE_SCRATCH_10_REG 0xCE8 | 62 | #define PCIE_SCRATCH_10_REG 0xCE8 |
58 | #define PCIE_SCRATCH_11_REG 0xCEC | 63 | #define PCIE_SCRATCH_11_REG 0xCEC |
59 | #define PCIE_SCRATCH_12_REG 0xCF0 | 64 | #define PCIE_SCRATCH_12_REG 0xCF0 |
65 | #define PCIE_RD_DATA_PTR_Q0_Q1 0xC08C | ||
66 | #define PCIE_WR_DATA_PTR_Q0_Q1 0xC05C | ||
60 | 67 | ||
61 | #define CPU_INTR_DNLD_RDY BIT(0) | 68 | #define CPU_INTR_DNLD_RDY BIT(0) |
62 | #define CPU_INTR_DOOR_BELL BIT(1) | 69 | #define CPU_INTR_DOOR_BELL BIT(1) |
@@ -75,6 +82,14 @@ | |||
75 | #define MWIFIEX_BD_FLAG_ROLLOVER_IND BIT(7) | 82 | #define MWIFIEX_BD_FLAG_ROLLOVER_IND BIT(7) |
76 | #define MWIFIEX_BD_FLAG_FIRST_DESC BIT(0) | 83 | #define MWIFIEX_BD_FLAG_FIRST_DESC BIT(0) |
77 | #define MWIFIEX_BD_FLAG_LAST_DESC BIT(1) | 84 | #define MWIFIEX_BD_FLAG_LAST_DESC BIT(1) |
85 | #define MWIFIEX_BD_FLAG_SOP BIT(0) | ||
86 | #define MWIFIEX_BD_FLAG_EOP BIT(1) | ||
87 | #define MWIFIEX_BD_FLAG_XS_SOP BIT(2) | ||
88 | #define MWIFIEX_BD_FLAG_XS_EOP BIT(3) | ||
89 | #define MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND BIT(7) | ||
90 | #define MWIFIEX_BD_FLAG_RX_ROLLOVER_IND BIT(10) | ||
91 | #define MWIFIEX_BD_FLAG_TX_START_PTR BIT(16) | ||
92 | #define MWIFIEX_BD_FLAG_TX_ROLLOVER_IND BIT(26) | ||
78 | 93 | ||
79 | /* Max retry number of command write */ | 94 | /* Max retry number of command write */ |
80 | #define MAX_WRITE_IOMEM_RETRY 2 | 95 | #define MAX_WRITE_IOMEM_RETRY 2 |
@@ -143,6 +158,36 @@ static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { | |||
143 | .pfu_enabled = 0, | 158 | .pfu_enabled = 0, |
144 | }; | 159 | }; |
145 | 160 | ||
161 | static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { | ||
162 | .cmd_addr_lo = PCIE_SCRATCH_0_REG, | ||
163 | .cmd_addr_hi = PCIE_SCRATCH_1_REG, | ||
164 | .cmd_size = PCIE_SCRATCH_2_REG, | ||
165 | .fw_status = PCIE_SCRATCH_3_REG, | ||
166 | .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, | ||
167 | .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, | ||
168 | .tx_rdptr = PCIE_RD_DATA_PTR_Q0_Q1, | ||
169 | .tx_wrptr = PCIE_WR_DATA_PTR_Q0_Q1, | ||
170 | .rx_rdptr = PCIE_WR_DATA_PTR_Q0_Q1, | ||
171 | .rx_wrptr = PCIE_RD_DATA_PTR_Q0_Q1, | ||
172 | .evt_rdptr = PCIE_SCRATCH_10_REG, | ||
173 | .evt_wrptr = PCIE_SCRATCH_11_REG, | ||
174 | .drv_rdy = PCIE_SCRATCH_12_REG, | ||
175 | .tx_start_ptr = 16, | ||
176 | .tx_mask = 0x03FF0000, | ||
177 | .tx_wrap_mask = 0x07FF0000, | ||
178 | .rx_mask = 0x000003FF, | ||
179 | .rx_wrap_mask = 0x000007FF, | ||
180 | .tx_rollover_ind = MWIFIEX_BD_FLAG_TX_ROLLOVER_IND, | ||
181 | .rx_rollover_ind = MWIFIEX_BD_FLAG_RX_ROLLOVER_IND, | ||
182 | .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND, | ||
183 | .ring_flag_sop = MWIFIEX_BD_FLAG_SOP, | ||
184 | .ring_flag_eop = MWIFIEX_BD_FLAG_EOP, | ||
185 | .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP, | ||
186 | .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, | ||
187 | .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, | ||
188 | .pfu_enabled = 1, | ||
189 | }; | ||
190 | |||
146 | struct mwifiex_pcie_device { | 191 | struct mwifiex_pcie_device { |
147 | const char *firmware; | 192 | const char *firmware; |
148 | const struct mwifiex_pcie_card_reg *reg; | 193 | const struct mwifiex_pcie_card_reg *reg; |
@@ -155,6 +200,12 @@ static const struct mwifiex_pcie_device mwifiex_pcie8766 = { | |||
155 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, | 200 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
156 | }; | 201 | }; |
157 | 202 | ||
203 | static const struct mwifiex_pcie_device mwifiex_pcie8897 = { | ||
204 | .firmware = PCIE8897_DEFAULT_FW_NAME, | ||
205 | .reg = &mwifiex_reg_8897, | ||
206 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, | ||
207 | }; | ||
208 | |||
158 | struct mwifiex_evt_buf_desc { | 209 | struct mwifiex_evt_buf_desc { |
159 | u64 paddr; | 210 | u64 paddr; |
160 | u16 len; | 211 | u16 len; |
@@ -167,6 +218,15 @@ struct mwifiex_pcie_buf_desc { | |||
167 | u16 flags; | 218 | u16 flags; |
168 | } __packed; | 219 | } __packed; |
169 | 220 | ||
221 | struct mwifiex_pfu_buf_desc { | ||
222 | u16 flags; | ||
223 | u16 offset; | ||
224 | u16 frag_len; | ||
225 | u16 len; | ||
226 | u64 paddr; | ||
227 | u32 reserved; | ||
228 | } __packed; | ||
229 | |||
170 | struct pcie_service_card { | 230 | struct pcie_service_card { |
171 | struct pci_dev *dev; | 231 | struct pci_dev *dev; |
172 | struct mwifiex_adapter *adapter; | 232 | struct mwifiex_adapter *adapter; |
@@ -210,10 +270,22 @@ mwifiex_pcie_txbd_empty(struct pcie_service_card *card, u32 rdptr) | |||
210 | { | 270 | { |
211 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | 271 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; |
212 | 272 | ||
213 | if (((card->txbd_wrptr & reg->tx_mask) == (rdptr & reg->tx_mask)) && | 273 | switch (card->dev->device) { |
214 | ((card->txbd_wrptr & reg->tx_rollover_ind) != | 274 | case PCIE_DEVICE_ID_MARVELL_88W8766P: |
275 | if (((card->txbd_wrptr & reg->tx_mask) == | ||
276 | (rdptr & reg->tx_mask)) && | ||
277 | ((card->txbd_wrptr & reg->tx_rollover_ind) != | ||
278 | (rdptr & reg->tx_rollover_ind))) | ||
279 | return 1; | ||
280 | break; | ||
281 | case PCIE_DEVICE_ID_MARVELL_88W8897: | ||
282 | if (((card->txbd_wrptr & reg->tx_mask) == | ||
283 | (rdptr & reg->tx_mask)) && | ||
284 | ((card->txbd_wrptr & reg->tx_rollover_ind) == | ||
215 | (rdptr & reg->tx_rollover_ind))) | 285 | (rdptr & reg->tx_rollover_ind))) |
216 | return 1; | 286 | return 1; |
287 | break; | ||
288 | } | ||
217 | 289 | ||
218 | return 0; | 290 | return 0; |
219 | } | 291 | } |
@@ -223,11 +295,22 @@ mwifiex_pcie_txbd_not_full(struct pcie_service_card *card) | |||
223 | { | 295 | { |
224 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; | 296 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; |
225 | 297 | ||
226 | if (((card->txbd_wrptr & reg->tx_mask) != | 298 | switch (card->dev->device) { |
227 | (card->txbd_rdptr & reg->tx_mask)) || | 299 | case PCIE_DEVICE_ID_MARVELL_88W8766P: |
228 | ((card->txbd_wrptr & reg->tx_rollover_ind) != | 300 | if (((card->txbd_wrptr & reg->tx_mask) != |
229 | (card->txbd_rdptr & reg->tx_rollover_ind))) | 301 | (card->txbd_rdptr & reg->tx_mask)) || |
230 | return 1; | 302 | ((card->txbd_wrptr & reg->tx_rollover_ind) != |
303 | (card->txbd_rdptr & reg->tx_rollover_ind))) | ||
304 | return 1; | ||
305 | break; | ||
306 | case PCIE_DEVICE_ID_MARVELL_88W8897: | ||
307 | if (((card->txbd_wrptr & reg->tx_mask) != | ||
308 | (card->txbd_rdptr & reg->tx_mask)) || | ||
309 | ((card->txbd_wrptr & reg->tx_rollover_ind) == | ||
310 | (card->txbd_rdptr & reg->tx_rollover_ind))) | ||
311 | return 1; | ||
312 | break; | ||
313 | } | ||
231 | 314 | ||
232 | return 0; | 315 | return 0; |
233 | } | 316 | } |