Lines Matching +full:no +full:- +full:read +full:- +full:rollover

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright 2011-2020 NXP
183 if (!of_match_node(mwifiex_pcie_of_match_table, dev->of_node)) { in mwifiex_pcie_probe_of()
185 return -EINVAL; in mwifiex_pcie_probe_of()
199 struct pcie_service_card *card = adapter->card; in mwifiex_map_pci_memory()
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()
205 return -1; in mwifiex_map_pci_memory()
215 struct pcie_service_card *card = adapter->card; in mwifiex_unmap_pci_memory()
219 dma_unmap_single(&card->dev->dev, mapping.addr, mapping.len, flags); in mwifiex_unmap_pci_memory()
228 struct pcie_service_card *card = adapter->card; in mwifiex_write_reg()
230 iowrite32(data, card->pci_mmap1 + reg); in mwifiex_write_reg()
233 /* Non-void wrapper needed for read_poll_timeout(). */
245 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg()
247 *data = ioread32(card->pci_mmap1 + reg); in mwifiex_read_reg()
258 struct pcie_service_card *card = adapter->card; in mwifiex_read_reg_byte()
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()
272 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_ok_to_access_hw()
274 if (!reg->sleep_cookie) 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()
305 wait_for_completion(&card->fw_done); in mwifiex_pcie_suspend()
307 adapter = card->adapter; in mwifiex_pcie_suspend()
319 clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags); in mwifiex_pcie_suspend()
321 return -EFAULT; in mwifiex_pcie_suspend()
324 flush_workqueue(adapter->workqueue); in mwifiex_pcie_suspend()
327 set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_pcie_suspend()
328 clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags); in mwifiex_pcie_suspend()
347 if (!card->adapter) { in mwifiex_pcie_resume()
352 adapter = card->adapter; in mwifiex_pcie_resume()
354 if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) { in mwifiex_pcie_resume()
360 clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags); in mwifiex_pcie_resume()
383 pdev->vendor, pdev->device, pdev->revision); in mwifiex_pcie_probe()
385 card = devm_kzalloc(&pdev->dev, sizeof(*card), GFP_KERNEL); in mwifiex_pcie_probe()
387 return -ENOMEM; in mwifiex_pcie_probe()
389 init_completion(&card->fw_done); in mwifiex_pcie_probe()
391 card->dev = pdev; in mwifiex_pcie_probe()
393 if (ent->driver_data) { in mwifiex_pcie_probe()
394 struct mwifiex_pcie_device *data = (void *)ent->driver_data; 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()
406 if (pdev->dev.of_node) { in mwifiex_pcie_probe()
407 ret = mwifiex_pcie_probe_of(&pdev->dev); in mwifiex_pcie_probe()
415 if (mwifiex_add_card(card, &card->fw_done, &pcie_ops, in mwifiex_pcie_probe()
416 MWIFIEX_PCIE, &pdev->dev)) { in mwifiex_pcie_probe()
418 return -1; in mwifiex_pcie_probe()
437 wait_for_completion(&card->fw_done); in mwifiex_pcie_remove()
439 adapter = card->adapter; in mwifiex_pcie_remove()
440 if (!adapter || !adapter->priv_num) in mwifiex_pcie_remove()
443 reg = card->pcie.reg; in mwifiex_pcie_remove()
445 mwifiex_read_reg(adapter, reg->fw_status, &fw_status); in mwifiex_pcie_remove()
447 fw_status = -1; in mwifiex_pcie_remove()
449 if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) { in mwifiex_pcie_remove()
478 &card->work_flags)) in mwifiex_pcie_coredump()
479 schedule_work(&card->work); in mwifiex_pcie_coredump()
514 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_prepare()
517 dev_err(&pdev->dev, "%s: adapter structure is not valid\n", in mwifiex_pcie_reset_prepare()
523 "%s: vendor=0x%4.04x device=0x%4.04x rev=%d Pre-FLR\n", in mwifiex_pcie_reset_prepare()
524 __func__, pdev->vendor, pdev->device, pdev->revision); 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()
549 struct mwifiex_adapter *adapter = card->adapter; in mwifiex_pcie_reset_done()
553 dev_err(&pdev->dev, "%s: adapter structure is not valid\n", in mwifiex_pcie_reset_done()
559 "%s: vendor=0x%4.04x device=0x%4.04x rev=%d Post-FLR\n", in mwifiex_pcie_reset_done()
560 __func__, pdev->vendor, pdev->device, pdev->revision); in mwifiex_pcie_reset_done()
564 dev_err(&pdev->dev, "reinit failed: %d\n", ret); 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()
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()
628 buffer = cmdrsp->data; in mwifiex_delay_for_sleep_cookie()
636 dma_sync_single_for_device(&card->dev->dev, in mwifiex_delay_for_sleep_cookie()
654 struct pcie_service_card *card = adapter->card; in mwifiex_pm_wakeup_card()
655 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pm_wakeup_card()
661 if (reg->sleep_cookie) in mwifiex_pm_wakeup_card()
669 READ_ONCE(adapter->int_status) != 0, in mwifiex_pm_wakeup_card()
672 adapter, reg->fw_status, FIRMWARE_READY_PCIE)) { in mwifiex_pm_wakeup_card()
674 READ_ONCE(adapter->int_status) != 0, in mwifiex_pm_wakeup_card()
677 adapter, reg->fw_status, FIRMWARE_READY_PCIE)) { in mwifiex_pm_wakeup_card()
680 return -EIO; in mwifiex_pm_wakeup_card()
684 if (reg->sleep_cookie) { in mwifiex_pm_wakeup_card()
688 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_pm_wakeup_card()
710 * The host interrupt mask is read, the disable bit is reset and
718 atomic_set(&adapter->tx_hw_pending, 0); in mwifiex_pcie_disable_host_int()
741 struct pcie_service_card *card = adapter->card; in mwifiex_init_txq_ring()
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()
749 if (reg->pfu_enabled) { 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()
772 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_init_rxq_ring()
786 return -ENOMEM; in mwifiex_init_rxq_ring()
793 return -ENOMEM; in mwifiex_init_rxq_ring()
800 skb, skb->len, skb->data, (u32)buf_pa, in mwifiex_init_rxq_ring()
803 card->rx_buf_list[i] = skb; in mwifiex_init_rxq_ring()
804 if (reg->pfu_enabled) { 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()
808 desc2->paddr = buf_pa; in mwifiex_init_rxq_ring()
809 desc2->len = (u16)skb->len; in mwifiex_init_rxq_ring()
810 desc2->frag_len = (u16)skb->len; in mwifiex_init_rxq_ring()
811 desc2->flags = reg->ring_flag_eop | reg->ring_flag_sop; in mwifiex_init_rxq_ring()
812 desc2->offset = 0; 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()
817 desc->paddr = buf_pa; in mwifiex_init_rxq_ring()
818 desc->len = (u16)skb->len; in mwifiex_init_rxq_ring()
819 desc->flags = 0; in mwifiex_init_rxq_ring()
832 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_evt_ring()
844 return -ENOMEM; in mwifiex_pcie_init_evt_ring()
851 return -ENOMEM; in mwifiex_pcie_init_evt_ring()
858 skb, skb->len, skb->data, (u32)buf_pa, in mwifiex_pcie_init_evt_ring()
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()
865 desc->paddr = buf_pa; in mwifiex_pcie_init_evt_ring()
866 desc->len = (u16)skb->len; in mwifiex_pcie_init_evt_ring()
867 desc->flags = 0; in mwifiex_pcie_init_evt_ring()
878 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_txq_ring()
879 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_txq_ring()
886 if (reg->pfu_enabled) { 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()
908 atomic_set(&adapter->tx_hw_pending, 0); in mwifiex_cleanup_txq_ring()
917 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_rxq_ring()
918 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_cleanup_rxq_ring()
925 if (reg->pfu_enabled) { 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()
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()
980 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_txbd_ring()
983 * driver maintaines the write pointer and firmware maintaines the read in mwifiex_pcie_create_txbd_ring()
984 * pointer. The write pointer starts at 0 (zero) while the read pointer in mwifiex_pcie_create_txbd_ring()
985 * starts at zero with rollover bit set in mwifiex_pcie_create_txbd_ring()
987 card->txbd_wrptr = 0; in mwifiex_pcie_create_txbd_ring()
989 if (reg->pfu_enabled) 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()
996 if (reg->pfu_enabled) 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()
1014 return -ENOMEM; in mwifiex_pcie_create_txbd_ring()
1018 "info: txbd_ring - base: %p, pbase: %#x:%x, len: %#x\n", 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()
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()
1053 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_rxbd_ring()
1056 * driver maintaines the read pointer and firmware maintaines the write in mwifiex_pcie_create_rxbd_ring()
1057 * pointer. The write pointer starts at 0 (zero) while the read pointer in mwifiex_pcie_create_rxbd_ring()
1058 * starts at zero with rollover bit set 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()
1063 if (reg->pfu_enabled) 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()
1081 return -ENOMEM; in mwifiex_pcie_create_rxbd_ring()
1085 "info: rxbd_ring - base: %p, pbase: %#x:%x, len: %#x\n", 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()
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()
1126 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_create_evtbd_ring()
1129 * driver maintaines the read pointer and firmware maintaines the write in mwifiex_pcie_create_evtbd_ring()
1130 * pointer. The write pointer starts at 0 (zero) while the read pointer in mwifiex_pcie_create_evtbd_ring()
1131 * starts at zero with rollover bit set 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()
1150 return -ENOMEM; in mwifiex_pcie_create_evtbd_ring()
1154 "info: CMDRSP/EVT bd_ring - base: %p pbase: %#x:%x len: %#x\n", 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()
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()
1201 return -ENOMEM; in mwifiex_pcie_alloc_cmdrsp_buf()
1207 return -1; in mwifiex_pcie_alloc_cmdrsp_buf()
1210 card->cmdrsp_buf = skb; in mwifiex_pcie_alloc_cmdrsp_buf()
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()
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()
1258 return -ENOMEM; in mwifiex_pcie_alloc_sleep_cookie_buf()
1260 cookie = (u32 *)card->sleep_cookie_vbase; in mwifiex_pcie_alloc_sleep_cookie_buf()
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()
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()
1302 * send dnld-rdy intr again, wait for completion. in mwifiex_clean_pcie_ring_buf()
1318 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_send_data_complete()
1319 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data_complete()
1324 /* Read the TX ring read pointer set by firmware */ in mwifiex_pcie_send_data_complete()
1325 if (mwifiex_read_reg(adapter, reg->tx_rdptr, &rdptr)) { in mwifiex_pcie_send_data_complete()
1327 "SEND COMP: failed to read reg->tx_rdptr\n"); in mwifiex_pcie_send_data_complete()
1328 return -1; in mwifiex_pcie_send_data_complete()
1333 card->txbd_rdptr, rdptr); in mwifiex_pcie_send_data_complete()
1335 num_tx_buffs = MWIFIEX_MAX_TXRX_BD << reg->tx_start_ptr; in mwifiex_pcie_send_data_complete()
1337 while (((card->txbd_rdptr & reg->tx_mask) != in mwifiex_pcie_send_data_complete()
1338 (rdptr & reg->tx_mask)) || in mwifiex_pcie_send_data_complete()
1339 ((card->txbd_rdptr & reg->tx_rollover_ind) != in mwifiex_pcie_send_data_complete()
1340 (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()
1342 reg->tx_start_ptr; 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()
1357 -1); in mwifiex_pcie_send_data_complete()
1360 atomic_dec(&adapter->tx_hw_pending); in mwifiex_pcie_send_data_complete()
1363 card->tx_buf_list[wrdoneidx] = NULL; in mwifiex_pcie_send_data_complete()
1365 if (reg->pfu_enabled) { 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()
1385 reg->tx_rollover_ind) ^ in mwifiex_pcie_send_data_complete()
1386 reg->tx_rollover_ind); in mwifiex_pcie_send_data_complete()
1390 adapter->data_sent = false; 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()
1414 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_data()
1420 if (!(skb->data && skb->len)) { in mwifiex_pcie_send_data()
1423 __func__, skb->data, skb->len); in mwifiex_pcie_send_data()
1424 return -1; in mwifiex_pcie_send_data()
1430 num_tx_buffs = MWIFIEX_MAX_TXRX_BD << reg->tx_start_ptr; in mwifiex_pcie_send_data()
1433 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1437 adapter->data_sent = true; in mwifiex_pcie_send_data()
1438 payload = skb->data; in mwifiex_pcie_send_data()
1439 put_unaligned_le16((u16)skb->len, payload + 0); in mwifiex_pcie_send_data()
1442 if (mwifiex_map_pci_memory(adapter, skb, skb->len, in mwifiex_pcie_send_data()
1444 return -1; 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()
1449 atomic_inc(&adapter->tx_hw_pending); in mwifiex_pcie_send_data()
1451 if (reg->pfu_enabled) { in mwifiex_pcie_send_data()
1452 desc2 = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1453 desc2->paddr = buf_pa; in mwifiex_pcie_send_data()
1454 desc2->len = (u16)skb->len; in mwifiex_pcie_send_data()
1455 desc2->frag_len = (u16)skb->len; in mwifiex_pcie_send_data()
1456 desc2->offset = 0; in mwifiex_pcie_send_data()
1457 desc2->flags = MWIFIEX_BD_FLAG_FIRST_DESC | in mwifiex_pcie_send_data()
1460 desc = card->txbd_ring[wrindx]; in mwifiex_pcie_send_data()
1461 desc->paddr = buf_pa; in mwifiex_pcie_send_data()
1462 desc->len = (u16)skb->len; in mwifiex_pcie_send_data()
1463 desc->flags = MWIFIEX_BD_FLAG_FIRST_DESC | 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()
1479 reg->tx_rollover_ind) ^ in mwifiex_pcie_send_data()
1480 reg->tx_rollover_ind); in mwifiex_pcie_send_data()
1482 rx_val = card->rxbd_rdptr & reg->rx_wrap_mask; in mwifiex_pcie_send_data()
1483 /* Write the TX ring write pointer in to reg->tx_wrptr */ in mwifiex_pcie_send_data()
1484 mwifiex_write_reg(adapter, reg->tx_wrptr, in mwifiex_pcie_send_data()
1485 card->txbd_wrptr | rx_val); in mwifiex_pcie_send_data()
1495 tx_param->next_pkt_len) { in mwifiex_pcie_send_data()
1498 "SEND DATA: delay dnld-rdy interrupt.\n"); in mwifiex_pcie_send_data()
1499 adapter->data_sent = false; in mwifiex_pcie_send_data()
1508 card->txbd_rdptr, card->txbd_wrptr); in mwifiex_pcie_send_data()
1512 adapter->data_sent = true; in mwifiex_pcie_send_data()
1516 return -EBUSY; in mwifiex_pcie_send_data()
1519 return -EINPROGRESS; in mwifiex_pcie_send_data()
1528 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_recv_data()
1529 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_process_recv_data()
1540 /* Read the RX ring Write pointer set by firmware */ in mwifiex_pcie_process_recv_data()
1541 if (mwifiex_read_reg(adapter, reg->rx_wrptr, &wrptr)) { in mwifiex_pcie_process_recv_data()
1543 "RECV DATA: failed to read reg->rx_wrptr\n"); in mwifiex_pcie_process_recv_data()
1544 ret = -1; in mwifiex_pcie_process_recv_data()
1547 card->rxbd_wrptr = wrptr; in mwifiex_pcie_process_recv_data()
1549 while (((wrptr & reg->rx_mask) != in mwifiex_pcie_process_recv_data()
1550 (card->rxbd_rdptr & reg->rx_mask)) || in mwifiex_pcie_process_recv_data()
1551 ((wrptr & reg->rx_rollover_ind) == 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()
1563 return -ENOMEM; in mwifiex_pcie_process_recv_data()
1566 card->rx_buf_list[rd_index] = NULL; in mwifiex_pcie_process_recv_data()
1568 /* Get data length from interface header - in mwifiex_pcie_process_recv_data()
1571 rx_len = get_unaligned_le16(skb_data->data); in mwifiex_pcie_process_recv_data()
1572 if (WARN_ON(rx_len <= adapter->intf_hdr_len || 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()
1583 skb_pull(skb_data, adapter->intf_hdr_len); in mwifiex_pcie_process_recv_data()
1584 if (adapter->rx_work_enabled) { in mwifiex_pcie_process_recv_data()
1585 skb_queue_tail(&adapter->rx_data_q, skb_data); in mwifiex_pcie_process_recv_data()
1586 adapter->data_received = true; in mwifiex_pcie_process_recv_data()
1587 atomic_inc(&adapter->rx_pending); in mwifiex_pcie_process_recv_data()
1598 return -ENOMEM; in mwifiex_pcie_process_recv_data()
1604 return -1; in mwifiex_pcie_process_recv_data()
1611 card->rx_buf_list[rd_index] = skb_tmp; in mwifiex_pcie_process_recv_data()
1613 if (reg->pfu_enabled) { in mwifiex_pcie_process_recv_data()
1614 desc2 = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1615 desc2->paddr = buf_pa; in mwifiex_pcie_process_recv_data()
1616 desc2->len = skb_tmp->len; in mwifiex_pcie_process_recv_data()
1617 desc2->frag_len = skb_tmp->len; in mwifiex_pcie_process_recv_data()
1618 desc2->offset = 0; in mwifiex_pcie_process_recv_data()
1619 desc2->flags = reg->ring_flag_sop | reg->ring_flag_eop; in mwifiex_pcie_process_recv_data()
1621 desc = card->rxbd_ring[rd_index]; in mwifiex_pcie_process_recv_data()
1622 desc->paddr = buf_pa; in mwifiex_pcie_process_recv_data()
1623 desc->len = skb_tmp->len; in mwifiex_pcie_process_recv_data()
1624 desc->flags = 0; 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()
1630 reg->rx_rollover_ind) ^ in mwifiex_pcie_process_recv_data()
1631 reg->rx_rollover_ind); 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()
1638 /* Write the RX ring read pointer in to reg->rx_rdptr */ in mwifiex_pcie_process_recv_data()
1639 mwifiex_write_reg(adapter, reg->rx_rdptr, in mwifiex_pcie_process_recv_data()
1640 card->rxbd_rdptr | tx_val); in mwifiex_pcie_process_recv_data()
1642 /* Read the RX ring Write pointer set by firmware */ in mwifiex_pcie_process_recv_data()
1643 if (mwifiex_read_reg(adapter, reg->rx_wrptr, &wrptr)) { in mwifiex_pcie_process_recv_data()
1645 "RECV DATA: failed to read reg->rx_wrptr\n"); in mwifiex_pcie_process_recv_data()
1646 ret = -1; 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()
1666 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_boot_cmd()
1668 if (!(skb->data && skb->len)) { in mwifiex_pcie_send_boot_cmd()
1671 __func__, skb->data, skb->len); in mwifiex_pcie_send_boot_cmd()
1672 return -1; in mwifiex_pcie_send_boot_cmd()
1675 if (mwifiex_map_pci_memory(adapter, skb, skb->len, DMA_TO_DEVICE)) in mwifiex_pcie_send_boot_cmd()
1676 return -1; in mwifiex_pcie_send_boot_cmd()
1683 mwifiex_write_reg(adapter, reg->cmd_addr_lo, (u32)buf_pa); in mwifiex_pcie_send_boot_cmd()
1688 mwifiex_write_reg(adapter, reg->cmd_addr_hi, (u32)((u64)buf_pa >> 32)); in mwifiex_pcie_send_boot_cmd()
1691 mwifiex_write_reg(adapter, reg->cmd_size, skb->len); in mwifiex_pcie_send_boot_cmd()
1704 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_init_fw_port()
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()
1708 /* Write the RX ring read pointer in to reg->rx_rdptr */ 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()
1718 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_send_cmd()
1720 u8 *payload = (u8 *)skb->data; in mwifiex_pcie_send_cmd()
1722 if (!(skb->data && skb->len)) { in mwifiex_pcie_send_cmd()
1725 __func__, skb->data, skb->len); in mwifiex_pcie_send_cmd()
1726 return -1; in mwifiex_pcie_send_cmd()
1730 if (!card->cmdrsp_buf) { in mwifiex_pcie_send_cmd()
1732 "No response buffer available, send command failed\n"); in mwifiex_pcie_send_cmd()
1733 return -EBUSY; in mwifiex_pcie_send_cmd()
1739 adapter->cmd_sent = true; in mwifiex_pcie_send_cmd()
1741 put_unaligned_le16((u16)skb->len, &payload[0]); in mwifiex_pcie_send_cmd()
1744 if (mwifiex_map_pci_memory(adapter, skb, skb->len, DMA_TO_DEVICE)) in mwifiex_pcie_send_cmd()
1745 return -1; 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()
1768 mwifiex_write_reg(adapter, reg->cmdrsp_addr_lo, in mwifiex_pcie_send_cmd()
1773 mwifiex_write_reg(adapter, reg->cmdrsp_addr_hi, in mwifiex_pcie_send_cmd()
1777 cmd_buf_pa = MWIFIEX_SKB_DMA_ADDR(card->cmd_buf); in mwifiex_pcie_send_cmd()
1779 /* Write the lower 32bits of the physical address to reg->cmd_addr_lo */ in mwifiex_pcie_send_cmd()
1780 mwifiex_write_reg(adapter, reg->cmd_addr_lo, (u32)cmd_buf_pa); in mwifiex_pcie_send_cmd()
1782 /* Write the upper 32bits of the physical address to reg->cmd_addr_hi */ in mwifiex_pcie_send_cmd()
1783 mwifiex_write_reg(adapter, reg->cmd_addr_hi, in mwifiex_pcie_send_cmd()
1786 /* Write the command length to reg->cmd_size */ 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()
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()
1809 if (adapter->curr_cmd) 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()
1824 rx_len = get_unaligned_le16(skb->data); in mwifiex_pcie_process_cmd_complete()
1825 skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len); in mwifiex_pcie_process_cmd_complete()
1828 if (!adapter->curr_cmd) { in mwifiex_pcie_process_cmd_complete()
1829 if (adapter->ps_state == PS_STATE_SLEEP_CFM) { in mwifiex_pcie_process_cmd_complete()
1830 dma_sync_single_for_device(&card->dev->dev, in mwifiex_pcie_process_cmd_complete()
1841 skb_pull(skb, adapter->intf_hdr_len); in mwifiex_pcie_process_cmd_complete()
1842 while (reg->sleep_cookie && (count++ < 10) && in mwifiex_pcie_process_cmd_complete()
1846 mwifiex_process_sleep_confirm_resp(adapter, skb->data, in mwifiex_pcie_process_cmd_complete()
1847 skb->len); in mwifiex_pcie_process_cmd_complete()
1850 "There is no command but got cmdrsp\n"); in mwifiex_pcie_process_cmd_complete()
1852 memcpy(adapter->upld_buf, skb->data, in mwifiex_pcie_process_cmd_complete()
1853 min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); in mwifiex_pcie_process_cmd_complete()
1854 skb_push(skb, adapter->intf_hdr_len); in mwifiex_pcie_process_cmd_complete()
1857 return -1; in mwifiex_pcie_process_cmd_complete()
1859 skb_pull(skb, adapter->intf_hdr_len); in mwifiex_pcie_process_cmd_complete()
1860 adapter->curr_cmd->resp_skb = skb; in mwifiex_pcie_process_cmd_complete()
1861 adapter->cmd_resp_received = true; in mwifiex_pcie_process_cmd_complete()
1864 card->cmdrsp_buf = NULL; in mwifiex_pcie_process_cmd_complete()
1866 /* Clear the cmd-rsp buffer address in scratch registers. This in mwifiex_pcie_process_cmd_complete()
1869 mwifiex_write_reg(adapter, reg->cmdrsp_addr_lo, 0); in mwifiex_pcie_process_cmd_complete()
1873 mwifiex_write_reg(adapter, reg->cmdrsp_addr_hi, 0); in mwifiex_pcie_process_cmd_complete()
1885 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_cmdrsp_complete()
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()
1892 return -1; in mwifiex_pcie_cmdrsp_complete()
1903 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_process_event_ready()
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()
1912 if (adapter->event_received) { in mwifiex_pcie_process_event_ready()
1921 "info: Invalid read pointer...\n"); in mwifiex_pcie_process_event_ready()
1922 return -1; in mwifiex_pcie_process_event_ready()
1925 /* Read the event ring write pointer set by firmware */ in mwifiex_pcie_process_event_ready()
1926 if (mwifiex_read_reg(adapter, reg->evt_wrptr, &wrptr)) { in mwifiex_pcie_process_event_ready()
1928 "EventReady: failed to read reg->evt_wrptr\n"); in mwifiex_pcie_process_event_ready()
1929 return -1; 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()
1937 ((wrptr & reg->evt_rollover_ind) == in mwifiex_pcie_process_event_ready()
1938 (card->evtbd_rdptr & reg->evt_rollover_ind))) { in mwifiex_pcie_process_event_ready()
1944 "info: Read Index: %d\n", rdptr); 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()
1955 &skb_cmd->data[adapter->intf_hdr_len]); in mwifiex_pcie_process_event_ready()
1956 adapter->event_cause = event; in mwifiex_pcie_process_event_ready()
1959 memcpy(&data_len, skb_cmd->data, sizeof(__le16)); in mwifiex_pcie_process_event_ready()
1962 skb_pull(skb_cmd, adapter->intf_hdr_len); in mwifiex_pcie_process_event_ready()
1968 memcpy(adapter->event_body, skb_cmd->data + in mwifiex_pcie_process_event_ready()
1969 MWIFIEX_EVENT_HEADER_LEN, evt_len - in mwifiex_pcie_process_event_ready()
1972 adapter->event_received = true; in mwifiex_pcie_process_event_ready()
1973 adapter->event_skb = skb_cmd; in mwifiex_pcie_process_event_ready()
1975 /* Do not update the event read pointer here, wait till the in mwifiex_pcie_process_event_ready()
1993 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_event_complete()
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()
2006 return -EINVAL; in mwifiex_pcie_event_complete()
2009 /* Read the event ring write pointer set by firmware */ in mwifiex_pcie_event_complete()
2010 if (mwifiex_read_reg(adapter, reg->evt_wrptr, &wrptr)) { in mwifiex_pcie_event_complete()
2012 "event_complete: failed to read reg->evt_wrptr\n"); in mwifiex_pcie_event_complete()
2013 return -1; in mwifiex_pcie_event_complete()
2016 if (!card->evt_buf_list[rdptr]) { in mwifiex_pcie_event_complete()
2017 skb_push(skb, adapter->intf_hdr_len); in mwifiex_pcie_event_complete()
2018 skb_put(skb, MAX_EVENT_SIZE - skb->len); in mwifiex_pcie_event_complete()
2022 return -1; 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()
2025 desc->paddr = MWIFIEX_SKB_DMA_ADDR(skb); in mwifiex_pcie_event_complete()
2026 desc->len = (u16)skb->len; in mwifiex_pcie_event_complete()
2027 desc->flags = 0; 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()
2037 reg->evt_rollover_ind) ^ in mwifiex_pcie_event_complete()
2038 reg->evt_rollover_ind); in mwifiex_pcie_event_complete()
2043 card->evtbd_rdptr, wrptr); in mwifiex_pcie_event_complete()
2045 /* Write the event ring read pointer in to reg->evt_rdptr */ in mwifiex_pcie_event_complete()
2046 mwifiex_write_reg(adapter, reg->evt_rdptr, card->evtbd_rdptr); in mwifiex_pcie_event_complete()
2059 * the offset of tail wifi-only part. If the image is already wifi-only,
2072 if (offset + sizeof(fwdata->header) < sizeof(fwdata->header) || in mwifiex_extract_wifi_fw()
2073 offset + sizeof(fwdata->header) >= firmware_len) { in mwifiex_extract_wifi_fw()
2075 "extract wifi-only fw failure!\n"); in mwifiex_extract_wifi_fw()
2076 ret = -1; in mwifiex_extract_wifi_fw()
2081 dnld_cmd = le32_to_cpu(fwdata->header.dnld_cmd); in mwifiex_extract_wifi_fw()
2082 data_len = le32_to_cpu(fwdata->header.data_length); in mwifiex_extract_wifi_fw()
2085 offset += sizeof(fwdata->header); in mwifiex_extract_wifi_fw()
2091 ret = -1; in mwifiex_extract_wifi_fw()
2095 /* Image start with cmd1, already wifi-only firmware */ in mwifiex_extract_wifi_fw()
2098 "input wifi-only firmware\n"); in mwifiex_extract_wifi_fw()
2104 "no cmd7 before cmd1!\n"); in mwifiex_extract_wifi_fw()
2105 ret = -1; in mwifiex_extract_wifi_fw()
2115 ret = -1; in mwifiex_extract_wifi_fw()
2125 ret = -1; in mwifiex_extract_wifi_fw()
2131 "extract wifi-only fw failure!\n"); in mwifiex_extract_wifi_fw()
2132 ret = -1; in mwifiex_extract_wifi_fw()
2144 ret = -1; in mwifiex_extract_wifi_fw()
2164 u8 *firmware = fw->fw_buf; in mwifiex_prog_fw_w_helper()
2165 u32 firmware_len = fw->fw_len; in mwifiex_prog_fw_w_helper()
2170 struct pcie_service_card *card = adapter->card; in mwifiex_prog_fw_w_helper()
2171 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_prog_fw_w_helper()
2175 "No firmware image found! Terminating download\n"); in mwifiex_prog_fw_w_helper()
2176 return -1; in mwifiex_prog_fw_w_helper()
2187 ret = -ENOMEM; in mwifiex_prog_fw_w_helper()
2193 mwifiex_dbg(adapter, FATAL, "Failed to read scratch register 13\n"); in mwifiex_prog_fw_w_helper()
2218 ret = mwifiex_read_reg(adapter, reg->cmd_size, in mwifiex_prog_fw_w_helper()
2236 ret = -1; in mwifiex_prog_fw_w_helper()
2248 ret = -1; in mwifiex_prog_fw_w_helper()
2260 /* Set blocksize to transfer - checking for in mwifiex_prog_fw_w_helper()
2262 if (firmware_len - offset < txlen) in mwifiex_prog_fw_w_helper()
2263 txlen = firmware_len - offset; 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()
2269 memmove(skb->data, &firmware[offset], txlen); in mwifiex_prog_fw_w_helper()
2272 skb_put(skb, MWIFIEX_UPLD_SIZE - skb->len); in mwifiex_prog_fw_w_helper()
2273 skb_trim(skb, tx_blocks * card->pcie.blksz_fw_dl); in mwifiex_prog_fw_w_helper()
2279 ret = -1; in mwifiex_prog_fw_w_helper()
2288 "%s: Failed to read\t" in mwifiex_prog_fw_w_helper()
2293 ret = -1; in mwifiex_prog_fw_w_helper()
2305 ret = -1; in mwifiex_prog_fw_w_helper()
2332 struct pcie_service_card *card = adapter->card; in mwifiex_check_fw_status()
2333 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_fw_status()
2342 mwifiex_write_reg(adapter, reg->drv_rdy, FIRMWARE_READY_PCIE); in mwifiex_check_fw_status()
2346 if (mwifiex_read_reg(adapter, reg->fw_status, in mwifiex_check_fw_status()
2348 ret = -1; in mwifiex_check_fw_status()
2362 ret = -1; in mwifiex_check_fw_status()
2376 struct pcie_service_card *card = adapter->card; in mwifiex_check_winner_status()
2377 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_check_winner_status()
2379 if (mwifiex_read_reg(adapter, reg->fw_status, &winner)) { in mwifiex_check_winner_status()
2380 ret = -1; in mwifiex_check_winner_status()
2382 mwifiex_dbg(adapter, INFO, "PCI-E is the winner\n"); in mwifiex_check_winner_status()
2383 adapter->winner = 1; in mwifiex_check_winner_status()
2386 "PCI-E is not the winner <%#x>", winner); in mwifiex_check_winner_status()
2400 struct pcie_service_card *card = adapter->card; in mwifiex_interrupt_status()
2402 if (card->msi_enable) { in mwifiex_interrupt_status()
2403 spin_lock_irqsave(&adapter->int_lock, flags); in mwifiex_interrupt_status()
2404 adapter->int_status = 1; in mwifiex_interrupt_status()
2405 spin_unlock_irqrestore(&adapter->int_lock, flags); in mwifiex_interrupt_status()
2412 if (card->msix_enable && msg_id >= 0) { in mwifiex_interrupt_status()
2417 mwifiex_dbg(adapter, ERROR, "Read register failed\n"); in mwifiex_interrupt_status()
2431 if (!adapter->pps_uapsd_mode && in mwifiex_interrupt_status()
2432 adapter->ps_state == PS_STATE_SLEEP && in mwifiex_interrupt_status()
2438 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_interrupt_status()
2439 adapter->pm_wakeup_fw_try = false; in mwifiex_interrupt_status()
2440 del_timer(&adapter->wakeup_timer); in mwifiex_interrupt_status()
2443 spin_lock_irqsave(&adapter->int_lock, flags); in mwifiex_interrupt_status()
2444 adapter->int_status |= pcie_ireg; in mwifiex_interrupt_status()
2445 spin_unlock_irqrestore(&adapter->int_lock, flags); in mwifiex_interrupt_status()
2458 struct pci_dev *pdev = ctx->dev; in mwifiex_pcie_interrupt()
2464 if (!card->adapter) { in mwifiex_pcie_interrupt()
2466 card ? card->adapter : NULL); in mwifiex_pcie_interrupt()
2469 adapter = card->adapter; in mwifiex_pcie_interrupt()
2471 if (test_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags)) in mwifiex_pcie_interrupt()
2474 if (card->msix_enable) in mwifiex_pcie_interrupt()
2475 mwifiex_interrupt_status(adapter, ctx->msg_id); in mwifiex_pcie_interrupt()
2477 mwifiex_interrupt_status(adapter, -1); in mwifiex_pcie_interrupt()
2488 * The following interrupts are checked and handled by this function -
2489 * - Data sent
2490 * - Command sent
2491 * - Command received
2492 * - Packets received
2493 * - Events received
2503 struct pcie_service_card *card = adapter->card; in mwifiex_process_int_status()
2505 spin_lock_irqsave(&adapter->int_lock, flags); in mwifiex_process_int_status()
2506 if (!card->msi_enable) { in mwifiex_process_int_status()
2508 pcie_ireg = adapter->int_status; in mwifiex_process_int_status()
2510 adapter->int_status = 0; in mwifiex_process_int_status()
2511 spin_unlock_irqrestore(&adapter->int_lock, flags); in mwifiex_process_int_status()
2513 if (card->msi_enable) { in mwifiex_process_int_status()
2518 "Read register failed\n"); in mwifiex_process_int_status()
2519 return -1; in mwifiex_process_int_status()
2526 if (!adapter->pps_uapsd_mode && in mwifiex_process_int_status()
2527 adapter->ps_state == PS_STATE_SLEEP) { in mwifiex_process_int_status()
2528 adapter->ps_state = PS_STATE_AWAKE; in mwifiex_process_int_status()
2529 adapter->pm_wakeup_fw_try = false; in mwifiex_process_int_status()
2530 del_timer(&adapter->wakeup_timer); in mwifiex_process_int_status()
2555 if (adapter->cmd_sent) { in mwifiex_process_int_status()
2558 adapter->cmd_sent = false; in mwifiex_process_int_status()
2568 adapter->cmd_sent, adapter->data_sent); in mwifiex_process_int_status()
2569 if (!card->msi_enable && !card->msix_enable && in mwifiex_process_int_status()
2570 adapter->ps_state != PS_STATE_SLEEP) in mwifiex_process_int_status()
2593 return -1; in mwifiex_pcie_host_to_card()
2613 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_reg_dump()
2614 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_reg_dump()
2624 if (mwifiex_read_reg(adapter, reg->fw_status, &value)) { in mwifiex_pcie_reg_dump()
2625 mwifiex_dbg(adapter, ERROR, "failed to read firmware status"); in mwifiex_pcie_reg_dump()
2642 return p - drv_buf; in mwifiex_pcie_reg_dump()
2645 /* This function read/write firmware */
2652 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_rdwr_firmware()
2653 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_rdwr_firmware()
2655 if (mwifiex_read_reg(adapter, reg->fw_status, &fw_status)) in mwifiex_pcie_rdwr_firmware()
2658 mwifiex_write_reg(adapter, reg->fw_dump_ctrl, reg->fw_dump_host_ready); in mwifiex_pcie_rdwr_firmware()
2661 mwifiex_read_reg_byte(adapter, reg->fw_dump_ctrl, &ctrl_data); in mwifiex_pcie_rdwr_firmware()
2666 if (ctrl_data != reg->fw_dump_host_ready) { in mwifiex_pcie_rdwr_firmware()
2668 "The ctrl reg was changed, re-try again!\n"); in mwifiex_pcie_rdwr_firmware()
2669 mwifiex_write_reg(adapter, reg->fw_dump_ctrl, in mwifiex_pcie_rdwr_firmware()
2670 reg->fw_dump_host_ready); in mwifiex_pcie_rdwr_firmware()
2682 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_fw_dump()
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()
2693 for (idx = 0; idx < adapter->num_mem_types; idx++) { in mwifiex_pcie_fw_dump()
2695 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_pcie_fw_dump()
2697 if (entry->mem_ptr) { in mwifiex_pcie_fw_dump()
2698 vfree(entry->mem_ptr); in mwifiex_pcie_fw_dump()
2699 entry->mem_ptr = NULL; in mwifiex_pcie_fw_dump()
2701 entry->mem_size = 0; in mwifiex_pcie_fw_dump()
2706 /* Read the number of the memories which will dump */ in mwifiex_pcie_fw_dump()
2711 reg = creg->fw_dump_start; in mwifiex_pcie_fw_dump()
2720 /* Read the length of every memory which will dump */ in mwifiex_pcie_fw_dump()
2723 &adapter->mem_type_mapping_tbl[idx]; in mwifiex_pcie_fw_dump()
2730 reg = creg->fw_dump_start; in mwifiex_pcie_fw_dump()
2742 mwifiex_write_reg(adapter, creg->fw_dump_ctrl, in mwifiex_pcie_fw_dump()
2743 creg->fw_dump_read_done); in mwifiex_pcie_fw_dump()
2748 "%s_SIZE=0x%x\n", entry->mem_name, memory_size); in mwifiex_pcie_fw_dump()
2749 entry->mem_ptr = vmalloc(memory_size + 1); in mwifiex_pcie_fw_dump()
2750 entry->mem_size = memory_size; in mwifiex_pcie_fw_dump()
2751 if (!entry->mem_ptr) { in mwifiex_pcie_fw_dump()
2753 "Vmalloc %s failed\n", entry->mem_name); in mwifiex_pcie_fw_dump()
2756 dbg_ptr = entry->mem_ptr; in mwifiex_pcie_fw_dump()
2759 doneflag = entry->done_flag; in mwifiex_pcie_fw_dump()
2761 entry->mem_name); in mwifiex_pcie_fw_dump()
2768 reg_start = creg->fw_dump_start; in mwifiex_pcie_fw_dump()
2769 reg_end = creg->fw_dump_end; in mwifiex_pcie_fw_dump()
2777 "pre-allocated buf not enough\n"); in mwifiex_pcie_fw_dump()
2782 memcpy(tmp_ptr, entry->mem_ptr, memory_size); in mwifiex_pcie_fw_dump()
2783 vfree(entry->mem_ptr); in mwifiex_pcie_fw_dump()
2784 entry->mem_ptr = tmp_ptr; in mwifiex_pcie_fw_dump()
2786 dbg_ptr = entry->mem_ptr + memory_size; in mwifiex_pcie_fw_dump()
2788 end_ptr = entry->mem_ptr + memory_size; in mwifiex_pcie_fw_dump()
2796 entry->mem_name, dbg_ptr - entry->mem_ptr); in mwifiex_pcie_fw_dump()
2805 adapter->devdump_data = vzalloc(MWIFIEX_FW_DUMP_SIZE); in mwifiex_pcie_device_dump_work()
2806 if (!adapter->devdump_data) { in mwifiex_pcie_device_dump_work()
2820 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_card_reset_work()
2825 pci_try_reset_function(card->dev); in mwifiex_pcie_card_reset_work()
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()
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()
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()
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()
2890 if (reg->sleep_cookie) { 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()
2917 const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; in mwifiex_pcie_free_buffers()
2919 if (reg->sleep_cookie) in mwifiex_pcie_free_buffers()
2929 * This function initializes the PCI-E host memory space, WCB rings, etc.
2933 struct pcie_service_card *card = adapter->card; in mwifiex_init_pcie()
2935 struct pci_dev *pdev = card->dev; in mwifiex_init_pcie()
2945 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); 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()
2959 ret = -EIO; 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()
2970 ret = -EIO; in mwifiex_init_pcie()
2975 card->pci_mmap, card->pci_mmap1); in mwifiex_init_pcie()
2981 if (pdev->device == PCIE_DEVICE_ID_MARVELL_88W8897) in mwifiex_init_pcie()
2982 adapter->ignore_btcoex_events = true; 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()
3006 struct pcie_service_card *card = adapter->card; in mwifiex_cleanup_pcie()
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()
3016 if (!card->pci_reset_ongoing) { in mwifiex_cleanup_pcie()
3018 cancel_work_sync(&card->work); in mwifiex_cleanup_pcie()
3025 mwifiex_read_reg(adapter, reg->fw_status, &fw_status); in mwifiex_cleanup_pcie()
3029 mwifiex_write_reg(adapter, reg->drv_rdy, 0x00000000); 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()
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()
3090 ret = request_irq(pdev->irq, mwifiex_pcie_interrupt, IRQF_SHARED, in mwifiex_pcie_request_irq()
3091 "MRVL_PCIE", &card->share_irq_ctx); in mwifiex_pcie_request_irq()
3094 return -1; in mwifiex_pcie_request_irq()
3103 * Read revision id register to get revision id
3109 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_get_fw_name()
3111 switch (card->dev->device) { in mwifiex_pcie_get_fw_name()
3113 strcpy(adapter->fw_name, PCIE8766_DEFAULT_FW_NAME); in mwifiex_pcie_get_fw_name()
3121 strcpy(adapter->fw_name, PCIE8897_A0_FW_NAME); in mwifiex_pcie_get_fw_name()
3124 strcpy(adapter->fw_name, PCIE8897_B0_FW_NAME); in mwifiex_pcie_get_fw_name()
3127 strcpy(adapter->fw_name, PCIE8897_DEFAULT_FW_NAME); in mwifiex_pcie_get_fw_name()
3142 strcpy(adapter->fw_name, PCIEUART8997_FW_NAME_V4); in mwifiex_pcie_get_fw_name()
3144 strcpy(adapter->fw_name, PCIEUSB8997_FW_NAME_V4); in mwifiex_pcie_get_fw_name()
3158 struct pcie_service_card *card = adapter->card; in mwifiex_register_dev()
3161 card->adapter = adapter; in mwifiex_register_dev()
3164 return -1; 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()
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()
3209 * This function initializes the PCI-E host memory space, WCB rings, etc.,
3210 * similar to mwifiex_init_pcie(), but without resetting PCI-E state.
3214 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_up_dev()
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()
3227 /* This function cleans up the PCI-E host memory space. */
3230 struct pcie_service_card *card = adapter->card; in mwifiex_pcie_down_dev()
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()
3234 mwifiex_write_reg(adapter, reg->drv_rdy, 0x00000000); in mwifiex_pcie_down_dev()
3238 adapter->seq_num = 0; in mwifiex_pcie_down_dev()
3275 MODULE_DESCRIPTION("Marvell WiFi-Ex PCI-Express Driver version " PCIE_VERSION);