Lines Matching full:card

197 	struct pcie_service_card *card = adapter->card;  in mwifiex_map_pci_memory()  local
200 mapping.addr = dma_map_single(&card->dev->dev, skb->data, size, flags); in mwifiex_map_pci_memory()
201 if (dma_mapping_error(&card->dev->dev, mapping.addr)) { in mwifiex_map_pci_memory()
213 struct pcie_service_card *card = adapter->card; in mwifiex_unmap_pci_memory() local
217 dma_unmap_single(&card->dev->dev, mapping.addr, mapping.len, flags); in mwifiex_unmap_pci_memory()
221 * This function writes data into PCIE card register.
225 struct pcie_service_card *card = adapter->card; in mwifiex_write_reg() local
227 iowrite32(data, card->pci_mmap1 + reg); in mwifiex_write_reg()
232 /* This function reads data from PCIE card register.
236 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg() local
238 *data = ioread32(card->pci_mmap1 + reg); in mwifiex_read_reg()
245 /* This function reads u8 data from PCIE card register. */
249 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg_byte() local
251 *data = ioread8(card->pci_mmap1 + reg); in mwifiex_read_reg_byte()
262 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_ok_to_access_hw() local
263 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_ok_to_access_hw()
268 if (card->sleep_cookie_vbase) { in mwifiex_pcie_ok_to_access_hw()
269 cookie_value = get_unaligned_le32(card->sleep_cookie_vbase); in mwifiex_pcie_ok_to_access_hw()
284 * methods. Failing that the kernel simply removes the whole card.
292 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_suspend() local
296 wait_for_completion(&card->fw_done); in mwifiex_pcie_suspend()
298 adapter = card->adapter; in mwifiex_pcie_suspend()
327 * methods. Failing that the kernel simply removes the whole card.
335 struct pcie_service_card *card = dev_get_drvdata(dev); in mwifiex_pcie_resume() local
338 if (!card->adapter) { in mwifiex_pcie_resume()
343 adapter = card->adapter; in mwifiex_pcie_resume()
363 * the card structure, enables PCIE function number and initiates the
370 struct pcie_service_card *card; in mwifiex_pcie_probe() local
376 card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); in mwifiex_pcie_probe()
377 if (!card) in mwifiex_pcie_probe()
380 init_completion(&card->fw_done); in mwifiex_pcie_probe()
382 card->dev = pdev; in mwifiex_pcie_probe()
386 card->pcie.reg = data->reg; in mwifiex_pcie_probe()
387 card->pcie.blksz_fw_dl = data->blksz_fw_dl; in mwifiex_pcie_probe()
388 card->pcie.tx_buf_size = data->tx_buf_size; in mwifiex_pcie_probe()
389 card->pcie.can_dump_fw = data->can_dump_fw; in mwifiex_pcie_probe()
390 card->pcie.mem_type_mapping_tbl = data->mem_type_mapping_tbl; in mwifiex_pcie_probe()
391 card->pcie.num_mem_types = data->num_mem_types; in mwifiex_pcie_probe()
392 card->pcie.can_ext_scan = data->can_ext_scan; in mwifiex_pcie_probe()
393 INIT_WORK(&card->work, mwifiex_pcie_work); in mwifiex_pcie_probe()
404 mwifiex_initialize_quirks(card); in mwifiex_pcie_probe()
406 if (mwifiex_add_card(card, &card->fw_done, &pcie_ops, in mwifiex_pcie_probe()
416 * This function removes the interface and frees up the card structure.
420 struct pcie_service_card *card; in mwifiex_pcie_remove() local
426 card = pci_get_drvdata(pdev); in mwifiex_pcie_remove()
428 wait_for_completion(&card->fw_done); in mwifiex_pcie_remove()
430 adapter = card->adapter; in mwifiex_pcie_remove()
434 reg = card->pcie.reg; in mwifiex_pcie_remove()
463 struct pcie_service_card *card; in mwifiex_pcie_coredump() local
466 card = pci_get_drvdata(pdev); in mwifiex_pcie_coredump()
469 &card->work_flags)) in mwifiex_pcie_coredump()
470 schedule_work(&card->work); in mwifiex_pcie_coredump()
504 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_prepare() local
505 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_prepare()
518 clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); in mwifiex_pcie_reset_prepare()
519 clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); in mwifiex_pcie_reset_prepare()
522 * hangups, so we power-cycle the card instead. in mwifiex_pcie_reset_prepare()
524 if (card->quirks & QUIRK_FW_RST_D3COLD) in mwifiex_pcie_reset_prepare()
529 card->pci_reset_ongoing = true; in mwifiex_pcie_reset_prepare()
539 struct pcie_service_card *card = pci_get_drvdata(pdev); in mwifiex_pcie_reset_done() local
540 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_done()
559 card->pci_reset_ongoing = false; in mwifiex_pcie_reset_done()
610 struct pcie_service_card *card = adapter->card; in mwifiex_delay_for_sleep_cookie() local
613 struct sk_buff *cmdrsp = card->cmdrsp_buf; in mwifiex_delay_for_sleep_cookie()
616 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
627 dma_sync_single_for_device(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
642 /* This function wakes up the card by reading fw_status register. */
645 struct pcie_service_card *card = adapter->card; in mwifiex_pm_wakeup_card() local
646 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pm_wakeup_card()
657 * until we receive an interrupt from the card. in mwifiex_pm_wakeup_card()
686 * This function is called after the card has woken up.
688 * The card configuration register is reset.
702 * written back to the card host interrupt mask register.
727 * The host interrupt enable mask is written to the card
750 struct pcie_service_card *card = adapter->card; in mwifiex_init_txq_ring() local
751 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_txq_ring()
757 card->tx_buf_list[i] = NULL; in mwifiex_init_txq_ring()
759 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
761 desc2 = card->txbd_ring[i]; in mwifiex_init_txq_ring()
764 card->txbd_ring[i] = (void *)card->txbd_ring_vbase + in mwifiex_init_txq_ring()
766 desc = card->txbd_ring[i]; in mwifiex_init_txq_ring()
780 struct pcie_service_card *card = adapter->card; in mwifiex_init_rxq_ring() local
781 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_rxq_ring()
795 kfree(card->rxbd_ring_vbase); in mwifiex_init_rxq_ring()
811 card->rx_buf_list[i] = skb; in mwifiex_init_rxq_ring()
813 card->rxbd_ring[i] = (void *)card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
815 desc2 = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
822 card->rxbd_ring[i] = (void *)(card->rxbd_ring_vbase + in mwifiex_init_rxq_ring()
824 desc = card->rxbd_ring[i]; in mwifiex_init_rxq_ring()
840 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_evt_ring() local
852 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
860 kfree(card->evtbd_ring_vbase); in mwifiex_pcie_init_evt_ring()
871 card->evt_buf_list[i] = skb; in mwifiex_pcie_init_evt_ring()
872 card->evtbd_ring[i] = (void *)(card->evtbd_ring_vbase + in mwifiex_pcie_init_evt_ring()
874 desc = card->evtbd_ring[i]; in mwifiex_pcie_init_evt_ring()
888 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_txq_ring() local
889 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_txq_ring()
897 desc2 = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
898 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
899 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
906 desc = card->txbd_ring[i]; in mwifiex_cleanup_txq_ring()
907 if (card->tx_buf_list[i]) { in mwifiex_cleanup_txq_ring()
908 skb = card->tx_buf_list[i]; in mwifiex_cleanup_txq_ring()
915 card->tx_buf_list[i] = NULL; in mwifiex_cleanup_txq_ring()
927 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_rxq_ring() local
928 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_rxq_ring()
936 desc2 = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
937 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
938 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
945 desc = card->rxbd_ring[i]; in mwifiex_cleanup_rxq_ring()
946 if (card->rx_buf_list[i]) { in mwifiex_cleanup_rxq_ring()
947 skb = card->rx_buf_list[i]; in mwifiex_cleanup_rxq_ring()
954 card->rx_buf_list[i] = NULL; in mwifiex_cleanup_rxq_ring()
965 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_evt_ring() local
971 desc = card->evtbd_ring[i]; in mwifiex_cleanup_evt_ring()
972 if (card->evt_buf_list[i]) { in mwifiex_cleanup_evt_ring()
973 skb = card->evt_buf_list[i]; in mwifiex_cleanup_evt_ring()
978 card->evt_buf_list[i] = NULL; in mwifiex_cleanup_evt_ring()
989 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_txbd_ring() local
990 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_txbd_ring()
997 card->txbd_wrptr = 0; in mwifiex_pcie_create_txbd_ring()
1000 card->txbd_rdptr = 0; in mwifiex_pcie_create_txbd_ring()
1002 card->txbd_rdptr |= reg->tx_rollover_ind; in mwifiex_pcie_create_txbd_ring()
1007 card->txbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1010 card->txbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_txbd_ring()
1015 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1016 card->txbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_txbd_ring()
1017 card->txbd_ring_size, in mwifiex_pcie_create_txbd_ring()
1018 &card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1020 if (!card->txbd_ring_vbase) { in mwifiex_pcie_create_txbd_ring()
1023 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1029 card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, in mwifiex_pcie_create_txbd_ring()
1030 (u32)((u64)card->txbd_ring_pbase >> 32), in mwifiex_pcie_create_txbd_ring()
1031 card->txbd_ring_size); in mwifiex_pcie_create_txbd_ring()
1038 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_txbd_ring() local
1039 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_txbd_ring()
1043 if (card->txbd_ring_vbase) in mwifiex_pcie_delete_txbd_ring()
1044 dma_free_coherent(&card->dev->dev, card->txbd_ring_size, in mwifiex_pcie_delete_txbd_ring()
1045 card->txbd_ring_vbase, in mwifiex_pcie_delete_txbd_ring()
1046 card->txbd_ring_pbase); in mwifiex_pcie_delete_txbd_ring()
1047 card->txbd_ring_size = 0; in mwifiex_pcie_delete_txbd_ring()
1048 card->txbd_wrptr = 0; in mwifiex_pcie_delete_txbd_ring()
1049 card->txbd_rdptr = 0 | reg->tx_rollover_ind; in mwifiex_pcie_delete_txbd_ring()
1050 card->txbd_ring_vbase = NULL; in mwifiex_pcie_delete_txbd_ring()
1051 card->txbd_ring_pbase = 0; in mwifiex_pcie_delete_txbd_ring()
1061 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_rxbd_ring() local
1062 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_rxbd_ring()
1069 card->rxbd_wrptr = 0; in mwifiex_pcie_create_rxbd_ring()
1070 card->rxbd_rdptr = reg->rx_rollover_ind; in mwifiex_pcie_create_rxbd_ring()
1073 card->rxbd_ring_size = sizeof(struct mwifiex_pfu_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1076 card->rxbd_ring_size = sizeof(struct mwifiex_pcie_buf_desc) * in mwifiex_pcie_create_rxbd_ring()
1081 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1082 card->rxbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_rxbd_ring()
1083 card->rxbd_ring_size, in mwifiex_pcie_create_rxbd_ring()
1084 &card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1086 if (!card->rxbd_ring_vbase) { in mwifiex_pcie_create_rxbd_ring()
1089 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1095 card->rxbd_ring_vbase, (u32)card->rxbd_ring_pbase, in mwifiex_pcie_create_rxbd_ring()
1096 (u32)((u64)card->rxbd_ring_pbase >> 32), in mwifiex_pcie_create_rxbd_ring()
1097 card->rxbd_ring_size); in mwifiex_pcie_create_rxbd_ring()
1107 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_rxbd_ring() local
1108 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_rxbd_ring()
1112 if (card->rxbd_ring_vbase) in mwifiex_pcie_delete_rxbd_ring()
1113 dma_free_coherent(&card->dev->dev, card->rxbd_ring_size, in mwifiex_pcie_delete_rxbd_ring()
1114 card->rxbd_ring_vbase, in mwifiex_pcie_delete_rxbd_ring()
1115 card->rxbd_ring_pbase); in mwifiex_pcie_delete_rxbd_ring()
1116 card->rxbd_ring_size = 0; in mwifiex_pcie_delete_rxbd_ring()
1117 card->rxbd_wrptr = 0; in mwifiex_pcie_delete_rxbd_ring()
1118 card->rxbd_rdptr = 0 | reg->rx_rollover_ind; in mwifiex_pcie_delete_rxbd_ring()
1119 card->rxbd_ring_vbase = NULL; in mwifiex_pcie_delete_rxbd_ring()
1120 card->rxbd_ring_pbase = 0; in mwifiex_pcie_delete_rxbd_ring()
1130 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_create_evtbd_ring() local
1131 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_evtbd_ring()
1138 card->evtbd_wrptr = 0; in mwifiex_pcie_create_evtbd_ring()
1139 card->evtbd_rdptr = reg->evt_rollover_ind; in mwifiex_pcie_create_evtbd_ring()
1141 card->evtbd_ring_size = sizeof(struct mwifiex_evt_buf_desc) * in mwifiex_pcie_create_evtbd_ring()
1146 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1147 card->evtbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_create_evtbd_ring()
1148 card->evtbd_ring_size, in mwifiex_pcie_create_evtbd_ring()
1149 &card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1151 if (!card->evtbd_ring_vbase) { in mwifiex_pcie_create_evtbd_ring()
1154 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1160 card->evtbd_ring_vbase, (u32)card->evtbd_ring_pbase, in mwifiex_pcie_create_evtbd_ring()
1161 (u32)((u64)card->evtbd_ring_pbase >> 32), in mwifiex_pcie_create_evtbd_ring()
1162 card->evtbd_ring_size); in mwifiex_pcie_create_evtbd_ring()
1172 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_delete_evtbd_ring() local
1173 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_delete_evtbd_ring()
1177 if (card->evtbd_ring_vbase) in mwifiex_pcie_delete_evtbd_ring()
1178 dma_free_coherent(&card->dev->dev, card->evtbd_ring_size, in mwifiex_pcie_delete_evtbd_ring()
1179 card->evtbd_ring_vbase, in mwifiex_pcie_delete_evtbd_ring()
1180 card->evtbd_ring_pbase); in mwifiex_pcie_delete_evtbd_ring()
1181 card->evtbd_wrptr = 0; in mwifiex_pcie_delete_evtbd_ring()
1182 card->evtbd_rdptr = 0 | reg->evt_rollover_ind; in mwifiex_pcie_delete_evtbd_ring()
1183 card->evtbd_ring_size = 0; in mwifiex_pcie_delete_evtbd_ring()
1184 card->evtbd_ring_vbase = NULL; in mwifiex_pcie_delete_evtbd_ring()
1185 card->evtbd_ring_pbase = 0; in mwifiex_pcie_delete_evtbd_ring()
1195 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_cmdrsp_buf() local
1212 card->cmdrsp_buf = skb; in mwifiex_pcie_alloc_cmdrsp_buf()
1222 struct pcie_service_card *card; in mwifiex_pcie_delete_cmdrsp_buf() local
1227 card = adapter->card; in mwifiex_pcie_delete_cmdrsp_buf()
1229 if (card && card->cmdrsp_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1230 mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1232 dev_kfree_skb_any(card->cmdrsp_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1233 card->cmdrsp_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1236 if (card && card->cmd_buf) { in mwifiex_pcie_delete_cmdrsp_buf()
1237 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_delete_cmdrsp_buf()
1239 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_delete_cmdrsp_buf()
1240 card->cmd_buf = NULL; in mwifiex_pcie_delete_cmdrsp_buf()
1250 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_sleep_cookie_buf() local
1253 card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, in mwifiex_pcie_alloc_sleep_cookie_buf()
1255 &card->sleep_cookie_pbase, in mwifiex_pcie_alloc_sleep_cookie_buf()
1257 if (!card->sleep_cookie_vbase) { in mwifiex_pcie_alloc_sleep_cookie_buf()
1262 cookie = (u32 *)card->sleep_cookie_vbase; in mwifiex_pcie_alloc_sleep_cookie_buf()
1276 struct pcie_service_card *card; in mwifiex_pcie_delete_sleep_cookie_buf() local
1281 card = adapter->card; in mwifiex_pcie_delete_sleep_cookie_buf()
1283 if (card && card->sleep_cookie_vbase) { in mwifiex_pcie_delete_sleep_cookie_buf()
1284 dma_free_coherent(&card->dev->dev, sizeof(u32), in mwifiex_pcie_delete_sleep_cookie_buf()
1285 card->sleep_cookie_vbase, in mwifiex_pcie_delete_sleep_cookie_buf()
1286 card->sleep_cookie_pbase); in mwifiex_pcie_delete_sleep_cookie_buf()
1287 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_delete_sleep_cookie_buf()
1299 struct pcie_service_card *card = adapter->card; in mwifiex_clean_pcie_ring_buf() local
1301 if (!mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) { in mwifiex_clean_pcie_ring_buf()
1302 card->txbd_flush = 1; in mwifiex_clean_pcie_ring_buf()
1325 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data_complete() local
1326 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data_complete()
1340 card->txbd_rdptr, rdptr); in mwifiex_pcie_send_data_complete()
1344 while (((card->txbd_rdptr & reg->tx_mask) != in mwifiex_pcie_send_data_complete()
1346 ((card->txbd_rdptr & reg->tx_rollover_ind) != in mwifiex_pcie_send_data_complete()
1348 wrdoneidx = (card->txbd_rdptr & reg->tx_mask) >> in mwifiex_pcie_send_data_complete()
1351 skb = card->tx_buf_list[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1362 if (card->txbd_flush) in mwifiex_pcie_send_data_complete()
1370 card->tx_buf_list[wrdoneidx] = NULL; in mwifiex_pcie_send_data_complete()
1373 desc2 = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1376 desc = card->txbd_ring[wrdoneidx]; in mwifiex_pcie_send_data_complete()
1379 switch (card->dev->device) { in mwifiex_pcie_send_data_complete()
1381 card->txbd_rdptr++; in mwifiex_pcie_send_data_complete()
1385 card->txbd_rdptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data_complete()
1390 if ((card->txbd_rdptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data_complete()
1391 card->txbd_rdptr = ((card->txbd_rdptr & in mwifiex_pcie_send_data_complete()
1399 if (card->txbd_flush) { in mwifiex_pcie_send_data_complete()
1400 if (mwifiex_pcie_txbd_empty(card, card->txbd_rdptr)) in mwifiex_pcie_send_data_complete()
1401 card->txbd_flush = 0; in mwifiex_pcie_send_data_complete()
1420 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data() local
1421 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data()
1441 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1442 if (mwifiex_pcie_txbd_not_full(card)) { in mwifiex_pcie_send_data()
1454 wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; in mwifiex_pcie_send_data()
1456 card->tx_buf_list[wrindx] = skb; in mwifiex_pcie_send_data()
1460 desc2 = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1468 desc = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1475 switch (card->dev->device) { in mwifiex_pcie_send_data()
1477 card->txbd_wrptr++; in mwifiex_pcie_send_data()
1481 card->txbd_wrptr += reg->ring_tx_start_ptr; in mwifiex_pcie_send_data()
1485 if ((card->txbd_wrptr & reg->tx_mask) == num_tx_buffs) in mwifiex_pcie_send_data()
1486 card->txbd_wrptr = ((card->txbd_wrptr & in mwifiex_pcie_send_data()
1490 rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; in mwifiex_pcie_send_data()
1493 card->txbd_wrptr | rx_val)) { in mwifiex_pcie_send_data()
1500 /* The firmware (latest version 15.68.19.p21) of the 88W8897 PCIe+USB card in mwifiex_pcie_send_data()
1507 if ((mwifiex_pcie_txbd_not_full(card)) && in mwifiex_pcie_send_data()
1526 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1542 card->tx_buf_list[wrindx] = NULL; in mwifiex_pcie_send_data()
1558 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_recv_data() local
1559 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_recv_data()
1577 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1580 (card->rxbd_rdptr & reg->rx_mask)) || in mwifiex_pcie_process_recv_data()
1582 (card->rxbd_rdptr & reg->rx_rollover_ind))) { in mwifiex_pcie_process_recv_data()
1586 rd_index = card->rxbd_rdptr & reg->rx_mask; in mwifiex_pcie_process_recv_data()
1587 skb_data = card->rx_buf_list[rd_index]; in mwifiex_pcie_process_recv_data()
1596 card->rx_buf_list[rd_index] = NULL; in mwifiex_pcie_process_recv_data()
1606 rx_len, card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1612 card->rxbd_rdptr, wrptr, rx_len); in mwifiex_pcie_process_recv_data()
1641 card->rx_buf_list[rd_index] = skb_tmp; in mwifiex_pcie_process_recv_data()
1644 desc2 = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1651 desc = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1657 if ((++card->rxbd_rdptr & reg->rx_mask) == in mwifiex_pcie_process_recv_data()
1659 card->rxbd_rdptr = ((card->rxbd_rdptr & in mwifiex_pcie_process_recv_data()
1665 card->rxbd_rdptr, wrptr); in mwifiex_pcie_process_recv_data()
1667 tx_val = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_process_recv_data()
1670 card->rxbd_rdptr | tx_val)) { in mwifiex_pcie_process_recv_data()
1686 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1700 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_boot_cmd() local
1701 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_boot_cmd()
1764 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_fw_port() local
1765 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_init_fw_port()
1766 int tx_wrap = card->txbd_wrptr & reg->tx_wrap_mask; in mwifiex_pcie_init_fw_port()
1769 if (mwifiex_write_reg(adapter, reg->rx_rdptr, card->rxbd_rdptr | in mwifiex_pcie_init_fw_port()
1783 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_cmd() local
1784 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_cmd()
1797 if (!card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1814 card->cmd_buf = skb; in mwifiex_pcie_send_cmd()
1831 if (card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1832 cmdrsp_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmdrsp_buf); in mwifiex_pcie_send_cmd()
1853 cmd_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmd_buf); in mwifiex_pcie_send_cmd()
1873 card->cmd_buf->len)) { in mwifiex_pcie_send_cmd()
1901 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_cmd_complete() local
1902 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_cmd_complete()
1903 struct sk_buff *skb = card->cmdrsp_buf; in mwifiex_pcie_process_cmd_complete()
1913 dma_sync_single_for_cpu(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1918 if (card->cmd_buf) { in mwifiex_pcie_process_cmd_complete()
1919 mwifiex_unmap_pci_memory(adapter, card->cmd_buf, in mwifiex_pcie_process_cmd_complete()
1921 dev_kfree_skb_any(card->cmd_buf); in mwifiex_pcie_process_cmd_complete()
1922 card->cmd_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1931 dma_sync_single_for_device(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1969 card->cmdrsp_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1997 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_cmdrsp_complete() local
2000 card->cmdrsp_buf = skb; in mwifiex_pcie_cmdrsp_complete()
2001 skb_push(card->cmdrsp_buf, adapter->intf_hdr_len); in mwifiex_pcie_cmdrsp_complete()
2015 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_event_ready() local
2016 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_event_ready()
2017 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_process_event_ready()
2046 card->evtbd_rdptr, wrptr); in mwifiex_pcie_process_event_ready()
2047 if (((wrptr & MWIFIEX_EVTBD_MASK) != (card->evtbd_rdptr in mwifiex_pcie_process_event_ready()
2050 (card->evtbd_rdptr & reg->evt_rollover_ind))) { in mwifiex_pcie_process_event_ready()
2057 skb_cmd = card->evt_buf_list[rdptr]; in mwifiex_pcie_process_event_ready()
2062 card->evt_buf_list[rdptr] = NULL; in mwifiex_pcie_process_event_ready()
2063 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_process_event_ready()
2109 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_event_complete() local
2110 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_event_complete()
2112 u32 rdptr = card->evtbd_rdptr & MWIFIEX_EVTBD_MASK; in mwifiex_pcie_event_complete()
2133 if (!card->evt_buf_list[rdptr]) { in mwifiex_pcie_event_complete()
2140 card->evt_buf_list[rdptr] = skb; in mwifiex_pcie_event_complete()
2141 desc = card->evtbd_ring[rdptr]; in mwifiex_pcie_event_complete()
2149 rdptr, card->evt_buf_list[rdptr], skb); in mwifiex_pcie_event_complete()
2152 if ((++card->evtbd_rdptr & MWIFIEX_EVTBD_MASK) == MWIFIEX_MAX_EVT_BD) { in mwifiex_pcie_event_complete()
2153 card->evtbd_rdptr = ((card->evtbd_rdptr & in mwifiex_pcie_event_complete()
2160 card->evtbd_rdptr, wrptr); in mwifiex_pcie_event_complete()
2164 card->evtbd_rdptr)) { in mwifiex_pcie_event_complete()
2278 * This function downloads the firmware to the card.
2280 * Firmware is downloaded to the card in blocks. Every block download
2294 struct pcie_service_card *card = adapter->card; in mwifiex_prog_fw_w_helper() local
2295 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_prog_fw_w_helper()
2393 tx_blocks = (txlen + card->pcie.blksz_fw_dl - 1) / in mwifiex_prog_fw_w_helper()
2394 card->pcie.blksz_fw_dl; in mwifiex_prog_fw_w_helper()
2401 skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); in mwifiex_prog_fw_w_helper()
2429 mwifiex_dbg(adapter, ERROR, "%s: Card failed to ACK download\n", in mwifiex_prog_fw_w_helper()
2453 * This function checks the firmware status in card.
2460 struct pcie_service_card *card = adapter->card; in mwifiex_check_fw_status() local
2461 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_fw_status()
2513 struct pcie_service_card *card = adapter->card; in mwifiex_check_winner_status() local
2514 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_winner_status()
2530 * This function reads the interrupt status from card.
2537 struct pcie_service_card *card = adapter->card; in mwifiex_interrupt_status() local
2539 if (card->msi_enable) { in mwifiex_interrupt_status()
2549 if (card->msix_enable && msg_id >= 0) { in mwifiex_interrupt_status()
2601 struct pcie_service_card *card; in mwifiex_pcie_interrupt() local
2604 card = pci_get_drvdata(pdev); in mwifiex_pcie_interrupt()
2606 if (!card->adapter) { in mwifiex_pcie_interrupt()
2607 pr_err("info: %s: card=%p adapter=%p\n", __func__, card, in mwifiex_pcie_interrupt()
2608 card ? card->adapter : NULL); in mwifiex_pcie_interrupt()
2611 adapter = card->adapter; in mwifiex_pcie_interrupt()
2616 if (card->msix_enable) in mwifiex_pcie_interrupt()
2637 * In case of Rx packets received, the packets are uploaded from card to
2645 struct pcie_service_card *card = adapter->card; in mwifiex_process_int_status() local
2648 if (!card->msi_enable) { in mwifiex_process_int_status()
2655 if (card->msi_enable) { in mwifiex_process_int_status()
2715 if (!card->msi_enable && !card->msix_enable && in mwifiex_process_int_status()
2723 * This function downloads data from driver to card.
2725 * Both commands and data packets are transferred to the card by this
2759 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_reg_dump() local
2760 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_reg_dump()
2798 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_rdwr_firmware() local
2799 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_rdwr_firmware()
2839 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_fw_dump() local
2840 const struct mwifiex_pcie_card_reg *creg = card->pcie.reg; in mwifiex_pcie_fw_dump()
2848 if (!card->pcie.can_dump_fw) in mwifiex_pcie_fw_dump()
2982 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset_work() local
2987 pci_try_reset_function(card->dev); in mwifiex_pcie_card_reset_work()
2992 struct pcie_service_card *card = in mwifiex_pcie_work() local
2996 &card->work_flags)) in mwifiex_pcie_work()
2997 mwifiex_pcie_device_dump_work(card->adapter); in mwifiex_pcie_work()
2999 &card->work_flags)) in mwifiex_pcie_work()
3000 mwifiex_pcie_card_reset_work(card->adapter); in mwifiex_pcie_work()
3006 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_device_dump() local
3009 &card->work_flags)) in mwifiex_pcie_device_dump()
3010 schedule_work(&card->work); in mwifiex_pcie_device_dump()
3015 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset() local
3017 if (!test_and_set_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags)) in mwifiex_pcie_card_reset()
3018 schedule_work(&card->work); in mwifiex_pcie_card_reset()
3023 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_alloc_buffers() local
3024 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_alloc_buffers()
3027 card->cmdrsp_buf = NULL; in mwifiex_pcie_alloc_buffers()
3059 card->sleep_cookie_vbase = NULL; in mwifiex_pcie_alloc_buffers()
3078 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_free_buffers() local
3079 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_free_buffers()
3095 struct pcie_service_card *card = adapter->card; in mwifiex_init_pcie() local
3097 struct pci_dev *pdev = card->dev; in mwifiex_init_pcie()
3099 pci_set_drvdata(pdev, card); in mwifiex_init_pcie()
3118 card->pci_mmap = pci_iomap(pdev, 0, 0); in mwifiex_init_pcie()
3119 if (!card->pci_mmap) { in mwifiex_init_pcie()
3129 card->pci_mmap1 = pci_iomap(pdev, 2, 0); in mwifiex_init_pcie()
3130 if (!card->pci_mmap1) { in mwifiex_init_pcie()
3137 card->pci_mmap, card->pci_mmap1); in mwifiex_init_pcie()
3149 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_init_pcie()
3153 pci_iounmap(pdev, card->pci_mmap); in mwifiex_init_pcie()
3164 * This function cleans up the allocated card buffers.
3168 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_pcie() local
3169 struct pci_dev *pdev = card->dev; in mwifiex_cleanup_pcie()
3170 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_pcie()
3174 * the card. It's because that function never returns if we're in mwifiex_cleanup_pcie()
3175 * in reset path. If we're here when resetting the card, it means in mwifiex_cleanup_pcie()
3176 * that we failed to reset the card (reset failure path). in mwifiex_cleanup_pcie()
3178 if (!card->pci_reset_ongoing) { in mwifiex_cleanup_pcie()
3180 cancel_work_sync(&card->work); in mwifiex_cleanup_pcie()
3184 "skipped cancel_work_sync() because we're in card reset failure path\n"); in mwifiex_cleanup_pcie()
3198 pci_iounmap(pdev, card->pci_mmap); in mwifiex_cleanup_pcie()
3199 pci_iounmap(pdev, card->pci_mmap1); in mwifiex_cleanup_pcie()
3209 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_request_irq() local
3210 struct pci_dev *pdev = card->dev; in mwifiex_pcie_request_irq()
3212 if (card->pcie.reg->msix_support) { in mwifiex_pcie_request_irq()
3214 card->msix_entries[i].entry = i; in mwifiex_pcie_request_irq()
3215 ret = pci_enable_msix_exact(pdev, card->msix_entries, in mwifiex_pcie_request_irq()
3219 card->msix_ctx[i].dev = pdev; in mwifiex_pcie_request_irq()
3220 card->msix_ctx[i].msg_id = i; in mwifiex_pcie_request_irq()
3222 ret = request_irq(card->msix_entries[i].vector, in mwifiex_pcie_request_irq()
3225 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3234 free_irq(card->msix_entries[j].vector, in mwifiex_pcie_request_irq()
3235 &card->msix_ctx[i]); in mwifiex_pcie_request_irq()
3239 card->msix_enable = 1; in mwifiex_pcie_request_irq()
3248 card->msi_enable = 1; in mwifiex_pcie_request_irq()
3250 mwifiex_dbg(adapter, INFO, "msi_enable = %d\n", card->msi_enable); in mwifiex_pcie_request_irq()
3252 card->share_irq_ctx.dev = pdev; in mwifiex_pcie_request_irq()
3253 card->share_irq_ctx.msg_id = -1; in mwifiex_pcie_request_irq()
3255 "MRVL_PCIE", &card->share_irq_ctx); in mwifiex_pcie_request_irq()
3273 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_get_fw_name() local
3275 switch (card->dev->device) { in mwifiex_pcie_get_fw_name()
3322 struct pcie_service_card *card = adapter->card; in mwifiex_register_dev() local
3324 /* save adapter pointer in card */ in mwifiex_register_dev()
3325 card->adapter = adapter; in mwifiex_register_dev()
3330 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_register_dev()
3331 adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; in mwifiex_register_dev()
3332 adapter->num_mem_types = card->pcie.num_mem_types; in mwifiex_register_dev()
3333 adapter->ext_scan = card->pcie.can_ext_scan; in mwifiex_register_dev()
3347 struct pcie_service_card *card = adapter->card; in mwifiex_unregister_dev() local
3348 struct pci_dev *pdev = card->dev; in mwifiex_unregister_dev()
3351 if (card->msix_enable) { in mwifiex_unregister_dev()
3353 synchronize_irq(card->msix_entries[i].vector); in mwifiex_unregister_dev()
3356 free_irq(card->msix_entries[i].vector, in mwifiex_unregister_dev()
3357 &card->msix_ctx[i]); in mwifiex_unregister_dev()
3359 card->msix_enable = 0; in mwifiex_unregister_dev()
3364 free_irq(card->dev->irq, &card->share_irq_ctx); in mwifiex_unregister_dev()
3366 if (card->msi_enable) in mwifiex_unregister_dev()
3369 card->adapter = NULL; in mwifiex_unregister_dev()
3378 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_up_dev() local
3379 struct pci_dev *pdev = card->dev; in mwifiex_pcie_up_dev()
3384 adapter->tx_buf_size = card->pcie.tx_buf_size; in mwifiex_pcie_up_dev()
3394 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_down_dev() local
3395 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_down_dev()
3396 struct pci_dev *pdev = card->dev; in mwifiex_pcie_down_dev()