Lines Matching full:card

199 	struct pcie_service_card *card = adapter->card;  in mwifiex_map_pci_memory()  local
202 mapping.addr = dma_map_single(&card->dev->dev, skb->data, size, flags); in mwifiex_map_pci_memory()
203 if (dma_mapping_error(&card->dev->dev, mapping.addr)) { in mwifiex_map_pci_memory()
215 struct pcie_service_card *card = adapter->card; in mwifiex_unmap_pci_memory() local
219 dma_unmap_single(&card->dev->dev, mapping.addr, mapping.len, flags); in mwifiex_unmap_pci_memory()
223 * This function writes data into PCIE card register.
228 struct pcie_service_card *card = adapter->card; in mwifiex_write_reg() local
230 iowrite32(data, card->pci_mmap1 + reg); in mwifiex_write_reg()
241 /* This function reads data from PCIE card register.
245 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg() local
247 *data = ioread32(card->pci_mmap1 + reg); in mwifiex_read_reg()
254 /* This function reads u8 data from PCIE card register. */
258 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg_byte() local
260 *data = ioread8(card->pci_mmap1 + reg); in mwifiex_read_reg_byte()
271 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_ok_to_access_hw() local
272 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_ok_to_access_hw()
277 if (card->sleep_cookie_vbase) { in mwifiex_pcie_ok_to_access_hw()
278 cookie_value = get_unaligned_le32(card->sleep_cookie_vbase); in mwifiex_pcie_ok_to_access_hw()
293 * methods. Failing that the kernel simply removes the whole card.
301 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_suspend() local
305 wait_for_completion(&card->fw_done); in mwifiex_pcie_suspend()
307 adapter = card->adapter; in mwifiex_pcie_suspend()
336 * methods. Failing that the kernel simply removes the whole card.
344 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_resume() local
347 if (!card->adapter) { in mwifiex_pcie_resume()
352 adapter = card->adapter; in mwifiex_pcie_resume()
372 * the card structure, enables PCIE function number and initiates the
379 struct pcie_service_card *card; in mwifiex_pcie_probe() local
385 card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); in mwifiex_pcie_probe()
386 if (!card) in mwifiex_pcie_probe()
389 init_completion(&card->fw_done); in mwifiex_pcie_probe()
391 card->dev = pdev; in mwifiex_pcie_probe()
395 card->pcie.reg = data->reg; in mwifiex_pcie_probe()
396 card->pcie.blksz_fw_dl = data->blksz_fw_dl; in mwifiex_pcie_probe()
397 card->pcie.tx_buf_size = data->tx_buf_size; in mwifiex_pcie_probe()
398 card->pcie.can_dump_fw = data->can_dump_fw; in mwifiex_pcie_probe()
399 card->pcie.mem_type_mapping_tbl = data->mem_type_mapping_tbl; in mwifiex_pcie_probe()
400 card->pcie.num_mem_types = data->num_mem_types; in mwifiex_pcie_probe()
401 card->pcie.can_ext_scan = data->can_ext_scan; in mwifiex_pcie_probe()
402 INIT_WORK(&card->work, mwifiex_pcie_work); in mwifiex_pcie_probe()
413 mwifiex_initialize_quirks(card); in mwifiex_pcie_probe()
415 if (mwifiex_add_card(card, &card->fw_done, &pcie_ops, in mwifiex_pcie_probe()
425 * This function removes the interface and frees up the card structure.
429 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 * hangups, so we power-cycle the card instead. in mwifiex_pcie_reset_prepare()
533 if (card->quirks & QUIRK_FW_RST_D3COLD) in mwifiex_pcie_reset_prepare()
538 card->pci_reset_ongoing = true; in mwifiex_pcie_reset_prepare()
548 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_done() local
549 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_done()
568 card->pci_reset_ongoing = false; in mwifiex_pcie_reset_done()
619 struct pcie_service_card *card = adapter->card; in mwifiex_delay_for_sleep_cookie() local
622 struct sk_buff *cmdrsp = card->cmdrsp_buf; in mwifiex_delay_for_sleep_cookie()
625 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
636 dma_sync_single_for_device(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
651 /* This function wakes up the card by reading fw_status register. */
654 struct pcie_service_card *card = adapter->card; in mwifiex_pm_wakeup_card() local
655 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pm_wakeup_card()
666 * until we receive an interrupt from the card. in mwifiex_pm_wakeup_card()
695 * This function is called after the card has woken up.
697 * The card configuration register is reset.
711 * written back to the card host interrupt mask register.
724 * The host interrupt enable mask is written to the card
741 struct pcie_service_card *card = adapter->card; in mwifiex_init_txq_ring() local
742 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_txq_ring()
748 card->tx_buf_list[i] = NULL; in mwifiex_init_txq_ring()
750 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
752 desc2 = card->txbd_ring[i]; in mwifiex_init_txq_ring()
755 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
757 desc = card->txbd_ring[i]; in mwifiex_init_txq_ring()
771 struct pcie_service_card *card = adapter->card; in mwifiex_init_rxq_ring() local
772 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_rxq_ring()
803 card->rx_buf_list[i] = skb; in mwifiex_init_rxq_ring()
805 card->rxbd_ring[i] = (void *)card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
807 desc2 = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
814 card->rxbd_ring[i] = (void *)(card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
816 desc = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
832 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_evt_ring() local
861 card->evt_buf_list[i] = skb; in mwifiex_pcie_init_evt_ring()
862 card->evtbd_ring[i] = (void *)(card->evtbd_ring_vbase + in mwifiex_pcie_init_evt_ring()
864 desc = card->evtbd_ring[i]; in mwifiex_pcie_init_evt_ring()
878 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_txq_ring() local
879 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_txq_ring()
887 desc2 = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
888 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
889 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
896 desc = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
897 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
898 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
905 card->tx_buf_list[i] = NULL; in mwifiex_cleanup_txq_ring()
917 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_rxq_ring() local
918 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_rxq_ring()
926 desc2 = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
927 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
928 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
935 desc = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
936 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
937 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
944 card->rx_buf_list[i] = NULL; in mwifiex_cleanup_rxq_ring()
955 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_evt_ring() local
961 desc = card->evtbd_ring[i]; in mwifiex_cleanup_evt_ring()
962 if (card->evt_buf_list[i]) { in mwifiex_cleanup_evt_ring()
963 skb = card->evt_buf_list[i]; in mwifiex_cleanup_evt_ring()
968 card->evt_buf_list[i] = NULL; in mwifiex_cleanup_evt_ring()
979 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_txbd_ring() local
980 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_txbd_ring()
987 card->txbd_wrptr = 0; in mwifiex_pcie_create_txbd_ring()
990 card->txbd_rdptr = 0; in mwifiex_pcie_create_txbd_ring()
992 card->txbd_rdptr |= reg->tx_rollover_ind; in mwifiex_pcie_create_txbd_ring()
997 card->txbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1000 card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1005 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1006 card->txbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_txbd_ring()
1007 card->txbd_ring_size, in mwifiex_pcie_create_txbd_ring()
1008 &card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1010 if (!card->txbd_ring_vbase) { in mwifiex_pcie_create_txbd_ring()
1013 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1019 card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1020 (u32)((u64)card->txbd_ring_pbase >> 32), in mwifiex_pcie_create_txbd_ring()
1021 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1028 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_txbd_ring() local
1029 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_txbd_ring()
1033 if (card->txbd_ring_vbase) in mwifiex_pcie_delete_txbd_ring()
1034 dma_free_coherent(&card->dev->dev, card->txbd_ring_size, in mwifiex_pcie_delete_txbd_ring()
1035 card->txbd_ring_vbase, in mwifiex_pcie_delete_txbd_ring()
1036 card->txbd_ring_pbase); in mwifiex_pcie_delete_txbd_ring()
1037 card->txbd_ring_size = 0; in mwifiex_pcie_delete_txbd_ring()
1038 card->txbd_wrptr = 0; in mwifiex_pcie_delete_txbd_ring()
1039 card->txbd_rdptr = 0 | reg->tx_rollover_ind; in mwifiex_pcie_delete_txbd_ring()
1040 card->txbd_ring_vbase = NULL; in mwifiex_pcie_delete_txbd_ring()
1041 card->txbd_ring_pbase = 0; in mwifiex_pcie_delete_txbd_ring()
1052 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_rxbd_ring() local
1053 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_rxbd_ring()
1060 card->rxbd_wrptr = 0; in mwifiex_pcie_create_rxbd_ring()
1061 card->rxbd_rdptr = reg->rx_rollover_ind; in mwifiex_pcie_create_rxbd_ring()
1064 card->rxbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1067 card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1072 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1073 card->rxbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_rxbd_ring()
1074 card->rxbd_ring_size, in mwifiex_pcie_create_rxbd_ring()
1075 &card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1077 if (!card->rxbd_ring_vbase) { in mwifiex_pcie_create_rxbd_ring()
1080 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1086 card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1087 (u32)((u64)card->rxbd_ring_pbase >> 32), in mwifiex_pcie_create_rxbd_ring()
1088 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()
1125 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_evtbd_ring() local
1126 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_evtbd_ring()
1133 card->evtbd_wrptr = 0; in mwifiex_pcie_create_evtbd_ring()
1134 card->evtbd_rdptr = reg->evt_rollover_ind; in mwifiex_pcie_create_evtbd_ring()
1136 card->evtbd_ring_size = sizeof(struct mwifiex_evt_buf_desc) * in mwifiex_pcie_create_evtbd_ring()
1141 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1142 card->evtbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_evtbd_ring()
1143 card->evtbd_ring_size, in mwifiex_pcie_create_evtbd_ring()
1144 &card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1146 if (!card->evtbd_ring_vbase) { in mwifiex_pcie_create_evtbd_ring()
1149 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1155 card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1156 (u32)((u64)card->evtbd_ring_pbase >> 32), in mwifiex_pcie_create_evtbd_ring()
1157 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1170 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_evtbd_ring() local
1171 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_evtbd_ring()
1175 if (card->evtbd_ring_vbase) in mwifiex_pcie_delete_evtbd_ring()
1176 dma_free_coherent(&card->dev->dev, card->evtbd_ring_size, in mwifiex_pcie_delete_evtbd_ring()
1177 card->evtbd_ring_vbase, in mwifiex_pcie_delete_evtbd_ring()
1178 card->evtbd_ring_pbase); in mwifiex_pcie_delete_evtbd_ring()
1179 card->evtbd_wrptr = 0; in mwifiex_pcie_delete_evtbd_ring()
1180 card->evtbd_rdptr = 0 | reg->evt_rollover_ind; in mwifiex_pcie_delete_evtbd_ring()
1181 card->evtbd_ring_size = 0; in mwifiex_pcie_delete_evtbd_ring()
1182 card->evtbd_ring_vbase = NULL; in mwifiex_pcie_delete_evtbd_ring()
1183 card->evtbd_ring_pbase = 0; in mwifiex_pcie_delete_evtbd_ring()
1193 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_cmdrsp_buf() local
1210 card->cmdrsp_buf = skb; in mwifiex_pcie_alloc_cmdrsp_buf()
1220 struct pcie_service_card *card; in mwifiex_pcie_delete_cmdrsp_buf() local
1225 card = adapter->card; in mwifiex_pcie_delete_cmdrsp_buf()
1227 if (card && card->cmdrsp_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1228 mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1230 dev_kfree_skb_any(card->cmdrsp_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1231 card->cmdrsp_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1234 if (card && card->cmd_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1235 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1237 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1238 card->cmd_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1248 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_sleep_cookie_buf() local
1251 card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_alloc_sleep_cookie_buf()
1253 &card->sleep_cookie_pbase, in mwifiex_pcie_alloc_sleep_cookie_buf()
1255 if (!card->sleep_cookie_vbase) { in mwifiex_pcie_alloc_sleep_cookie_buf()
1260 cookie = (u32 *)card->sleep_cookie_vbase; in mwifiex_pcie_alloc_sleep_cookie_buf()
1274 struct pcie_service_card *card; in mwifiex_pcie_delete_sleep_cookie_buf() local
1279 card = adapter->card; in mwifiex_pcie_delete_sleep_cookie_buf()
1281 if (card && card->sleep_cookie_vbase) { in mwifiex_pcie_delete_sleep_cookie_buf()
1282 dma_free_coherent(&card->dev->dev, sizeof(u32), in mwifiex_pcie_delete_sleep_cookie_buf()
1283 card->sleep_cookie_vbase, in mwifiex_pcie_delete_sleep_cookie_buf()
1284 card->sleep_cookie_pbase); in mwifiex_pcie_delete_sleep_cookie_buf()
1285 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_delete_sleep_cookie_buf()
1297 struct pcie_service_card *card = adapter->card; in mwifiex_clean_pcie_ring_buf() local
1299 if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) { in mwifiex_clean_pcie_ring_buf()
1300 card->txbd_flush = 1; in mwifiex_clean_pcie_ring_buf()
1318 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data_complete() local
1319 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data_complete()
1333 card->txbd_rdptr, rdptr); in mwifiex_pcie_send_data_complete()
1337 while (((card->txbd_rdptr & reg->tx_mask) != in mwifiex_pcie_send_data_complete()
1339 ((card->txbd_rdptr & reg->tx_rollover_ind) != in mwifiex_pcie_send_data_complete()
1341 wrdoneidx = (card->txbd_rdptr & reg->tx_mask) >> in mwifiex_pcie_send_data_complete()
1344 skb = card->tx_buf_list[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1355 if (card->txbd_flush) in mwifiex_pcie_send_data_complete()
1363 card->tx_buf_list[wrdoneidx] = NULL; in mwifiex_pcie_send_data_complete()
1366 desc2 = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1369 desc = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1372 switch (card->dev->device) { in mwifiex_pcie_send_data_complete()
1374 card->txbd_rdptr++; in mwifiex_pcie_send_data_complete()
1378 card->txbd_rdptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data_complete()
1383 if ((card->txbd_rdptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data_complete()
1384 card->txbd_rdptr = ((card->txbd_rdptr & in mwifiex_pcie_send_data_complete()
1392 if (card->txbd_flush) { in mwifiex_pcie_send_data_complete()
1393 if (mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) in mwifiex_pcie_send_data_complete()
1394 card->txbd_flush = 0; in mwifiex_pcie_send_data_complete()
1413 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data() local
1414 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data()
1433 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1434 if (mwifiex_pcie_txbd_not_full(card)) { in mwifiex_pcie_send_data()
1446 wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; in mwifiex_pcie_send_data()
1448 card->tx_buf_list[wrindx] = skb; in mwifiex_pcie_send_data()
1452 desc2 = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1460 desc = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1467 switch (card->dev->device) { in mwifiex_pcie_send_data()
1469 card->txbd_wrptr++; in mwifiex_pcie_send_data()
1473 card->txbd_wrptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data()
1477 if ((card->txbd_wrptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data()
1478 card->txbd_wrptr = ((card->txbd_wrptr & in mwifiex_pcie_send_data()
1482 rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; in mwifiex_pcie_send_data()
1485 card->txbd_wrptr | rx_val); in mwifiex_pcie_send_data()
1487 /* The firmware (latest version 15.68.19.p21) of the 88W8897 PCIe+USB card in mwifiex_pcie_send_data()
1494 if ((mwifiex_pcie_txbd_not_full(card)) && in mwifiex_pcie_send_data()
1508 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1528 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_recv_data() local
1529 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_recv_data()
1547 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1550 (card->rxbd_rdptr & reg->rx_mask)) || in mwifiex_pcie_process_recv_data()
1552 (card->rxbd_rdptr & reg->rx_rollover_ind))) { in mwifiex_pcie_process_recv_data()
1556 rd_index = card->rxbd_rdptr & reg->rx_mask; in mwifiex_pcie_process_recv_data()
1557 skb_data = card->rx_buf_list[rd_index]; in mwifiex_pcie_process_recv_data()
1566 card->rx_buf_list[rd_index] = NULL; in mwifiex_pcie_process_recv_data()
1576 rx_len, card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1582 card->rxbd_rdptr, wrptr, rx_len); in mwifiex_pcie_process_recv_data()
1611 card->rx_buf_list[rd_index] = skb_tmp; in mwifiex_pcie_process_recv_data()
1614 desc2 = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1621 desc = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1627 if ((++card->rxbd_rdptr & reg->rx_mask) == in mwifiex_pcie_process_recv_data()
1629 card->rxbd_rdptr = ((card->rxbd_rdptr & in mwifiex_pcie_process_recv_data()
1635 card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1637 tx_val = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_process_recv_data()
1640 card->rxbd_rdptr | tx_val); in mwifiex_pcie_process_recv_data()
1651 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1665 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_boot_cmd() local
1666 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_boot_cmd()
1704 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_fw_port() local
1705 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_init_fw_port()
1706 int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_init_fw_port()
1709 mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | tx_wrap); in mwifiex_pcie_init_fw_port()
1717 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_cmd() local
1718 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_cmd()
1730 if (!card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1747 card->cmd_buf = skb; in mwifiex_pcie_send_cmd()
1764 if (card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1765 cmdrsp_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmdrsp_buf); in mwifiex_pcie_send_cmd()
1777 cmd_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmd_buf); in mwifiex_pcie_send_cmd()
1787 mwifiex_write_reg(adapter, reg->cmd_size, card->cmd_buf->len); in mwifiex_pcie_send_cmd()
1800 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_cmd_complete() local
1801 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_cmd_complete()
1802 struct sk_buff *skb = card->cmdrsp_buf; in mwifiex_pcie_process_cmd_complete()
1812 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1817 if (card->cmd_buf) { in mwifiex_pcie_process_cmd_complete()
1818 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_process_cmd_complete()
1820 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_process_cmd_complete()
1821 card->cmd_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1830 dma_sync_single_for_device(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1864 card->cmdrsp_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1885 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_cmdrsp_complete() local
1888 card->cmdrsp_buf = skb; in mwifiex_pcie_cmdrsp_complete()
1889 skb_push(card->cmdrsp_buf, adapter->intf_hdr_len); in mwifiex_pcie_cmdrsp_complete()
1903 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_event_ready() local
1904 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_event_ready()
1905 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_process_event_ready()
1934 card->evtbd_rdptr, wrptr); in mwifiex_pcie_process_event_ready()
1935 if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr in mwifiex_pcie_process_event_ready()
1938 (card->evtbd_rdptr & reg->evt_rollover_ind))) { in mwifiex_pcie_process_event_ready()
1945 skb_cmd = card->evt_buf_list[rdptr]; in mwifiex_pcie_process_event_ready()
1950 card->evt_buf_list[rdptr] = NULL; in mwifiex_pcie_process_event_ready()
1951 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_process_event_ready()
1993 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_event_complete() local
1994 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_event_complete()
1995 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_event_complete()
2016 if (!card->evt_buf_list[rdptr]) { in mwifiex_pcie_event_complete()
2023 card->evt_buf_list[rdptr] = skb; in mwifiex_pcie_event_complete()
2024 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_event_complete()
2032 rdptr, card->evt_buf_list[rdptr], skb); in mwifiex_pcie_event_complete()
2035 if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { in mwifiex_pcie_event_complete()
2036 card->evtbd_rdptr = ((card->evtbd_rdptr & in mwifiex_pcie_event_complete()
2043 card->evtbd_rdptr, wrptr); in mwifiex_pcie_event_complete()
2046 mwifiex_write_reg(adapter, reg->evt_rdptr, card->evtbd_rdptr); in mwifiex_pcie_event_complete()
2154 * This function downloads the firmware to the card.
2156 * Firmware is downloaded to the card in blocks. Every block download
2170 struct pcie_service_card *card = adapter->card; in mwifiex_prog_fw_w_helper() local
2171 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_prog_fw_w_helper()
2265 tx_blocks = (txlen + card->pcie.blksz_fw_dl - 1) / in mwifiex_prog_fw_w_helper()
2266 card->pcie.blksz_fw_dl; in mwifiex_prog_fw_w_helper()
2273 skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); in mwifiex_prog_fw_w_helper()
2301 mwifiex_dbg(adapter, ERROR, "%s: Card failed to ACK download\n", in mwifiex_prog_fw_w_helper()
2325 * This function checks the firmware status in card.
2332 struct pcie_service_card *card = adapter->card; in mwifiex_check_fw_status() local
2333 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_fw_status()
2376 struct pcie_service_card *card = adapter->card; in mwifiex_check_winner_status() local
2377 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_winner_status()
2393 * This function reads the interrupt status from card.
2400 struct pcie_service_card *card = adapter->card; in mwifiex_interrupt_status() local
2402 if (card->msi_enable) { in mwifiex_interrupt_status()
2412 if (card->msix_enable && msg_id >= 0) { in mwifiex_interrupt_status()
2459 struct pcie_service_card *card; in mwifiex_pcie_interrupt() local
2462 card = pci_get_drvdata(pdev); in mwifiex_pcie_interrupt()
2464 if (!card->adapter) { in mwifiex_pcie_interrupt()
2465 pr_err("info: %s: card=%p adapter=%p\n", __func__, card, in mwifiex_pcie_interrupt()
2466 card ? card->adapter : NULL); in mwifiex_pcie_interrupt()
2469 adapter = card->adapter; in mwifiex_pcie_interrupt()
2474 if (card->msix_enable) in mwifiex_pcie_interrupt()
2495 * In case of Rx packets received, the packets are uploaded from card to
2503 struct pcie_service_card *card = adapter->card; in mwifiex_process_int_status() local
2506 if (!card->msi_enable) { in mwifiex_process_int_status()
2513 if (card->msi_enable) { in mwifiex_process_int_status()
2569 if (!card->msi_enable && !card->msix_enable && in mwifiex_process_int_status()
2577 * This function downloads data from driver to card.
2579 * Both commands and data packets are transferred to the card by this
2613 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_reg_dump() local
2614 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_reg_dump()
2652 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_rdwr_firmware() local
2653 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_rdwr_firmware()
2682 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_fw_dump() local
2683 const struct mwifiex_pcie_card_reg *creg = card->pcie.reg; in mwifiex_pcie_fw_dump()
2690 if (!card->pcie.can_dump_fw) in mwifiex_pcie_fw_dump()
2820 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset_work() local
2825 pci_try_reset_function(card->dev); in mwifiex_pcie_card_reset_work()
2830 struct pcie_service_card *card = in mwifiex_pcie_work() local
2834 &card->work_flags)) in mwifiex_pcie_work()
2835 mwifiex_pcie_device_dump_work(card->adapter); in mwifiex_pcie_work()
2837 &card->work_flags)) in mwifiex_pcie_work()
2838 mwifiex_pcie_card_reset_work(card->adapter); in mwifiex_pcie_work()
2844 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_device_dump() local
2847 &card->work_flags)) in mwifiex_pcie_device_dump()
2848 schedule_work(&card->work); in mwifiex_pcie_device_dump()
2853 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset() local
2855 if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags)) in mwifiex_pcie_card_reset()
2856 schedule_work(&card->work); in mwifiex_pcie_card_reset()
2861 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_buffers() local
2862 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_alloc_buffers()
2865 card->cmdrsp_buf = NULL; in mwifiex_pcie_alloc_buffers()
2897 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_alloc_buffers()
2916 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_free_buffers() local
2917 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_free_buffers()
2933 struct pcie_service_card *card = adapter->card; in mwifiex_init_pcie() local
2935 struct pci_dev *pdev = card->dev; in mwifiex_init_pcie()
2937 pci_set_drvdata(pdev, card); in mwifiex_init_pcie()
2956 card->pci_mmap = pci_iomap(pdev, 0, 0); in mwifiex_init_pcie()
2957 if (!card->pci_mmap) { in mwifiex_init_pcie()
2967 card->pci_mmap1 = pci_iomap(pdev, 2, 0); in mwifiex_init_pcie()
2968 if (!card->pci_mmap1) { in mwifiex_init_pcie()
2975 card->pci_mmap, card->pci_mmap1); in mwifiex_init_pcie()
2987 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_init_pcie()
2991 pci_iounmap(pdev, card->pci_mmap); in mwifiex_init_pcie()
3002 * This function cleans up the allocated card buffers.
3006 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_pcie() local
3007 struct pci_dev *pdev = card->dev; in mwifiex_cleanup_pcie()
3008 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_pcie()
3012 * the card. It's because that function never returns if we're in mwifiex_cleanup_pcie()
3013 * in reset path. If we're here when resetting the card, it means in mwifiex_cleanup_pcie()
3014 * that we failed to reset the card (reset failure path). in mwifiex_cleanup_pcie()
3016 if (!card->pci_reset_ongoing) { in mwifiex_cleanup_pcie()
3018 cancel_work_sync(&card->work); in mwifiex_cleanup_pcie()
3022 "skipped cancel_work_sync() because we're in card reset failure path\n"); in mwifiex_cleanup_pcie()
3034 pci_iounmap(pdev, card->pci_mmap); in mwifiex_cleanup_pcie()
3035 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_cleanup_pcie()
3045 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_request_irq() local
3046 struct pci_dev *pdev = card->dev; in mwifiex_pcie_request_irq()
3048 if (card->pcie.reg->msix_support) { in mwifiex_pcie_request_irq()
3050 card->msix_entries[i].entry = i; in mwifiex_pcie_request_irq()
3051 ret = pci_enable_msix_exact(pdev, card->msix_entries, in mwifiex_pcie_request_irq()
3055 card->msix_ctx[i].dev = pdev; in mwifiex_pcie_request_irq()
3056 card->msix_ctx[i].msg_id = i; in mwifiex_pcie_request_irq()
3058 ret = request_irq(card->msix_entries[i].vector, in mwifiex_pcie_request_irq()
3061 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3070 free_irq(card->msix_entries[j].vector, in mwifiex_pcie_request_irq()
3071 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3075 card->msix_enable = 1; in mwifiex_pcie_request_irq()
3084 card->msi_enable = 1; in mwifiex_pcie_request_irq()
3086 mwifiex_dbg(adapter, INFO, "msi_enable = %d\n", card->msi_enable); in mwifiex_pcie_request_irq()
3088 card->share_irq_ctx.dev = pdev; in mwifiex_pcie_request_irq()
3089 card->share_irq_ctx.msg_id = -1; in mwifiex_pcie_request_irq()
3091 "MRVL_PCIE", &card->share_irq_ctx); in mwifiex_pcie_request_irq()
3109 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_get_fw_name() local
3111 switch (card->dev->device) { in mwifiex_pcie_get_fw_name()
3158 struct pcie_service_card *card = adapter->card; in mwifiex_register_dev() local
3160 /* save adapter pointer in card */ in mwifiex_register_dev()
3161 card->adapter = adapter; in mwifiex_register_dev()
3166 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_register_dev()
3167 adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; in mwifiex_register_dev()
3168 adapter->num_mem_types = card->pcie.num_mem_types; in mwifiex_register_dev()
3169 adapter->ext_scan = card->pcie.can_ext_scan; in mwifiex_register_dev()
3183 struct pcie_service_card *card = adapter->card; in mwifiex_unregister_dev() local
3184 struct pci_dev *pdev = card->dev; in mwifiex_unregister_dev()
3187 if (card->msix_enable) { in mwifiex_unregister_dev()
3189 synchronize_irq(card->msix_entries[i].vector); in mwifiex_unregister_dev()
3192 free_irq(card->msix_entries[i].vector, in mwifiex_unregister_dev()
3193 &card->msix_ctx[i]); in mwifiex_unregister_dev()
3195 card->msix_enable = 0; in mwifiex_unregister_dev()
3200 free_irq(card->dev->irq, &card->share_irq_ctx); in mwifiex_unregister_dev()
3202 if (card->msi_enable) in mwifiex_unregister_dev()
3205 card->adapter = NULL; in mwifiex_unregister_dev()
3214 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_up_dev() local
3215 struct pci_dev *pdev = card->dev; in mwifiex_pcie_up_dev()
3220 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_pcie_up_dev()
3230 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_down_dev() local
3231 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_down_dev()
3232 struct pci_dev *pdev = card->dev; in mwifiex_pcie_down_dev()