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()
415 mwifiex_initialize_quirks(card); in mwifiex_pcie_probe()
417 if (mwifiex_add_card(card, &card->fw_done, &pcie_ops, in mwifiex_pcie_probe()
427 * This function removes the interface and frees up the card structure.
431 struct pcie_service_card *card; in mwifiex_pcie_remove() local
437 card = pci_get_drvdata(pdev); in mwifiex_pcie_remove()
439 wait_for_completion(&card->fw_done); in mwifiex_pcie_remove()
441 adapter = card->adapter; in mwifiex_pcie_remove()
445 reg = card->pcie.reg; in mwifiex_pcie_remove()
474 struct pcie_service_card *card; in mwifiex_pcie_coredump() local
477 card = pci_get_drvdata(pdev); in mwifiex_pcie_coredump()
480 &card->work_flags)) in mwifiex_pcie_coredump()
481 schedule_work(&card->work); in mwifiex_pcie_coredump()
515 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_prepare() local
516 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_prepare()
529 clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); in mwifiex_pcie_reset_prepare()
530 clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); in mwifiex_pcie_reset_prepare()
533 * hangups, so we power-cycle the card instead. in mwifiex_pcie_reset_prepare()
535 if (card->quirks & QUIRK_FW_RST_D3COLD) in mwifiex_pcie_reset_prepare()
540 card->pci_reset_ongoing = true; in mwifiex_pcie_reset_prepare()
550 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_done() local
551 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_done()
570 card->pci_reset_ongoing = false; in mwifiex_pcie_reset_done()
621 struct pcie_service_card *card = adapter->card; in mwifiex_delay_for_sleep_cookie() local
624 struct sk_buff *cmdrsp = card->cmdrsp_buf; in mwifiex_delay_for_sleep_cookie()
627 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
638 dma_sync_single_for_device(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
650 /* This function wakes up the card by reading fw_status register. */
653 struct pcie_service_card *card = adapter->card; in mwifiex_pm_wakeup_card() local
654 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pm_wakeup_card()
680 * This function is called after the card has woken up.
682 * The card configuration register is reset.
696 * written back to the card host interrupt mask register.
721 * The host interrupt enable mask is written to the card
744 struct pcie_service_card *card = adapter->card; in mwifiex_init_txq_ring() local
745 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_txq_ring()
751 card->tx_buf_list[i] = NULL; in mwifiex_init_txq_ring()
753 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
755 desc2 = card->txbd_ring[i]; in mwifiex_init_txq_ring()
758 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
760 desc = card->txbd_ring[i]; in mwifiex_init_txq_ring()
774 struct pcie_service_card *card = adapter->card; in mwifiex_init_rxq_ring() local
775 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_rxq_ring()
789 kfree(card->rxbd_ring_vbase); in mwifiex_init_rxq_ring()
805 card->rx_buf_list[i] = skb; in mwifiex_init_rxq_ring()
807 card->rxbd_ring[i] = (void *)card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
809 desc2 = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
816 card->rxbd_ring[i] = (void *)(card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
818 desc = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
834 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_evt_ring() local
846 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
854 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
865 card->evt_buf_list[i] = skb; in mwifiex_pcie_init_evt_ring()
866 card->evtbd_ring[i] = (void *)(card->evtbd_ring_vbase + in mwifiex_pcie_init_evt_ring()
868 desc = card->evtbd_ring[i]; in mwifiex_pcie_init_evt_ring()
882 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_txq_ring() local
883 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_txq_ring()
891 desc2 = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
892 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
893 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
900 desc = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
901 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
902 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
909 card->tx_buf_list[i] = NULL; in mwifiex_cleanup_txq_ring()
921 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_rxq_ring() local
922 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_rxq_ring()
930 desc2 = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
931 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
932 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
939 desc = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
940 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
941 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
948 card->rx_buf_list[i] = NULL; in mwifiex_cleanup_rxq_ring()
959 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_evt_ring() local
965 desc = card->evtbd_ring[i]; in mwifiex_cleanup_evt_ring()
966 if (card->evt_buf_list[i]) { in mwifiex_cleanup_evt_ring()
967 skb = card->evt_buf_list[i]; in mwifiex_cleanup_evt_ring()
972 card->evt_buf_list[i] = NULL; in mwifiex_cleanup_evt_ring()
983 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_txbd_ring() local
984 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_txbd_ring()
991 card->txbd_wrptr = 0; in mwifiex_pcie_create_txbd_ring()
994 card->txbd_rdptr = 0; in mwifiex_pcie_create_txbd_ring()
996 card->txbd_rdptr |= reg->tx_rollover_ind; in mwifiex_pcie_create_txbd_ring()
1001 card->txbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1004 card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1009 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1010 card->txbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_txbd_ring()
1011 card->txbd_ring_size, in mwifiex_pcie_create_txbd_ring()
1012 &card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1014 if (!card->txbd_ring_vbase) { in mwifiex_pcie_create_txbd_ring()
1017 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1023 card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1024 (u32)((u64)card->txbd_ring_pbase >> 32), in mwifiex_pcie_create_txbd_ring()
1025 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1032 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_txbd_ring() local
1033 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_txbd_ring()
1037 if (card->txbd_ring_vbase) in mwifiex_pcie_delete_txbd_ring()
1038 dma_free_coherent(&card->dev->dev, card->txbd_ring_size, in mwifiex_pcie_delete_txbd_ring()
1039 card->txbd_ring_vbase, in mwifiex_pcie_delete_txbd_ring()
1040 card->txbd_ring_pbase); in mwifiex_pcie_delete_txbd_ring()
1041 card->txbd_ring_size = 0; in mwifiex_pcie_delete_txbd_ring()
1042 card->txbd_wrptr = 0; in mwifiex_pcie_delete_txbd_ring()
1043 card->txbd_rdptr = 0 | reg->tx_rollover_ind; in mwifiex_pcie_delete_txbd_ring()
1044 card->txbd_ring_vbase = NULL; in mwifiex_pcie_delete_txbd_ring()
1045 card->txbd_ring_pbase = 0; in mwifiex_pcie_delete_txbd_ring()
1055 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_rxbd_ring() local
1056 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_rxbd_ring()
1063 card->rxbd_wrptr = 0; in mwifiex_pcie_create_rxbd_ring()
1064 card->rxbd_rdptr = reg->rx_rollover_ind; in mwifiex_pcie_create_rxbd_ring()
1067 card->rxbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1070 card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1075 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1076 card->rxbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_rxbd_ring()
1077 card->rxbd_ring_size, in mwifiex_pcie_create_rxbd_ring()
1078 &card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1080 if (!card->rxbd_ring_vbase) { in mwifiex_pcie_create_rxbd_ring()
1083 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1089 card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1090 (u32)((u64)card->rxbd_ring_pbase >> 32), in mwifiex_pcie_create_rxbd_ring()
1091 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1101 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_rxbd_ring() local
1102 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_rxbd_ring()
1106 if (card->rxbd_ring_vbase) in mwifiex_pcie_delete_rxbd_ring()
1107 dma_free_coherent(&card->dev->dev, card->rxbd_ring_size, in mwifiex_pcie_delete_rxbd_ring()
1108 card->rxbd_ring_vbase, in mwifiex_pcie_delete_rxbd_ring()
1109 card->rxbd_ring_pbase); in mwifiex_pcie_delete_rxbd_ring()
1110 card->rxbd_ring_size = 0; in mwifiex_pcie_delete_rxbd_ring()
1111 card->rxbd_wrptr = 0; in mwifiex_pcie_delete_rxbd_ring()
1112 card->rxbd_rdptr = 0 | reg->rx_rollover_ind; in mwifiex_pcie_delete_rxbd_ring()
1113 card->rxbd_ring_vbase = NULL; in mwifiex_pcie_delete_rxbd_ring()
1114 card->rxbd_ring_pbase = 0; in mwifiex_pcie_delete_rxbd_ring()
1124 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_evtbd_ring() local
1125 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_evtbd_ring()
1132 card->evtbd_wrptr = 0; in mwifiex_pcie_create_evtbd_ring()
1133 card->evtbd_rdptr = reg->evt_rollover_ind; in mwifiex_pcie_create_evtbd_ring()
1135 card->evtbd_ring_size = sizeof(struct mwifiex_evt_buf_desc) * in mwifiex_pcie_create_evtbd_ring()
1140 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1141 card->evtbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_evtbd_ring()
1142 card->evtbd_ring_size, in mwifiex_pcie_create_evtbd_ring()
1143 &card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1145 if (!card->evtbd_ring_vbase) { in mwifiex_pcie_create_evtbd_ring()
1148 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1154 card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1155 (u32)((u64)card->evtbd_ring_pbase >> 32), in mwifiex_pcie_create_evtbd_ring()
1156 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1166 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_evtbd_ring() local
1167 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_evtbd_ring()
1171 if (card->evtbd_ring_vbase) in mwifiex_pcie_delete_evtbd_ring()
1172 dma_free_coherent(&card->dev->dev, card->evtbd_ring_size, in mwifiex_pcie_delete_evtbd_ring()
1173 card->evtbd_ring_vbase, in mwifiex_pcie_delete_evtbd_ring()
1174 card->evtbd_ring_pbase); in mwifiex_pcie_delete_evtbd_ring()
1175 card->evtbd_wrptr = 0; in mwifiex_pcie_delete_evtbd_ring()
1176 card->evtbd_rdptr = 0 | reg->evt_rollover_ind; in mwifiex_pcie_delete_evtbd_ring()
1177 card->evtbd_ring_size = 0; in mwifiex_pcie_delete_evtbd_ring()
1178 card->evtbd_ring_vbase = NULL; in mwifiex_pcie_delete_evtbd_ring()
1179 card->evtbd_ring_pbase = 0; in mwifiex_pcie_delete_evtbd_ring()
1189 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_cmdrsp_buf() local
1206 card->cmdrsp_buf = skb; in mwifiex_pcie_alloc_cmdrsp_buf()
1216 struct pcie_service_card *card; in mwifiex_pcie_delete_cmdrsp_buf() local
1221 card = adapter->card; in mwifiex_pcie_delete_cmdrsp_buf()
1223 if (card && card->cmdrsp_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1224 mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1226 dev_kfree_skb_any(card->cmdrsp_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1227 card->cmdrsp_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1230 if (card && card->cmd_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1231 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1233 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1234 card->cmd_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1244 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_sleep_cookie_buf() local
1247 card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_alloc_sleep_cookie_buf()
1249 &card->sleep_cookie_pbase, in mwifiex_pcie_alloc_sleep_cookie_buf()
1251 if (!card->sleep_cookie_vbase) { in mwifiex_pcie_alloc_sleep_cookie_buf()
1256 cookie = (u32 *)card->sleep_cookie_vbase; in mwifiex_pcie_alloc_sleep_cookie_buf()
1270 struct pcie_service_card *card; in mwifiex_pcie_delete_sleep_cookie_buf() local
1275 card = adapter->card; in mwifiex_pcie_delete_sleep_cookie_buf()
1277 if (card && card->sleep_cookie_vbase) { in mwifiex_pcie_delete_sleep_cookie_buf()
1278 dma_free_coherent(&card->dev->dev, sizeof(u32), in mwifiex_pcie_delete_sleep_cookie_buf()
1279 card->sleep_cookie_vbase, in mwifiex_pcie_delete_sleep_cookie_buf()
1280 card->sleep_cookie_pbase); in mwifiex_pcie_delete_sleep_cookie_buf()
1281 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_delete_sleep_cookie_buf()
1293 struct pcie_service_card *card = adapter->card; in mwifiex_clean_pcie_ring_buf() local
1295 if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) { in mwifiex_clean_pcie_ring_buf()
1296 card->txbd_flush = 1; in mwifiex_clean_pcie_ring_buf()
1319 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data_complete() local
1320 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data_complete()
1334 card->txbd_rdptr, rdptr); in mwifiex_pcie_send_data_complete()
1338 while (((card->txbd_rdptr & reg->tx_mask) != in mwifiex_pcie_send_data_complete()
1340 ((card->txbd_rdptr & reg->tx_rollover_ind) != in mwifiex_pcie_send_data_complete()
1342 wrdoneidx = (card->txbd_rdptr & reg->tx_mask) >> in mwifiex_pcie_send_data_complete()
1345 skb = card->tx_buf_list[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1356 if (card->txbd_flush) in mwifiex_pcie_send_data_complete()
1364 card->tx_buf_list[wrdoneidx] = NULL; in mwifiex_pcie_send_data_complete()
1367 desc2 = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1370 desc = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1373 switch (card->dev->device) { in mwifiex_pcie_send_data_complete()
1375 card->txbd_rdptr++; in mwifiex_pcie_send_data_complete()
1379 card->txbd_rdptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data_complete()
1384 if ((card->txbd_rdptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data_complete()
1385 card->txbd_rdptr = ((card->txbd_rdptr & in mwifiex_pcie_send_data_complete()
1393 if (card->txbd_flush) { in mwifiex_pcie_send_data_complete()
1394 if (mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) in mwifiex_pcie_send_data_complete()
1395 card->txbd_flush = 0; in mwifiex_pcie_send_data_complete()
1414 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data() local
1415 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data()
1435 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1436 if (mwifiex_pcie_txbd_not_full(card)) { in mwifiex_pcie_send_data()
1448 wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; in mwifiex_pcie_send_data()
1450 card->tx_buf_list[wrindx] = skb; in mwifiex_pcie_send_data()
1454 desc2 = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1462 desc = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1469 switch (card->dev->device) { in mwifiex_pcie_send_data()
1471 card->txbd_wrptr++; in mwifiex_pcie_send_data()
1475 card->txbd_wrptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data()
1479 if ((card->txbd_wrptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data()
1480 card->txbd_wrptr = ((card->txbd_wrptr & in mwifiex_pcie_send_data()
1484 rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; in mwifiex_pcie_send_data()
1487 card->txbd_wrptr | rx_val)) { in mwifiex_pcie_send_data()
1493 if ((mwifiex_pcie_txbd_not_full(card)) && in mwifiex_pcie_send_data()
1512 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1528 card->tx_buf_list[wrindx] = NULL; in mwifiex_pcie_send_data()
1544 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_recv_data() local
1545 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_recv_data()
1563 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1566 (card->rxbd_rdptr & reg->rx_mask)) || in mwifiex_pcie_process_recv_data()
1568 (card->rxbd_rdptr & reg->rx_rollover_ind))) { in mwifiex_pcie_process_recv_data()
1572 rd_index = card->rxbd_rdptr & reg->rx_mask; in mwifiex_pcie_process_recv_data()
1573 skb_data = card->rx_buf_list[rd_index]; in mwifiex_pcie_process_recv_data()
1582 card->rx_buf_list[rd_index] = NULL; in mwifiex_pcie_process_recv_data()
1592 rx_len, card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1598 card->rxbd_rdptr, wrptr, rx_len); in mwifiex_pcie_process_recv_data()
1627 card->rx_buf_list[rd_index] = skb_tmp; in mwifiex_pcie_process_recv_data()
1630 desc2 = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1637 desc = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1643 if ((++card->rxbd_rdptr & reg->rx_mask) == in mwifiex_pcie_process_recv_data()
1645 card->rxbd_rdptr = ((card->rxbd_rdptr & in mwifiex_pcie_process_recv_data()
1651 card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1653 tx_val = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_process_recv_data()
1656 card->rxbd_rdptr | tx_val)) { in mwifiex_pcie_process_recv_data()
1672 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1686 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_boot_cmd() local
1687 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_boot_cmd()
1750 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_fw_port() local
1751 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_init_fw_port()
1752 int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_init_fw_port()
1755 if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | in mwifiex_pcie_init_fw_port()
1769 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_cmd() local
1770 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_cmd()
1783 if (!card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1800 card->cmd_buf = skb; in mwifiex_pcie_send_cmd()
1817 if (card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1818 cmdrsp_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmdrsp_buf); in mwifiex_pcie_send_cmd()
1839 cmd_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmd_buf); in mwifiex_pcie_send_cmd()
1859 card->cmd_buf->len)) { in mwifiex_pcie_send_cmd()
1887 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_cmd_complete() local
1888 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_cmd_complete()
1889 struct sk_buff *skb = card->cmdrsp_buf; in mwifiex_pcie_process_cmd_complete()
1899 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1904 if (card->cmd_buf) { in mwifiex_pcie_process_cmd_complete()
1905 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_process_cmd_complete()
1907 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_process_cmd_complete()
1908 card->cmd_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1917 dma_sync_single_for_device(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1955 card->cmdrsp_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1983 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_cmdrsp_complete() local
1986 card->cmdrsp_buf = skb; in mwifiex_pcie_cmdrsp_complete()
1987 skb_push(card->cmdrsp_buf, adapter->intf_hdr_len); in mwifiex_pcie_cmdrsp_complete()
2001 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_event_ready() local
2002 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_event_ready()
2003 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_process_event_ready()
2032 card->evtbd_rdptr, wrptr); in mwifiex_pcie_process_event_ready()
2033 if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr in mwifiex_pcie_process_event_ready()
2036 (card->evtbd_rdptr & reg->evt_rollover_ind))) { in mwifiex_pcie_process_event_ready()
2043 skb_cmd = card->evt_buf_list[rdptr]; in mwifiex_pcie_process_event_ready()
2048 card->evt_buf_list[rdptr] = NULL; in mwifiex_pcie_process_event_ready()
2049 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_process_event_ready()
2095 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_event_complete() local
2096 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_event_complete()
2098 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_event_complete()
2119 if (!card->evt_buf_list[rdptr]) { in mwifiex_pcie_event_complete()
2126 card->evt_buf_list[rdptr] = skb; in mwifiex_pcie_event_complete()
2127 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_event_complete()
2135 rdptr, card->evt_buf_list[rdptr], skb); in mwifiex_pcie_event_complete()
2138 if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { in mwifiex_pcie_event_complete()
2139 card->evtbd_rdptr = ((card->evtbd_rdptr & in mwifiex_pcie_event_complete()
2146 card->evtbd_rdptr, wrptr); in mwifiex_pcie_event_complete()
2150 card->evtbd_rdptr)) { in mwifiex_pcie_event_complete()
2264 * This function downloads the firmware to the card.
2266 * Firmware is downloaded to the card in blocks. Every block download
2280 struct pcie_service_card *card = adapter->card; in mwifiex_prog_fw_w_helper() local
2281 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_prog_fw_w_helper()
2379 tx_blocks = (txlen + card->pcie.blksz_fw_dl - 1) / in mwifiex_prog_fw_w_helper()
2380 card->pcie.blksz_fw_dl; in mwifiex_prog_fw_w_helper()
2387 skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); in mwifiex_prog_fw_w_helper()
2415 mwifiex_dbg(adapter, ERROR, "%s: Card failed to ACK download\n", in mwifiex_prog_fw_w_helper()
2439 * This function checks the firmware status in card.
2446 struct pcie_service_card *card = adapter->card; in mwifiex_check_fw_status() local
2447 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_fw_status()
2499 struct pcie_service_card *card = adapter->card; in mwifiex_check_winner_status() local
2500 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_winner_status()
2516 * This function reads the interrupt status from card.
2523 struct pcie_service_card *card = adapter->card; in mwifiex_interrupt_status() local
2525 if (card->msi_enable) { in mwifiex_interrupt_status()
2535 if (card->msix_enable && msg_id >= 0) { in mwifiex_interrupt_status()
2587 struct pcie_service_card *card; in mwifiex_pcie_interrupt() local
2590 card = pci_get_drvdata(pdev); in mwifiex_pcie_interrupt()
2592 if (!card->adapter) { in mwifiex_pcie_interrupt()
2593 pr_err("info: %s: card=%p adapter=%p\n", __func__, card, in mwifiex_pcie_interrupt()
2594 card ? card->adapter : NULL); in mwifiex_pcie_interrupt()
2597 adapter = card->adapter; in mwifiex_pcie_interrupt()
2602 if (card->msix_enable) in mwifiex_pcie_interrupt()
2623 * In case of Rx packets received, the packets are uploaded from card to
2631 struct pcie_service_card *card = adapter->card; in mwifiex_process_int_status() local
2634 if (!card->msi_enable) { in mwifiex_process_int_status()
2641 if (card->msi_enable) { in mwifiex_process_int_status()
2701 if (!card->msi_enable && !card->msix_enable && in mwifiex_process_int_status()
2709 * This function downloads data from driver to card.
2711 * Both commands and data packets are transferred to the card by this
2745 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_reg_dump() local
2746 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_reg_dump()
2784 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_rdwr_firmware() local
2785 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_rdwr_firmware()
2825 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_fw_dump() local
2826 const struct mwifiex_pcie_card_reg *creg = card->pcie.reg; in mwifiex_pcie_fw_dump()
2834 if (!card->pcie.can_dump_fw) in mwifiex_pcie_fw_dump()
2968 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset_work() local
2973 pci_try_reset_function(card->dev); in mwifiex_pcie_card_reset_work()
2978 struct pcie_service_card *card = in mwifiex_pcie_work() local
2982 &card->work_flags)) in mwifiex_pcie_work()
2983 mwifiex_pcie_device_dump_work(card->adapter); in mwifiex_pcie_work()
2985 &card->work_flags)) in mwifiex_pcie_work()
2986 mwifiex_pcie_card_reset_work(card->adapter); in mwifiex_pcie_work()
2992 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_device_dump() local
2995 &card->work_flags)) in mwifiex_pcie_device_dump()
2996 schedule_work(&card->work); in mwifiex_pcie_device_dump()
3001 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset() local
3003 if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags)) in mwifiex_pcie_card_reset()
3004 schedule_work(&card->work); in mwifiex_pcie_card_reset()
3009 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_buffers() local
3010 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_alloc_buffers()
3013 card->cmdrsp_buf = NULL; in mwifiex_pcie_alloc_buffers()
3045 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_alloc_buffers()
3064 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_free_buffers() local
3065 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_free_buffers()
3081 struct pcie_service_card *card = adapter->card; in mwifiex_init_pcie() local
3083 struct pci_dev *pdev = card->dev; in mwifiex_init_pcie()
3085 pci_set_drvdata(pdev, card); in mwifiex_init_pcie()
3104 card->pci_mmap = pci_iomap(pdev, 0, 0); in mwifiex_init_pcie()
3105 if (!card->pci_mmap) { in mwifiex_init_pcie()
3115 card->pci_mmap1 = pci_iomap(pdev, 2, 0); in mwifiex_init_pcie()
3116 if (!card->pci_mmap1) { in mwifiex_init_pcie()
3123 card->pci_mmap, card->pci_mmap1); in mwifiex_init_pcie()
3132 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_init_pcie()
3136 pci_iounmap(pdev, card->pci_mmap); in mwifiex_init_pcie()
3147 * This function cleans up the allocated card buffers.
3151 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_pcie() local
3152 struct pci_dev *pdev = card->dev; in mwifiex_cleanup_pcie()
3153 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_pcie()
3157 * the card. It's because that function never returns if we're in mwifiex_cleanup_pcie()
3158 * in reset path. If we're here when resetting the card, it means in mwifiex_cleanup_pcie()
3159 * that we failed to reset the card (reset failure path). in mwifiex_cleanup_pcie()
3161 if (!card->pci_reset_ongoing) { in mwifiex_cleanup_pcie()
3163 cancel_work_sync(&card->work); in mwifiex_cleanup_pcie()
3167 "skipped cancel_work_sync() because we're in card reset failure path\n"); in mwifiex_cleanup_pcie()
3181 pci_iounmap(pdev, card->pci_mmap); in mwifiex_cleanup_pcie()
3182 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_cleanup_pcie()
3192 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_request_irq() local
3193 struct pci_dev *pdev = card->dev; in mwifiex_pcie_request_irq()
3195 if (card->pcie.reg->msix_support) { in mwifiex_pcie_request_irq()
3197 card->msix_entries[i].entry = i; in mwifiex_pcie_request_irq()
3198 ret = pci_enable_msix_exact(pdev, card->msix_entries, in mwifiex_pcie_request_irq()
3202 card->msix_ctx[i].dev = pdev; in mwifiex_pcie_request_irq()
3203 card->msix_ctx[i].msg_id = i; in mwifiex_pcie_request_irq()
3205 ret = request_irq(card->msix_entries[i].vector, in mwifiex_pcie_request_irq()
3208 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3217 free_irq(card->msix_entries[j].vector, in mwifiex_pcie_request_irq()
3218 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3222 card->msix_enable = 1; in mwifiex_pcie_request_irq()
3231 card->msi_enable = 1; in mwifiex_pcie_request_irq()
3233 mwifiex_dbg(adapter, INFO, "msi_enable = %d\n", card->msi_enable); in mwifiex_pcie_request_irq()
3235 card->share_irq_ctx.dev = pdev; in mwifiex_pcie_request_irq()
3236 card->share_irq_ctx.msg_id = -1; in mwifiex_pcie_request_irq()
3238 "MRVL_PCIE", &card->share_irq_ctx); in mwifiex_pcie_request_irq()
3256 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_get_fw_name() local
3258 switch (card->dev->device) { in mwifiex_pcie_get_fw_name()
3305 struct pcie_service_card *card = adapter->card; in mwifiex_register_dev() local
3307 /* save adapter pointer in card */ in mwifiex_register_dev()
3308 card->adapter = adapter; in mwifiex_register_dev()
3313 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_register_dev()
3314 adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; in mwifiex_register_dev()
3315 adapter->num_mem_types = card->pcie.num_mem_types; in mwifiex_register_dev()
3316 adapter->ext_scan = card->pcie.can_ext_scan; in mwifiex_register_dev()
3330 struct pcie_service_card *card = adapter->card; in mwifiex_unregister_dev() local
3331 struct pci_dev *pdev = card->dev; in mwifiex_unregister_dev()
3334 if (card->msix_enable) { in mwifiex_unregister_dev()
3336 synchronize_irq(card->msix_entries[i].vector); in mwifiex_unregister_dev()
3339 free_irq(card->msix_entries[i].vector, in mwifiex_unregister_dev()
3340 &card->msix_ctx[i]); in mwifiex_unregister_dev()
3342 card->msix_enable = 0; in mwifiex_unregister_dev()
3347 free_irq(card->dev->irq, &card->share_irq_ctx); in mwifiex_unregister_dev()
3349 if (card->msi_enable) in mwifiex_unregister_dev()
3352 card->adapter = NULL; in mwifiex_unregister_dev()
3361 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_up_dev() local
3362 struct pci_dev *pdev = card->dev; in mwifiex_pcie_up_dev()
3367 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_pcie_up_dev()
3377 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_down_dev() local
3378 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_down_dev()
3379 struct pci_dev *pdev = card->dev; in mwifiex_pcie_down_dev()