Lines Matching full:card

208 	struct pcie_service_card *card = adapter->card;  in mwifiex_map_pci_memory()  local
211 mapping.addr = dma_map_single(&card->dev->dev, skb->data, size, flags); in mwifiex_map_pci_memory()
212 if (dma_mapping_error(&card->dev->dev, mapping.addr)) { in mwifiex_map_pci_memory()
224 struct pcie_service_card *card = adapter->card; in mwifiex_unmap_pci_memory() local
228 dma_unmap_single(&card->dev->dev, mapping.addr, mapping.len, flags); in mwifiex_unmap_pci_memory()
232 * This function writes data into PCIE card register.
236 struct pcie_service_card *card = adapter->card; in mwifiex_write_reg() local
238 iowrite32(data, card->pci_mmap1 + reg); in mwifiex_write_reg()
243 /* This function reads data from PCIE card register.
247 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg() local
249 *data = ioread32(card->pci_mmap1 + reg); in mwifiex_read_reg()
256 /* This function reads u8 data from PCIE card register. */
260 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg_byte() local
262 *data = ioread8(card->pci_mmap1 + reg); in mwifiex_read_reg_byte()
273 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_ok_to_access_hw() local
274 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_ok_to_access_hw()
279 if (card->sleep_cookie_vbase) { in mwifiex_pcie_ok_to_access_hw()
280 cookie_value = get_unaligned_le32(card->sleep_cookie_vbase); in mwifiex_pcie_ok_to_access_hw()
295 * methods. Failing that the kernel simply removes the whole card.
303 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_suspend() local
307 wait_for_completion(&card->fw_done); in mwifiex_pcie_suspend()
309 adapter = card->adapter; in mwifiex_pcie_suspend()
338 * methods. Failing that the kernel simply removes the whole card.
346 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_resume() local
349 if (!card->adapter) { in mwifiex_pcie_resume()
354 adapter = card->adapter; in mwifiex_pcie_resume()
374 * the card structure, enables PCIE function number and initiates the
381 struct pcie_service_card *card; in mwifiex_pcie_probe() local
387 card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); in mwifiex_pcie_probe()
388 if (!card) in mwifiex_pcie_probe()
391 init_completion(&card->fw_done); in mwifiex_pcie_probe()
393 card->dev = pdev; in mwifiex_pcie_probe()
397 card->pcie.reg = data->reg; in mwifiex_pcie_probe()
398 card->pcie.blksz_fw_dl = data->blksz_fw_dl; in mwifiex_pcie_probe()
399 card->pcie.tx_buf_size = data->tx_buf_size; in mwifiex_pcie_probe()
400 card->pcie.can_dump_fw = data->can_dump_fw; in mwifiex_pcie_probe()
401 card->pcie.mem_type_mapping_tbl = data->mem_type_mapping_tbl; in mwifiex_pcie_probe()
402 card->pcie.num_mem_types = data->num_mem_types; in mwifiex_pcie_probe()
403 card->pcie.can_ext_scan = data->can_ext_scan; in mwifiex_pcie_probe()
404 INIT_WORK(&card->work, mwifiex_pcie_work); in mwifiex_pcie_probe()
414 if (mwifiex_add_card(card, &card->fw_done, &pcie_ops, in mwifiex_pcie_probe()
424 * This function removes the interface and frees up the card structure.
428 struct pcie_service_card *card; in mwifiex_pcie_remove() local
435 card = pci_get_drvdata(pdev); in mwifiex_pcie_remove()
437 wait_for_completion(&card->fw_done); in mwifiex_pcie_remove()
439 adapter = card->adapter; in mwifiex_pcie_remove()
443 reg = card->pcie.reg; in mwifiex_pcie_remove()
472 struct pcie_service_card *card; in mwifiex_pcie_coredump() local
475 card = pci_get_drvdata(pdev); in mwifiex_pcie_coredump()
478 &card->work_flags)) in mwifiex_pcie_coredump()
479 schedule_work(&card->work); in mwifiex_pcie_coredump()
513 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_prepare() local
514 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_prepare()
527 clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); in mwifiex_pcie_reset_prepare()
528 clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); in mwifiex_pcie_reset_prepare()
531 card->pci_reset_ongoing = true; in mwifiex_pcie_reset_prepare()
541 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_done() local
542 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_done()
561 card->pci_reset_ongoing = false; in mwifiex_pcie_reset_done()
612 struct pcie_service_card *card = adapter->card; in mwifiex_delay_for_sleep_cookie() local
615 struct sk_buff *cmdrsp = card->cmdrsp_buf; in mwifiex_delay_for_sleep_cookie()
618 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
629 dma_sync_single_for_device(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
644 /* This function wakes up the card by reading fw_status register. */
647 struct pcie_service_card *card = adapter->card; in mwifiex_pm_wakeup_card() local
648 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pm_wakeup_card()
659 * until we receive an interrupt from the card. in mwifiex_pm_wakeup_card()
688 * This function is called after the card has woken up.
690 * The card configuration register is reset.
704 * written back to the card host interrupt mask register.
729 * The host interrupt enable mask is written to the card
752 struct pcie_service_card *card = adapter->card; in mwifiex_init_txq_ring() local
753 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_txq_ring()
759 card->tx_buf_list[i] = NULL; in mwifiex_init_txq_ring()
761 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
763 desc2 = card->txbd_ring[i]; in mwifiex_init_txq_ring()
766 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
768 desc = card->txbd_ring[i]; in mwifiex_init_txq_ring()
782 struct pcie_service_card *card = adapter->card; in mwifiex_init_rxq_ring() local
783 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_rxq_ring()
797 kfree(card->rxbd_ring_vbase); in mwifiex_init_rxq_ring()
813 card->rx_buf_list[i] = skb; in mwifiex_init_rxq_ring()
815 card->rxbd_ring[i] = (void *)card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
817 desc2 = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
824 card->rxbd_ring[i] = (void *)(card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
826 desc = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
842 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_evt_ring() local
854 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
862 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
873 card->evt_buf_list[i] = skb; in mwifiex_pcie_init_evt_ring()
874 card->evtbd_ring[i] = (void *)(card->evtbd_ring_vbase + in mwifiex_pcie_init_evt_ring()
876 desc = card->evtbd_ring[i]; in mwifiex_pcie_init_evt_ring()
890 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_txq_ring() local
891 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_txq_ring()
899 desc2 = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
900 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
901 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
908 desc = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
909 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
910 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
917 card->tx_buf_list[i] = NULL; in mwifiex_cleanup_txq_ring()
929 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_rxq_ring() local
930 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_rxq_ring()
938 desc2 = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
939 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
940 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
947 desc = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
948 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
949 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
956 card->rx_buf_list[i] = NULL; in mwifiex_cleanup_rxq_ring()
967 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_evt_ring() local
973 desc = card->evtbd_ring[i]; in mwifiex_cleanup_evt_ring()
974 if (card->evt_buf_list[i]) { in mwifiex_cleanup_evt_ring()
975 skb = card->evt_buf_list[i]; in mwifiex_cleanup_evt_ring()
980 card->evt_buf_list[i] = NULL; in mwifiex_cleanup_evt_ring()
991 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_txbd_ring() local
992 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_txbd_ring()
999 card->txbd_wrptr = 0; in mwifiex_pcie_create_txbd_ring()
1002 card->txbd_rdptr = 0; in mwifiex_pcie_create_txbd_ring()
1004 card->txbd_rdptr |= reg->tx_rollover_ind; in mwifiex_pcie_create_txbd_ring()
1009 card->txbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1012 card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1017 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1018 card->txbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_txbd_ring()
1019 card->txbd_ring_size, in mwifiex_pcie_create_txbd_ring()
1020 &card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1022 if (!card->txbd_ring_vbase) { in mwifiex_pcie_create_txbd_ring()
1025 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1031 card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1032 (u32)((u64)card->txbd_ring_pbase >> 32), in mwifiex_pcie_create_txbd_ring()
1033 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1040 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_txbd_ring() local
1041 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_txbd_ring()
1045 if (card->txbd_ring_vbase) in mwifiex_pcie_delete_txbd_ring()
1046 dma_free_coherent(&card->dev->dev, card->txbd_ring_size, in mwifiex_pcie_delete_txbd_ring()
1047 card->txbd_ring_vbase, in mwifiex_pcie_delete_txbd_ring()
1048 card->txbd_ring_pbase); in mwifiex_pcie_delete_txbd_ring()
1049 card->txbd_ring_size = 0; in mwifiex_pcie_delete_txbd_ring()
1050 card->txbd_wrptr = 0; in mwifiex_pcie_delete_txbd_ring()
1051 card->txbd_rdptr = 0 | reg->tx_rollover_ind; in mwifiex_pcie_delete_txbd_ring()
1052 card->txbd_ring_vbase = NULL; in mwifiex_pcie_delete_txbd_ring()
1053 card->txbd_ring_pbase = 0; in mwifiex_pcie_delete_txbd_ring()
1063 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_rxbd_ring() local
1064 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_rxbd_ring()
1071 card->rxbd_wrptr = 0; in mwifiex_pcie_create_rxbd_ring()
1072 card->rxbd_rdptr = reg->rx_rollover_ind; in mwifiex_pcie_create_rxbd_ring()
1075 card->rxbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1078 card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1083 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1084 card->rxbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_rxbd_ring()
1085 card->rxbd_ring_size, in mwifiex_pcie_create_rxbd_ring()
1086 &card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1088 if (!card->rxbd_ring_vbase) { in mwifiex_pcie_create_rxbd_ring()
1091 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1097 card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1098 (u32)((u64)card->rxbd_ring_pbase >> 32), in mwifiex_pcie_create_rxbd_ring()
1099 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1109 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_rxbd_ring() local
1110 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_rxbd_ring()
1114 if (card->rxbd_ring_vbase) in mwifiex_pcie_delete_rxbd_ring()
1115 dma_free_coherent(&card->dev->dev, card->rxbd_ring_size, in mwifiex_pcie_delete_rxbd_ring()
1116 card->rxbd_ring_vbase, in mwifiex_pcie_delete_rxbd_ring()
1117 card->rxbd_ring_pbase); in mwifiex_pcie_delete_rxbd_ring()
1118 card->rxbd_ring_size = 0; in mwifiex_pcie_delete_rxbd_ring()
1119 card->rxbd_wrptr = 0; in mwifiex_pcie_delete_rxbd_ring()
1120 card->rxbd_rdptr = 0 | reg->rx_rollover_ind; in mwifiex_pcie_delete_rxbd_ring()
1121 card->rxbd_ring_vbase = NULL; in mwifiex_pcie_delete_rxbd_ring()
1122 card->rxbd_ring_pbase = 0; in mwifiex_pcie_delete_rxbd_ring()
1132 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_evtbd_ring() local
1133 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_evtbd_ring()
1140 card->evtbd_wrptr = 0; in mwifiex_pcie_create_evtbd_ring()
1141 card->evtbd_rdptr = reg->evt_rollover_ind; in mwifiex_pcie_create_evtbd_ring()
1143 card->evtbd_ring_size = sizeof(struct mwifiex_evt_buf_desc) * in mwifiex_pcie_create_evtbd_ring()
1148 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1149 card->evtbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_evtbd_ring()
1150 card->evtbd_ring_size, in mwifiex_pcie_create_evtbd_ring()
1151 &card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1153 if (!card->evtbd_ring_vbase) { in mwifiex_pcie_create_evtbd_ring()
1156 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1162 card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1163 (u32)((u64)card->evtbd_ring_pbase >> 32), in mwifiex_pcie_create_evtbd_ring()
1164 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1174 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_evtbd_ring() local
1175 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_evtbd_ring()
1179 if (card->evtbd_ring_vbase) in mwifiex_pcie_delete_evtbd_ring()
1180 dma_free_coherent(&card->dev->dev, card->evtbd_ring_size, in mwifiex_pcie_delete_evtbd_ring()
1181 card->evtbd_ring_vbase, in mwifiex_pcie_delete_evtbd_ring()
1182 card->evtbd_ring_pbase); in mwifiex_pcie_delete_evtbd_ring()
1183 card->evtbd_wrptr = 0; in mwifiex_pcie_delete_evtbd_ring()
1184 card->evtbd_rdptr = 0 | reg->evt_rollover_ind; in mwifiex_pcie_delete_evtbd_ring()
1185 card->evtbd_ring_size = 0; in mwifiex_pcie_delete_evtbd_ring()
1186 card->evtbd_ring_vbase = NULL; in mwifiex_pcie_delete_evtbd_ring()
1187 card->evtbd_ring_pbase = 0; in mwifiex_pcie_delete_evtbd_ring()
1197 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_cmdrsp_buf() local
1214 card->cmdrsp_buf = skb; in mwifiex_pcie_alloc_cmdrsp_buf()
1224 struct pcie_service_card *card; in mwifiex_pcie_delete_cmdrsp_buf() local
1229 card = adapter->card; in mwifiex_pcie_delete_cmdrsp_buf()
1231 if (card && card->cmdrsp_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1232 mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1234 dev_kfree_skb_any(card->cmdrsp_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1235 card->cmdrsp_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1238 if (card && card->cmd_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1239 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1241 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1242 card->cmd_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1252 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_sleep_cookie_buf() local
1255 card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_alloc_sleep_cookie_buf()
1257 &card->sleep_cookie_pbase, in mwifiex_pcie_alloc_sleep_cookie_buf()
1259 if (!card->sleep_cookie_vbase) { in mwifiex_pcie_alloc_sleep_cookie_buf()
1264 cookie = (u32 *)card->sleep_cookie_vbase; in mwifiex_pcie_alloc_sleep_cookie_buf()
1278 struct pcie_service_card *card; in mwifiex_pcie_delete_sleep_cookie_buf() local
1283 card = adapter->card; in mwifiex_pcie_delete_sleep_cookie_buf()
1285 if (card && card->sleep_cookie_vbase) { in mwifiex_pcie_delete_sleep_cookie_buf()
1286 dma_free_coherent(&card->dev->dev, sizeof(u32), in mwifiex_pcie_delete_sleep_cookie_buf()
1287 card->sleep_cookie_vbase, in mwifiex_pcie_delete_sleep_cookie_buf()
1288 card->sleep_cookie_pbase); in mwifiex_pcie_delete_sleep_cookie_buf()
1289 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_delete_sleep_cookie_buf()
1301 struct pcie_service_card *card = adapter->card; in mwifiex_clean_pcie_ring_buf() local
1303 if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) { in mwifiex_clean_pcie_ring_buf()
1304 card->txbd_flush = 1; in mwifiex_clean_pcie_ring_buf()
1327 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data_complete() local
1328 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data_complete()
1342 card->txbd_rdptr, rdptr); in mwifiex_pcie_send_data_complete()
1346 while (((card->txbd_rdptr & reg->tx_mask) != in mwifiex_pcie_send_data_complete()
1348 ((card->txbd_rdptr & reg->tx_rollover_ind) != in mwifiex_pcie_send_data_complete()
1350 wrdoneidx = (card->txbd_rdptr & reg->tx_mask) >> in mwifiex_pcie_send_data_complete()
1353 skb = card->tx_buf_list[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1364 if (card->txbd_flush) in mwifiex_pcie_send_data_complete()
1372 card->tx_buf_list[wrdoneidx] = NULL; in mwifiex_pcie_send_data_complete()
1375 desc2 = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1378 desc = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1381 switch (card->dev->device) { in mwifiex_pcie_send_data_complete()
1383 card->txbd_rdptr++; in mwifiex_pcie_send_data_complete()
1387 card->txbd_rdptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data_complete()
1392 if ((card->txbd_rdptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data_complete()
1393 card->txbd_rdptr = ((card->txbd_rdptr & in mwifiex_pcie_send_data_complete()
1401 if (card->txbd_flush) { in mwifiex_pcie_send_data_complete()
1402 if (mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) in mwifiex_pcie_send_data_complete()
1403 card->txbd_flush = 0; in mwifiex_pcie_send_data_complete()
1422 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data() local
1423 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data()
1443 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1444 if (mwifiex_pcie_txbd_not_full(card)) { in mwifiex_pcie_send_data()
1456 wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; in mwifiex_pcie_send_data()
1458 card->tx_buf_list[wrindx] = skb; in mwifiex_pcie_send_data()
1462 desc2 = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1470 desc = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1477 switch (card->dev->device) { in mwifiex_pcie_send_data()
1479 card->txbd_wrptr++; in mwifiex_pcie_send_data()
1483 card->txbd_wrptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data()
1487 if ((card->txbd_wrptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data()
1488 card->txbd_wrptr = ((card->txbd_wrptr & in mwifiex_pcie_send_data()
1492 rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; in mwifiex_pcie_send_data()
1495 card->txbd_wrptr | rx_val)) { in mwifiex_pcie_send_data()
1502 /* The firmware (latest version 15.68.19.p21) of the 88W8897 PCIe+USB card in mwifiex_pcie_send_data()
1509 if ((mwifiex_pcie_txbd_not_full(card)) && in mwifiex_pcie_send_data()
1528 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1544 card->tx_buf_list[wrindx] = NULL; in mwifiex_pcie_send_data()
1560 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_recv_data() local
1561 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_recv_data()
1579 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1582 (card->rxbd_rdptr & reg->rx_mask)) || in mwifiex_pcie_process_recv_data()
1584 (card->rxbd_rdptr & reg->rx_rollover_ind))) { in mwifiex_pcie_process_recv_data()
1588 rd_index = card->rxbd_rdptr & reg->rx_mask; in mwifiex_pcie_process_recv_data()
1589 skb_data = card->rx_buf_list[rd_index]; in mwifiex_pcie_process_recv_data()
1598 card->rx_buf_list[rd_index] = NULL; in mwifiex_pcie_process_recv_data()
1608 rx_len, card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1614 card->rxbd_rdptr, wrptr, rx_len); in mwifiex_pcie_process_recv_data()
1643 card->rx_buf_list[rd_index] = skb_tmp; in mwifiex_pcie_process_recv_data()
1646 desc2 = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1653 desc = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1659 if ((++card->rxbd_rdptr & reg->rx_mask) == in mwifiex_pcie_process_recv_data()
1661 card->rxbd_rdptr = ((card->rxbd_rdptr & in mwifiex_pcie_process_recv_data()
1667 card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1669 tx_val = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_process_recv_data()
1672 card->rxbd_rdptr | tx_val)) { in mwifiex_pcie_process_recv_data()
1688 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1702 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_boot_cmd() local
1703 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_boot_cmd()
1766 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_fw_port() local
1767 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_init_fw_port()
1768 int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_init_fw_port()
1771 if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | in mwifiex_pcie_init_fw_port()
1785 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_cmd() local
1786 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_cmd()
1799 if (!card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1816 card->cmd_buf = skb; in mwifiex_pcie_send_cmd()
1833 if (card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1834 cmdrsp_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmdrsp_buf); in mwifiex_pcie_send_cmd()
1855 cmd_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmd_buf); in mwifiex_pcie_send_cmd()
1875 card->cmd_buf->len)) { in mwifiex_pcie_send_cmd()
1903 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_cmd_complete() local
1904 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_cmd_complete()
1905 struct sk_buff *skb = card->cmdrsp_buf; in mwifiex_pcie_process_cmd_complete()
1915 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1920 if (card->cmd_buf) { in mwifiex_pcie_process_cmd_complete()
1921 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_process_cmd_complete()
1923 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_process_cmd_complete()
1924 card->cmd_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1933 dma_sync_single_for_device(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1971 card->cmdrsp_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1999 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_cmdrsp_complete() local
2002 card->cmdrsp_buf = skb; in mwifiex_pcie_cmdrsp_complete()
2003 skb_push(card->cmdrsp_buf, adapter->intf_hdr_len); in mwifiex_pcie_cmdrsp_complete()
2017 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_event_ready() local
2018 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_event_ready()
2019 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_process_event_ready()
2048 card->evtbd_rdptr, wrptr); in mwifiex_pcie_process_event_ready()
2049 if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr in mwifiex_pcie_process_event_ready()
2052 (card->evtbd_rdptr & reg->evt_rollover_ind))) { in mwifiex_pcie_process_event_ready()
2059 skb_cmd = card->evt_buf_list[rdptr]; in mwifiex_pcie_process_event_ready()
2064 card->evt_buf_list[rdptr] = NULL; in mwifiex_pcie_process_event_ready()
2065 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_process_event_ready()
2111 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_event_complete() local
2112 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_event_complete()
2114 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_event_complete()
2135 if (!card->evt_buf_list[rdptr]) { in mwifiex_pcie_event_complete()
2142 card->evt_buf_list[rdptr] = skb; in mwifiex_pcie_event_complete()
2143 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_event_complete()
2151 rdptr, card->evt_buf_list[rdptr], skb); in mwifiex_pcie_event_complete()
2154 if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { in mwifiex_pcie_event_complete()
2155 card->evtbd_rdptr = ((card->evtbd_rdptr & in mwifiex_pcie_event_complete()
2162 card->evtbd_rdptr, wrptr); in mwifiex_pcie_event_complete()
2166 card->evtbd_rdptr)) { in mwifiex_pcie_event_complete()
2280 * This function downloads the firmware to the card.
2282 * Firmware is downloaded to the card in blocks. Every block download
2296 struct pcie_service_card *card = adapter->card; in mwifiex_prog_fw_w_helper() local
2297 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_prog_fw_w_helper()
2395 tx_blocks = (txlen + card->pcie.blksz_fw_dl - 1) / in mwifiex_prog_fw_w_helper()
2396 card->pcie.blksz_fw_dl; in mwifiex_prog_fw_w_helper()
2403 skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); in mwifiex_prog_fw_w_helper()
2431 mwifiex_dbg(adapter, ERROR, "%s: Card failed to ACK download\n", in mwifiex_prog_fw_w_helper()
2455 * This function checks the firmware status in card.
2462 struct pcie_service_card *card = adapter->card; in mwifiex_check_fw_status() local
2463 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_fw_status()
2515 struct pcie_service_card *card = adapter->card; in mwifiex_check_winner_status() local
2516 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_winner_status()
2532 * This function reads the interrupt status from card.
2539 struct pcie_service_card *card = adapter->card; in mwifiex_interrupt_status() local
2541 if (card->msi_enable) { in mwifiex_interrupt_status()
2551 if (card->msix_enable && msg_id >= 0) { in mwifiex_interrupt_status()
2603 struct pcie_service_card *card; in mwifiex_pcie_interrupt() local
2606 card = pci_get_drvdata(pdev); in mwifiex_pcie_interrupt()
2608 if (!card->adapter) { in mwifiex_pcie_interrupt()
2609 pr_err("info: %s: card=%p adapter=%p\n", __func__, card, in mwifiex_pcie_interrupt()
2610 card ? card->adapter : NULL); in mwifiex_pcie_interrupt()
2613 adapter = card->adapter; in mwifiex_pcie_interrupt()
2618 if (card->msix_enable) in mwifiex_pcie_interrupt()
2639 * In case of Rx packets received, the packets are uploaded from card to
2647 struct pcie_service_card *card = adapter->card; in mwifiex_process_int_status() local
2650 if (!card->msi_enable) { in mwifiex_process_int_status()
2657 if (card->msi_enable) { in mwifiex_process_int_status()
2717 if (!card->msi_enable && !card->msix_enable && in mwifiex_process_int_status()
2725 * This function downloads data from driver to card.
2727 * Both commands and data packets are transferred to the card by this
2761 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_reg_dump() local
2762 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_reg_dump()
2800 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_rdwr_firmware() local
2801 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_rdwr_firmware()
2841 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_fw_dump() local
2842 const struct mwifiex_pcie_card_reg *creg = card->pcie.reg; in mwifiex_pcie_fw_dump()
2850 if (!card->pcie.can_dump_fw) in mwifiex_pcie_fw_dump()
2984 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset_work() local
2989 pci_try_reset_function(card->dev); in mwifiex_pcie_card_reset_work()
2994 struct pcie_service_card *card = in mwifiex_pcie_work() local
2998 &card->work_flags)) in mwifiex_pcie_work()
2999 mwifiex_pcie_device_dump_work(card->adapter); in mwifiex_pcie_work()
3001 &card->work_flags)) in mwifiex_pcie_work()
3002 mwifiex_pcie_card_reset_work(card->adapter); in mwifiex_pcie_work()
3008 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_device_dump() local
3011 &card->work_flags)) in mwifiex_pcie_device_dump()
3012 schedule_work(&card->work); in mwifiex_pcie_device_dump()
3017 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset() local
3019 if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags)) in mwifiex_pcie_card_reset()
3020 schedule_work(&card->work); in mwifiex_pcie_card_reset()
3025 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_buffers() local
3026 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_alloc_buffers()
3029 card->cmdrsp_buf = NULL; in mwifiex_pcie_alloc_buffers()
3061 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_alloc_buffers()
3080 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_free_buffers() local
3081 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_free_buffers()
3097 struct pcie_service_card *card = adapter->card; in mwifiex_init_pcie() local
3099 struct pci_dev *pdev = card->dev; in mwifiex_init_pcie()
3101 pci_set_drvdata(pdev, card); in mwifiex_init_pcie()
3120 card->pci_mmap = pci_iomap(pdev, 0, 0); in mwifiex_init_pcie()
3121 if (!card->pci_mmap) { in mwifiex_init_pcie()
3131 card->pci_mmap1 = pci_iomap(pdev, 2, 0); in mwifiex_init_pcie()
3132 if (!card->pci_mmap1) { in mwifiex_init_pcie()
3139 card->pci_mmap, card->pci_mmap1); in mwifiex_init_pcie()
3151 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_init_pcie()
3155 pci_iounmap(pdev, card->pci_mmap); in mwifiex_init_pcie()
3166 * This function cleans up the allocated card buffers.
3170 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_pcie() local
3171 struct pci_dev *pdev = card->dev; in mwifiex_cleanup_pcie()
3172 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_pcie()
3177 * the card. It's because that function never returns if we're in mwifiex_cleanup_pcie()
3178 * in reset path. If we're here when resetting the card, it means in mwifiex_cleanup_pcie()
3179 * that we failed to reset the card (reset failure path). in mwifiex_cleanup_pcie()
3181 if (!card->pci_reset_ongoing) { in mwifiex_cleanup_pcie()
3183 cancel_work_sync(&card->work); in mwifiex_cleanup_pcie()
3187 "skipped cancel_work_sync() because we're in card reset failure path\n"); in mwifiex_cleanup_pcie()
3201 pci_iounmap(pdev, card->pci_mmap); in mwifiex_cleanup_pcie()
3202 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_cleanup_pcie()
3212 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_request_irq() local
3213 struct pci_dev *pdev = card->dev; in mwifiex_pcie_request_irq()
3215 if (card->pcie.reg->msix_support) { in mwifiex_pcie_request_irq()
3217 card->msix_entries[i].entry = i; in mwifiex_pcie_request_irq()
3218 ret = pci_enable_msix_exact(pdev, card->msix_entries, in mwifiex_pcie_request_irq()
3222 card->msix_ctx[i].dev = pdev; in mwifiex_pcie_request_irq()
3223 card->msix_ctx[i].msg_id = i; in mwifiex_pcie_request_irq()
3225 ret = request_irq(card->msix_entries[i].vector, in mwifiex_pcie_request_irq()
3228 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3237 free_irq(card->msix_entries[j].vector, in mwifiex_pcie_request_irq()
3238 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3242 card->msix_enable = 1; in mwifiex_pcie_request_irq()
3251 card->msi_enable = 1; in mwifiex_pcie_request_irq()
3253 mwifiex_dbg(adapter, INFO, "msi_enable = %d\n", card->msi_enable); in mwifiex_pcie_request_irq()
3255 card->share_irq_ctx.dev = pdev; in mwifiex_pcie_request_irq()
3256 card->share_irq_ctx.msg_id = -1; in mwifiex_pcie_request_irq()
3258 "MRVL_PCIE", &card->share_irq_ctx); in mwifiex_pcie_request_irq()
3276 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_get_fw_name() local
3278 switch (card->dev->device) { in mwifiex_pcie_get_fw_name()
3325 struct pcie_service_card *card = adapter->card; in mwifiex_register_dev() local
3327 /* save adapter pointer in card */ in mwifiex_register_dev()
3328 card->adapter = adapter; in mwifiex_register_dev()
3333 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_register_dev()
3334 adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; in mwifiex_register_dev()
3335 adapter->num_mem_types = card->pcie.num_mem_types; in mwifiex_register_dev()
3336 adapter->ext_scan = card->pcie.can_ext_scan; in mwifiex_register_dev()
3350 struct pcie_service_card *card = adapter->card; in mwifiex_unregister_dev() local
3351 struct pci_dev *pdev = card->dev; in mwifiex_unregister_dev()
3354 if (card->msix_enable) { in mwifiex_unregister_dev()
3356 synchronize_irq(card->msix_entries[i].vector); in mwifiex_unregister_dev()
3359 free_irq(card->msix_entries[i].vector, in mwifiex_unregister_dev()
3360 &card->msix_ctx[i]); in mwifiex_unregister_dev()
3362 card->msix_enable = 0; in mwifiex_unregister_dev()
3367 free_irq(card->dev->irq, &card->share_irq_ctx); in mwifiex_unregister_dev()
3369 if (card->msi_enable) in mwifiex_unregister_dev()
3372 card->adapter = NULL; in mwifiex_unregister_dev()
3381 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_up_dev() local
3382 struct pci_dev *pdev = card->dev; in mwifiex_pcie_up_dev()
3387 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_pcie_up_dev()
3397 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_down_dev() local
3398 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_down_dev()
3399 struct pci_dev *pdev = card->dev; in mwifiex_pcie_down_dev()