| .. | .. |
|---|
| 1 | 1 | /* |
|---|
| 2 | | - * Marvell Wireless LAN device driver: PCIE specific handling |
|---|
| 2 | + * NXP Wireless LAN device driver: PCIE specific handling |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * Copyright (C) 2011-2014, Marvell International Ltd. |
|---|
| 4 | + * Copyright 2011-2020 NXP |
|---|
| 5 | 5 | * |
|---|
| 6 | | - * This software file (the "File") is distributed by Marvell International |
|---|
| 7 | | - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 |
|---|
| 6 | + * This software file (the "File") is distributed by NXP |
|---|
| 7 | + * under the terms of the GNU General Public License Version 2, June 1991 |
|---|
| 8 | 8 | * (the "License"). You may use, redistribute and/or modify this File in |
|---|
| 9 | 9 | * accordance with the terms and conditions of the License, a copy of which |
|---|
| 10 | 10 | * is available by writing to the Free Software Foundation, Inc., |
|---|
| .. | .. |
|---|
| 17 | 17 | * this warranty disclaimer. |
|---|
| 18 | 18 | */ |
|---|
| 19 | 19 | |
|---|
| 20 | +#include <linux/iopoll.h> |
|---|
| 20 | 21 | #include <linux/firmware.h> |
|---|
| 21 | 22 | |
|---|
| 22 | 23 | #include "decl.h" |
|---|
| .. | .. |
|---|
| 32 | 33 | #define DRV_NAME "Marvell mwifiex PCIe" |
|---|
| 33 | 34 | |
|---|
| 34 | 35 | static struct mwifiex_if_ops pcie_ops; |
|---|
| 36 | + |
|---|
| 37 | +static const struct mwifiex_pcie_card_reg mwifiex_reg_8766 = { |
|---|
| 38 | + .cmd_addr_lo = PCIE_SCRATCH_0_REG, |
|---|
| 39 | + .cmd_addr_hi = PCIE_SCRATCH_1_REG, |
|---|
| 40 | + .cmd_size = PCIE_SCRATCH_2_REG, |
|---|
| 41 | + .fw_status = PCIE_SCRATCH_3_REG, |
|---|
| 42 | + .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, |
|---|
| 43 | + .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, |
|---|
| 44 | + .tx_rdptr = PCIE_SCRATCH_6_REG, |
|---|
| 45 | + .tx_wrptr = PCIE_SCRATCH_7_REG, |
|---|
| 46 | + .rx_rdptr = PCIE_SCRATCH_8_REG, |
|---|
| 47 | + .rx_wrptr = PCIE_SCRATCH_9_REG, |
|---|
| 48 | + .evt_rdptr = PCIE_SCRATCH_10_REG, |
|---|
| 49 | + .evt_wrptr = PCIE_SCRATCH_11_REG, |
|---|
| 50 | + .drv_rdy = PCIE_SCRATCH_12_REG, |
|---|
| 51 | + .tx_start_ptr = 0, |
|---|
| 52 | + .tx_mask = MWIFIEX_TXBD_MASK, |
|---|
| 53 | + .tx_wrap_mask = 0, |
|---|
| 54 | + .rx_mask = MWIFIEX_RXBD_MASK, |
|---|
| 55 | + .rx_wrap_mask = 0, |
|---|
| 56 | + .tx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, |
|---|
| 57 | + .rx_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, |
|---|
| 58 | + .evt_rollover_ind = MWIFIEX_BD_FLAG_ROLLOVER_IND, |
|---|
| 59 | + .ring_flag_sop = 0, |
|---|
| 60 | + .ring_flag_eop = 0, |
|---|
| 61 | + .ring_flag_xs_sop = 0, |
|---|
| 62 | + .ring_flag_xs_eop = 0, |
|---|
| 63 | + .ring_tx_start_ptr = 0, |
|---|
| 64 | + .pfu_enabled = 0, |
|---|
| 65 | + .sleep_cookie = 1, |
|---|
| 66 | + .msix_support = 0, |
|---|
| 67 | +}; |
|---|
| 68 | + |
|---|
| 69 | +static const struct mwifiex_pcie_card_reg mwifiex_reg_8897 = { |
|---|
| 70 | + .cmd_addr_lo = PCIE_SCRATCH_0_REG, |
|---|
| 71 | + .cmd_addr_hi = PCIE_SCRATCH_1_REG, |
|---|
| 72 | + .cmd_size = PCIE_SCRATCH_2_REG, |
|---|
| 73 | + .fw_status = PCIE_SCRATCH_3_REG, |
|---|
| 74 | + .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, |
|---|
| 75 | + .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, |
|---|
| 76 | + .tx_rdptr = PCIE_RD_DATA_PTR_Q0_Q1, |
|---|
| 77 | + .tx_wrptr = PCIE_WR_DATA_PTR_Q0_Q1, |
|---|
| 78 | + .rx_rdptr = PCIE_WR_DATA_PTR_Q0_Q1, |
|---|
| 79 | + .rx_wrptr = PCIE_RD_DATA_PTR_Q0_Q1, |
|---|
| 80 | + .evt_rdptr = PCIE_SCRATCH_10_REG, |
|---|
| 81 | + .evt_wrptr = PCIE_SCRATCH_11_REG, |
|---|
| 82 | + .drv_rdy = PCIE_SCRATCH_12_REG, |
|---|
| 83 | + .tx_start_ptr = 16, |
|---|
| 84 | + .tx_mask = 0x03FF0000, |
|---|
| 85 | + .tx_wrap_mask = 0x07FF0000, |
|---|
| 86 | + .rx_mask = 0x000003FF, |
|---|
| 87 | + .rx_wrap_mask = 0x000007FF, |
|---|
| 88 | + .tx_rollover_ind = MWIFIEX_BD_FLAG_TX_ROLLOVER_IND, |
|---|
| 89 | + .rx_rollover_ind = MWIFIEX_BD_FLAG_RX_ROLLOVER_IND, |
|---|
| 90 | + .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND, |
|---|
| 91 | + .ring_flag_sop = MWIFIEX_BD_FLAG_SOP, |
|---|
| 92 | + .ring_flag_eop = MWIFIEX_BD_FLAG_EOP, |
|---|
| 93 | + .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP, |
|---|
| 94 | + .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, |
|---|
| 95 | + .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, |
|---|
| 96 | + .pfu_enabled = 1, |
|---|
| 97 | + .sleep_cookie = 0, |
|---|
| 98 | + .fw_dump_ctrl = PCIE_SCRATCH_13_REG, |
|---|
| 99 | + .fw_dump_start = PCIE_SCRATCH_14_REG, |
|---|
| 100 | + .fw_dump_end = 0xcff, |
|---|
| 101 | + .fw_dump_host_ready = 0xee, |
|---|
| 102 | + .fw_dump_read_done = 0xfe, |
|---|
| 103 | + .msix_support = 0, |
|---|
| 104 | +}; |
|---|
| 105 | + |
|---|
| 106 | +static const struct mwifiex_pcie_card_reg mwifiex_reg_8997 = { |
|---|
| 107 | + .cmd_addr_lo = PCIE_SCRATCH_0_REG, |
|---|
| 108 | + .cmd_addr_hi = PCIE_SCRATCH_1_REG, |
|---|
| 109 | + .cmd_size = PCIE_SCRATCH_2_REG, |
|---|
| 110 | + .fw_status = PCIE_SCRATCH_3_REG, |
|---|
| 111 | + .cmdrsp_addr_lo = PCIE_SCRATCH_4_REG, |
|---|
| 112 | + .cmdrsp_addr_hi = PCIE_SCRATCH_5_REG, |
|---|
| 113 | + .tx_rdptr = 0xC1A4, |
|---|
| 114 | + .tx_wrptr = 0xC174, |
|---|
| 115 | + .rx_rdptr = 0xC174, |
|---|
| 116 | + .rx_wrptr = 0xC1A4, |
|---|
| 117 | + .evt_rdptr = PCIE_SCRATCH_10_REG, |
|---|
| 118 | + .evt_wrptr = PCIE_SCRATCH_11_REG, |
|---|
| 119 | + .drv_rdy = PCIE_SCRATCH_12_REG, |
|---|
| 120 | + .tx_start_ptr = 16, |
|---|
| 121 | + .tx_mask = 0x0FFF0000, |
|---|
| 122 | + .tx_wrap_mask = 0x1FFF0000, |
|---|
| 123 | + .rx_mask = 0x00000FFF, |
|---|
| 124 | + .rx_wrap_mask = 0x00001FFF, |
|---|
| 125 | + .tx_rollover_ind = BIT(28), |
|---|
| 126 | + .rx_rollover_ind = BIT(12), |
|---|
| 127 | + .evt_rollover_ind = MWIFIEX_BD_FLAG_EVT_ROLLOVER_IND, |
|---|
| 128 | + .ring_flag_sop = MWIFIEX_BD_FLAG_SOP, |
|---|
| 129 | + .ring_flag_eop = MWIFIEX_BD_FLAG_EOP, |
|---|
| 130 | + .ring_flag_xs_sop = MWIFIEX_BD_FLAG_XS_SOP, |
|---|
| 131 | + .ring_flag_xs_eop = MWIFIEX_BD_FLAG_XS_EOP, |
|---|
| 132 | + .ring_tx_start_ptr = MWIFIEX_BD_FLAG_TX_START_PTR, |
|---|
| 133 | + .pfu_enabled = 1, |
|---|
| 134 | + .sleep_cookie = 0, |
|---|
| 135 | + .fw_dump_ctrl = PCIE_SCRATCH_13_REG, |
|---|
| 136 | + .fw_dump_start = PCIE_SCRATCH_14_REG, |
|---|
| 137 | + .fw_dump_end = 0xcff, |
|---|
| 138 | + .fw_dump_host_ready = 0xcc, |
|---|
| 139 | + .fw_dump_read_done = 0xdd, |
|---|
| 140 | + .msix_support = 0, |
|---|
| 141 | +}; |
|---|
| 142 | + |
|---|
| 143 | +static struct memory_type_mapping mem_type_mapping_tbl_w8897[] = { |
|---|
| 144 | + {"ITCM", NULL, 0, 0xF0}, |
|---|
| 145 | + {"DTCM", NULL, 0, 0xF1}, |
|---|
| 146 | + {"SQRAM", NULL, 0, 0xF2}, |
|---|
| 147 | + {"IRAM", NULL, 0, 0xF3}, |
|---|
| 148 | + {"APU", NULL, 0, 0xF4}, |
|---|
| 149 | + {"CIU", NULL, 0, 0xF5}, |
|---|
| 150 | + {"ICU", NULL, 0, 0xF6}, |
|---|
| 151 | + {"MAC", NULL, 0, 0xF7}, |
|---|
| 152 | +}; |
|---|
| 153 | + |
|---|
| 154 | +static struct memory_type_mapping mem_type_mapping_tbl_w8997[] = { |
|---|
| 155 | + {"DUMP", NULL, 0, 0xDD}, |
|---|
| 156 | +}; |
|---|
| 157 | + |
|---|
| 158 | +static const struct mwifiex_pcie_device mwifiex_pcie8766 = { |
|---|
| 159 | + .reg = &mwifiex_reg_8766, |
|---|
| 160 | + .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
|---|
| 161 | + .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, |
|---|
| 162 | + .can_dump_fw = false, |
|---|
| 163 | + .can_ext_scan = true, |
|---|
| 164 | +}; |
|---|
| 165 | + |
|---|
| 166 | +static const struct mwifiex_pcie_device mwifiex_pcie8897 = { |
|---|
| 167 | + .reg = &mwifiex_reg_8897, |
|---|
| 168 | + .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
|---|
| 169 | + .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, |
|---|
| 170 | + .can_dump_fw = true, |
|---|
| 171 | + .mem_type_mapping_tbl = mem_type_mapping_tbl_w8897, |
|---|
| 172 | + .num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl_w8897), |
|---|
| 173 | + .can_ext_scan = true, |
|---|
| 174 | +}; |
|---|
| 175 | + |
|---|
| 176 | +static const struct mwifiex_pcie_device mwifiex_pcie8997 = { |
|---|
| 177 | + .reg = &mwifiex_reg_8997, |
|---|
| 178 | + .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
|---|
| 179 | + .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, |
|---|
| 180 | + .can_dump_fw = true, |
|---|
| 181 | + .mem_type_mapping_tbl = mem_type_mapping_tbl_w8997, |
|---|
| 182 | + .num_mem_types = ARRAY_SIZE(mem_type_mapping_tbl_w8997), |
|---|
| 183 | + .can_ext_scan = true, |
|---|
| 184 | +}; |
|---|
| 35 | 185 | |
|---|
| 36 | 186 | static const struct of_device_id mwifiex_pcie_of_match_table[] = { |
|---|
| 37 | 187 | { .compatible = "pci11ab,2b42" }, |
|---|
| .. | .. |
|---|
| 58 | 208 | struct pcie_service_card *card = adapter->card; |
|---|
| 59 | 209 | struct mwifiex_dma_mapping mapping; |
|---|
| 60 | 210 | |
|---|
| 61 | | - mapping.addr = pci_map_single(card->dev, skb->data, size, flags); |
|---|
| 62 | | - if (pci_dma_mapping_error(card->dev, mapping.addr)) { |
|---|
| 211 | + mapping.addr = dma_map_single(&card->dev->dev, skb->data, size, flags); |
|---|
| 212 | + if (dma_mapping_error(&card->dev->dev, mapping.addr)) { |
|---|
| 63 | 213 | mwifiex_dbg(adapter, ERROR, "failed to map pci memory!\n"); |
|---|
| 64 | 214 | return -1; |
|---|
| 65 | 215 | } |
|---|
| .. | .. |
|---|
| 75 | 225 | struct mwifiex_dma_mapping mapping; |
|---|
| 76 | 226 | |
|---|
| 77 | 227 | mwifiex_get_mapping(skb, &mapping); |
|---|
| 78 | | - pci_unmap_single(card->dev, mapping.addr, mapping.len, flags); |
|---|
| 228 | + dma_unmap_single(&card->dev->dev, mapping.addr, mapping.len, flags); |
|---|
| 79 | 229 | } |
|---|
| 80 | 230 | |
|---|
| 81 | 231 | /* |
|---|
| .. | .. |
|---|
| 150 | 300 | static int mwifiex_pcie_suspend(struct device *dev) |
|---|
| 151 | 301 | { |
|---|
| 152 | 302 | struct mwifiex_adapter *adapter; |
|---|
| 153 | | - struct pcie_service_card *card; |
|---|
| 154 | | - struct pci_dev *pdev = to_pci_dev(dev); |
|---|
| 303 | + struct pcie_service_card *card = dev_get_drvdata(dev); |
|---|
| 155 | 304 | |
|---|
| 156 | | - card = pci_get_drvdata(pdev); |
|---|
| 157 | 305 | |
|---|
| 158 | 306 | /* Might still be loading firmware */ |
|---|
| 159 | 307 | wait_for_completion(&card->fw_done); |
|---|
| .. | .. |
|---|
| 195 | 343 | static int mwifiex_pcie_resume(struct device *dev) |
|---|
| 196 | 344 | { |
|---|
| 197 | 345 | struct mwifiex_adapter *adapter; |
|---|
| 198 | | - struct pcie_service_card *card; |
|---|
| 199 | | - struct pci_dev *pdev = to_pci_dev(dev); |
|---|
| 346 | + struct pcie_service_card *card = dev_get_drvdata(dev); |
|---|
| 200 | 347 | |
|---|
| 201 | | - card = pci_get_drvdata(pdev); |
|---|
| 202 | 348 | |
|---|
| 203 | 349 | if (!card->adapter) { |
|---|
| 204 | 350 | dev_err(dev, "adapter structure is not valid\n"); |
|---|
| .. | .. |
|---|
| 469 | 615 | struct sk_buff *cmdrsp = card->cmdrsp_buf; |
|---|
| 470 | 616 | |
|---|
| 471 | 617 | for (count = 0; count < max_delay_loop_cnt; count++) { |
|---|
| 472 | | - pci_dma_sync_single_for_cpu(card->dev, |
|---|
| 473 | | - MWIFIEX_SKB_DMA_ADDR(cmdrsp), |
|---|
| 474 | | - sizeof(sleep_cookie), |
|---|
| 475 | | - PCI_DMA_FROMDEVICE); |
|---|
| 618 | + dma_sync_single_for_cpu(&card->dev->dev, |
|---|
| 619 | + MWIFIEX_SKB_DMA_ADDR(cmdrsp), |
|---|
| 620 | + sizeof(sleep_cookie), DMA_FROM_DEVICE); |
|---|
| 476 | 621 | buffer = cmdrsp->data; |
|---|
| 477 | 622 | sleep_cookie = get_unaligned_le32(buffer); |
|---|
| 478 | 623 | |
|---|
| .. | .. |
|---|
| 481 | 626 | "sleep cookie found at count %d\n", count); |
|---|
| 482 | 627 | break; |
|---|
| 483 | 628 | } |
|---|
| 484 | | - pci_dma_sync_single_for_device(card->dev, |
|---|
| 485 | | - MWIFIEX_SKB_DMA_ADDR(cmdrsp), |
|---|
| 486 | | - sizeof(sleep_cookie), |
|---|
| 487 | | - PCI_DMA_FROMDEVICE); |
|---|
| 629 | + dma_sync_single_for_device(&card->dev->dev, |
|---|
| 630 | + MWIFIEX_SKB_DMA_ADDR(cmdrsp), |
|---|
| 631 | + sizeof(sleep_cookie), |
|---|
| 632 | + DMA_FROM_DEVICE); |
|---|
| 488 | 633 | usleep_range(20, 30); |
|---|
| 489 | 634 | } |
|---|
| 490 | 635 | |
|---|
| .. | .. |
|---|
| 493 | 638 | "max count reached while accessing sleep cookie\n"); |
|---|
| 494 | 639 | } |
|---|
| 495 | 640 | |
|---|
| 641 | +#define N_WAKEUP_TRIES_SHORT_INTERVAL 15 |
|---|
| 642 | +#define N_WAKEUP_TRIES_LONG_INTERVAL 35 |
|---|
| 643 | + |
|---|
| 496 | 644 | /* This function wakes up the card by reading fw_status register. */ |
|---|
| 497 | 645 | static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) |
|---|
| 498 | 646 | { |
|---|
| 499 | 647 | struct pcie_service_card *card = adapter->card; |
|---|
| 500 | 648 | const struct mwifiex_pcie_card_reg *reg = card->pcie.reg; |
|---|
| 649 | + int retval; |
|---|
| 501 | 650 | |
|---|
| 502 | 651 | mwifiex_dbg(adapter, EVENT, |
|---|
| 503 | 652 | "event: Wakeup device...\n"); |
|---|
| .. | .. |
|---|
| 505 | 654 | if (reg->sleep_cookie) |
|---|
| 506 | 655 | mwifiex_pcie_dev_wakeup_delay(adapter); |
|---|
| 507 | 656 | |
|---|
| 508 | | - /* Accessing fw_status register will wakeup device */ |
|---|
| 509 | | - if (mwifiex_write_reg(adapter, reg->fw_status, FIRMWARE_READY_PCIE)) { |
|---|
| 510 | | - mwifiex_dbg(adapter, ERROR, |
|---|
| 511 | | - "Writing fw_status register failed\n"); |
|---|
| 512 | | - return -1; |
|---|
| 657 | + /* The 88W8897 PCIe+USB firmware (latest version 15.68.19.p21) sometimes |
|---|
| 658 | + * appears to ignore or miss our wakeup request, so we continue trying |
|---|
| 659 | + * until we receive an interrupt from the card. |
|---|
| 660 | + */ |
|---|
| 661 | + if (read_poll_timeout(mwifiex_write_reg, retval, |
|---|
| 662 | + READ_ONCE(adapter->int_status) != 0, |
|---|
| 663 | + 500, 500 * N_WAKEUP_TRIES_SHORT_INTERVAL, |
|---|
| 664 | + false, |
|---|
| 665 | + adapter, reg->fw_status, FIRMWARE_READY_PCIE)) { |
|---|
| 666 | + if (read_poll_timeout(mwifiex_write_reg, retval, |
|---|
| 667 | + READ_ONCE(adapter->int_status) != 0, |
|---|
| 668 | + 10000, 10000 * N_WAKEUP_TRIES_LONG_INTERVAL, |
|---|
| 669 | + false, |
|---|
| 670 | + adapter, reg->fw_status, FIRMWARE_READY_PCIE)) { |
|---|
| 671 | + mwifiex_dbg(adapter, ERROR, |
|---|
| 672 | + "Firmware didn't wake up\n"); |
|---|
| 673 | + return -EIO; |
|---|
| 674 | + } |
|---|
| 513 | 675 | } |
|---|
| 514 | 676 | |
|---|
| 515 | 677 | if (reg->sleep_cookie) { |
|---|
| .. | .. |
|---|
| 638 | 800 | |
|---|
| 639 | 801 | if (mwifiex_map_pci_memory(adapter, skb, |
|---|
| 640 | 802 | MWIFIEX_RX_DATA_BUF_SIZE, |
|---|
| 641 | | - PCI_DMA_FROMDEVICE)) |
|---|
| 803 | + DMA_FROM_DEVICE)) |
|---|
| 642 | 804 | return -1; |
|---|
| 643 | 805 | |
|---|
| 644 | 806 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
|---|
| .. | .. |
|---|
| 695 | 857 | skb_put(skb, MAX_EVENT_SIZE); |
|---|
| 696 | 858 | |
|---|
| 697 | 859 | if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, |
|---|
| 698 | | - PCI_DMA_FROMDEVICE)) { |
|---|
| 860 | + DMA_FROM_DEVICE)) { |
|---|
| 699 | 861 | kfree_skb(skb); |
|---|
| 700 | 862 | kfree(card->evtbd_ring_vbase); |
|---|
| 701 | 863 | return -1; |
|---|
| .. | .. |
|---|
| 738 | 900 | if (card->tx_buf_list[i]) { |
|---|
| 739 | 901 | skb = card->tx_buf_list[i]; |
|---|
| 740 | 902 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 741 | | - PCI_DMA_TODEVICE); |
|---|
| 903 | + DMA_TO_DEVICE); |
|---|
| 742 | 904 | dev_kfree_skb_any(skb); |
|---|
| 743 | 905 | } |
|---|
| 744 | 906 | memset(desc2, 0, sizeof(*desc2)); |
|---|
| .. | .. |
|---|
| 747 | 909 | if (card->tx_buf_list[i]) { |
|---|
| 748 | 910 | skb = card->tx_buf_list[i]; |
|---|
| 749 | 911 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 750 | | - PCI_DMA_TODEVICE); |
|---|
| 912 | + DMA_TO_DEVICE); |
|---|
| 751 | 913 | dev_kfree_skb_any(skb); |
|---|
| 752 | 914 | } |
|---|
| 753 | 915 | memset(desc, 0, sizeof(*desc)); |
|---|
| .. | .. |
|---|
| 777 | 939 | if (card->rx_buf_list[i]) { |
|---|
| 778 | 940 | skb = card->rx_buf_list[i]; |
|---|
| 779 | 941 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 780 | | - PCI_DMA_FROMDEVICE); |
|---|
| 942 | + DMA_FROM_DEVICE); |
|---|
| 781 | 943 | dev_kfree_skb_any(skb); |
|---|
| 782 | 944 | } |
|---|
| 783 | 945 | memset(desc2, 0, sizeof(*desc2)); |
|---|
| .. | .. |
|---|
| 786 | 948 | if (card->rx_buf_list[i]) { |
|---|
| 787 | 949 | skb = card->rx_buf_list[i]; |
|---|
| 788 | 950 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 789 | | - PCI_DMA_FROMDEVICE); |
|---|
| 951 | + DMA_FROM_DEVICE); |
|---|
| 790 | 952 | dev_kfree_skb_any(skb); |
|---|
| 791 | 953 | } |
|---|
| 792 | 954 | memset(desc, 0, sizeof(*desc)); |
|---|
| .. | .. |
|---|
| 812 | 974 | if (card->evt_buf_list[i]) { |
|---|
| 813 | 975 | skb = card->evt_buf_list[i]; |
|---|
| 814 | 976 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 815 | | - PCI_DMA_FROMDEVICE); |
|---|
| 977 | + DMA_FROM_DEVICE); |
|---|
| 816 | 978 | dev_kfree_skb_any(skb); |
|---|
| 817 | 979 | } |
|---|
| 818 | 980 | card->evt_buf_list[i] = NULL; |
|---|
| .. | .. |
|---|
| 853 | 1015 | mwifiex_dbg(adapter, INFO, |
|---|
| 854 | 1016 | "info: txbd_ring: Allocating %d bytes\n", |
|---|
| 855 | 1017 | card->txbd_ring_size); |
|---|
| 856 | | - card->txbd_ring_vbase = pci_alloc_consistent(card->dev, |
|---|
| 857 | | - card->txbd_ring_size, |
|---|
| 858 | | - &card->txbd_ring_pbase); |
|---|
| 1018 | + card->txbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, |
|---|
| 1019 | + card->txbd_ring_size, |
|---|
| 1020 | + &card->txbd_ring_pbase, |
|---|
| 1021 | + GFP_KERNEL); |
|---|
| 859 | 1022 | if (!card->txbd_ring_vbase) { |
|---|
| 860 | 1023 | mwifiex_dbg(adapter, ERROR, |
|---|
| 861 | | - "allocate consistent memory (%d bytes) failed!\n", |
|---|
| 1024 | + "allocate coherent memory (%d bytes) failed!\n", |
|---|
| 862 | 1025 | card->txbd_ring_size); |
|---|
| 863 | 1026 | return -ENOMEM; |
|---|
| 864 | 1027 | } |
|---|
| 1028 | + |
|---|
| 865 | 1029 | mwifiex_dbg(adapter, DATA, |
|---|
| 866 | | - "info: txbd_ring - base: %p, pbase: %#x:%x, len: %x\n", |
|---|
| 867 | | - card->txbd_ring_vbase, (unsigned int)card->txbd_ring_pbase, |
|---|
| 1030 | + "info: txbd_ring - base: %p, pbase: %#x:%x, len: %#x\n", |
|---|
| 1031 | + card->txbd_ring_vbase, (u32)card->txbd_ring_pbase, |
|---|
| 868 | 1032 | (u32)((u64)card->txbd_ring_pbase >> 32), |
|---|
| 869 | 1033 | card->txbd_ring_size); |
|---|
| 870 | 1034 | |
|---|
| .. | .. |
|---|
| 879 | 1043 | mwifiex_cleanup_txq_ring(adapter); |
|---|
| 880 | 1044 | |
|---|
| 881 | 1045 | if (card->txbd_ring_vbase) |
|---|
| 882 | | - pci_free_consistent(card->dev, card->txbd_ring_size, |
|---|
| 883 | | - card->txbd_ring_vbase, |
|---|
| 884 | | - card->txbd_ring_pbase); |
|---|
| 1046 | + dma_free_coherent(&card->dev->dev, card->txbd_ring_size, |
|---|
| 1047 | + card->txbd_ring_vbase, |
|---|
| 1048 | + card->txbd_ring_pbase); |
|---|
| 885 | 1049 | card->txbd_ring_size = 0; |
|---|
| 886 | 1050 | card->txbd_wrptr = 0; |
|---|
| 887 | 1051 | card->txbd_rdptr = 0 | reg->tx_rollover_ind; |
|---|
| .. | .. |
|---|
| 917 | 1081 | mwifiex_dbg(adapter, INFO, |
|---|
| 918 | 1082 | "info: rxbd_ring: Allocating %d bytes\n", |
|---|
| 919 | 1083 | card->rxbd_ring_size); |
|---|
| 920 | | - card->rxbd_ring_vbase = pci_alloc_consistent(card->dev, |
|---|
| 921 | | - card->rxbd_ring_size, |
|---|
| 922 | | - &card->rxbd_ring_pbase); |
|---|
| 1084 | + card->rxbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, |
|---|
| 1085 | + card->rxbd_ring_size, |
|---|
| 1086 | + &card->rxbd_ring_pbase, |
|---|
| 1087 | + GFP_KERNEL); |
|---|
| 923 | 1088 | if (!card->rxbd_ring_vbase) { |
|---|
| 924 | 1089 | mwifiex_dbg(adapter, ERROR, |
|---|
| 925 | | - "allocate consistent memory (%d bytes) failed!\n", |
|---|
| 1090 | + "allocate coherent memory (%d bytes) failed!\n", |
|---|
| 926 | 1091 | card->rxbd_ring_size); |
|---|
| 927 | 1092 | return -ENOMEM; |
|---|
| 928 | 1093 | } |
|---|
| .. | .. |
|---|
| 947 | 1112 | mwifiex_cleanup_rxq_ring(adapter); |
|---|
| 948 | 1113 | |
|---|
| 949 | 1114 | if (card->rxbd_ring_vbase) |
|---|
| 950 | | - pci_free_consistent(card->dev, card->rxbd_ring_size, |
|---|
| 951 | | - card->rxbd_ring_vbase, |
|---|
| 952 | | - card->rxbd_ring_pbase); |
|---|
| 1115 | + dma_free_coherent(&card->dev->dev, card->rxbd_ring_size, |
|---|
| 1116 | + card->rxbd_ring_vbase, |
|---|
| 1117 | + card->rxbd_ring_pbase); |
|---|
| 953 | 1118 | card->rxbd_ring_size = 0; |
|---|
| 954 | 1119 | card->rxbd_wrptr = 0; |
|---|
| 955 | 1120 | card->rxbd_rdptr = 0 | reg->rx_rollover_ind; |
|---|
| .. | .. |
|---|
| 980 | 1145 | |
|---|
| 981 | 1146 | mwifiex_dbg(adapter, INFO, |
|---|
| 982 | 1147 | "info: evtbd_ring: Allocating %d bytes\n", |
|---|
| 983 | | - card->evtbd_ring_size); |
|---|
| 984 | | - card->evtbd_ring_vbase = pci_alloc_consistent(card->dev, |
|---|
| 985 | | - card->evtbd_ring_size, |
|---|
| 986 | | - &card->evtbd_ring_pbase); |
|---|
| 1148 | + card->evtbd_ring_size); |
|---|
| 1149 | + card->evtbd_ring_vbase = dma_alloc_coherent(&card->dev->dev, |
|---|
| 1150 | + card->evtbd_ring_size, |
|---|
| 1151 | + &card->evtbd_ring_pbase, |
|---|
| 1152 | + GFP_KERNEL); |
|---|
| 987 | 1153 | if (!card->evtbd_ring_vbase) { |
|---|
| 988 | 1154 | mwifiex_dbg(adapter, ERROR, |
|---|
| 989 | | - "allocate consistent memory (%d bytes) failed!\n", |
|---|
| 1155 | + "allocate coherent memory (%d bytes) failed!\n", |
|---|
| 990 | 1156 | card->evtbd_ring_size); |
|---|
| 991 | 1157 | return -ENOMEM; |
|---|
| 992 | 1158 | } |
|---|
| .. | .. |
|---|
| 1011 | 1177 | mwifiex_cleanup_evt_ring(adapter); |
|---|
| 1012 | 1178 | |
|---|
| 1013 | 1179 | if (card->evtbd_ring_vbase) |
|---|
| 1014 | | - pci_free_consistent(card->dev, card->evtbd_ring_size, |
|---|
| 1015 | | - card->evtbd_ring_vbase, |
|---|
| 1016 | | - card->evtbd_ring_pbase); |
|---|
| 1180 | + dma_free_coherent(&card->dev->dev, card->evtbd_ring_size, |
|---|
| 1181 | + card->evtbd_ring_vbase, |
|---|
| 1182 | + card->evtbd_ring_pbase); |
|---|
| 1017 | 1183 | card->evtbd_wrptr = 0; |
|---|
| 1018 | 1184 | card->evtbd_rdptr = 0 | reg->evt_rollover_ind; |
|---|
| 1019 | 1185 | card->evtbd_ring_size = 0; |
|---|
| .. | .. |
|---|
| 1040 | 1206 | } |
|---|
| 1041 | 1207 | skb_put(skb, MWIFIEX_UPLD_SIZE); |
|---|
| 1042 | 1208 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
|---|
| 1043 | | - PCI_DMA_FROMDEVICE)) { |
|---|
| 1209 | + DMA_FROM_DEVICE)) { |
|---|
| 1044 | 1210 | kfree_skb(skb); |
|---|
| 1045 | 1211 | return -1; |
|---|
| 1046 | 1212 | } |
|---|
| .. | .. |
|---|
| 1064 | 1230 | |
|---|
| 1065 | 1231 | if (card && card->cmdrsp_buf) { |
|---|
| 1066 | 1232 | mwifiex_unmap_pci_memory(adapter, card->cmdrsp_buf, |
|---|
| 1067 | | - PCI_DMA_FROMDEVICE); |
|---|
| 1233 | + DMA_FROM_DEVICE); |
|---|
| 1068 | 1234 | dev_kfree_skb_any(card->cmdrsp_buf); |
|---|
| 1069 | 1235 | card->cmdrsp_buf = NULL; |
|---|
| 1070 | 1236 | } |
|---|
| 1071 | 1237 | |
|---|
| 1072 | 1238 | if (card && card->cmd_buf) { |
|---|
| 1073 | 1239 | mwifiex_unmap_pci_memory(adapter, card->cmd_buf, |
|---|
| 1074 | | - PCI_DMA_TODEVICE); |
|---|
| 1240 | + DMA_TO_DEVICE); |
|---|
| 1075 | 1241 | dev_kfree_skb_any(card->cmd_buf); |
|---|
| 1076 | 1242 | card->cmd_buf = NULL; |
|---|
| 1077 | 1243 | } |
|---|
| .. | .. |
|---|
| 1086 | 1252 | struct pcie_service_card *card = adapter->card; |
|---|
| 1087 | 1253 | u32 *cookie; |
|---|
| 1088 | 1254 | |
|---|
| 1089 | | - card->sleep_cookie_vbase = pci_alloc_consistent(card->dev, sizeof(u32), |
|---|
| 1090 | | - &card->sleep_cookie_pbase); |
|---|
| 1255 | + card->sleep_cookie_vbase = dma_alloc_coherent(&card->dev->dev, |
|---|
| 1256 | + sizeof(u32), |
|---|
| 1257 | + &card->sleep_cookie_pbase, |
|---|
| 1258 | + GFP_KERNEL); |
|---|
| 1091 | 1259 | if (!card->sleep_cookie_vbase) { |
|---|
| 1092 | 1260 | mwifiex_dbg(adapter, ERROR, |
|---|
| 1093 | | - "pci_alloc_consistent failed!\n"); |
|---|
| 1261 | + "dma_alloc_coherent failed!\n"); |
|---|
| 1094 | 1262 | return -ENOMEM; |
|---|
| 1095 | 1263 | } |
|---|
| 1096 | 1264 | cookie = (u32 *)card->sleep_cookie_vbase; |
|---|
| .. | .. |
|---|
| 1115 | 1283 | card = adapter->card; |
|---|
| 1116 | 1284 | |
|---|
| 1117 | 1285 | if (card && card->sleep_cookie_vbase) { |
|---|
| 1118 | | - pci_free_consistent(card->dev, sizeof(u32), |
|---|
| 1119 | | - card->sleep_cookie_vbase, |
|---|
| 1120 | | - card->sleep_cookie_pbase); |
|---|
| 1286 | + dma_free_coherent(&card->dev->dev, sizeof(u32), |
|---|
| 1287 | + card->sleep_cookie_vbase, |
|---|
| 1288 | + card->sleep_cookie_pbase); |
|---|
| 1121 | 1289 | card->sleep_cookie_vbase = NULL; |
|---|
| 1122 | 1290 | } |
|---|
| 1123 | 1291 | |
|---|
| .. | .. |
|---|
| 1189 | 1357 | "SEND COMP: Detach skb %p at txbd_rdidx=%d\n", |
|---|
| 1190 | 1358 | skb, wrdoneidx); |
|---|
| 1191 | 1359 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 1192 | | - PCI_DMA_TODEVICE); |
|---|
| 1360 | + DMA_TO_DEVICE); |
|---|
| 1193 | 1361 | |
|---|
| 1194 | 1362 | unmap_count++; |
|---|
| 1195 | 1363 | |
|---|
| .. | .. |
|---|
| 1282 | 1450 | put_unaligned_le16(MWIFIEX_TYPE_DATA, payload + 2); |
|---|
| 1283 | 1451 | |
|---|
| 1284 | 1452 | if (mwifiex_map_pci_memory(adapter, skb, skb->len, |
|---|
| 1285 | | - PCI_DMA_TODEVICE)) |
|---|
| 1453 | + DMA_TO_DEVICE)) |
|---|
| 1286 | 1454 | return -1; |
|---|
| 1287 | 1455 | |
|---|
| 1288 | 1456 | wrindx = (card->txbd_wrptr & reg->tx_mask) >> reg->tx_start_ptr; |
|---|
| .. | .. |
|---|
| 1372 | 1540 | |
|---|
| 1373 | 1541 | return -EINPROGRESS; |
|---|
| 1374 | 1542 | done_unmap: |
|---|
| 1375 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 1543 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 1376 | 1544 | card->tx_buf_list[wrindx] = NULL; |
|---|
| 1377 | 1545 | atomic_dec(&adapter->tx_hw_pending); |
|---|
| 1378 | 1546 | if (reg->pfu_enabled) |
|---|
| .. | .. |
|---|
| 1426 | 1594 | if (!skb_data) |
|---|
| 1427 | 1595 | return -ENOMEM; |
|---|
| 1428 | 1596 | |
|---|
| 1429 | | - mwifiex_unmap_pci_memory(adapter, skb_data, PCI_DMA_FROMDEVICE); |
|---|
| 1597 | + mwifiex_unmap_pci_memory(adapter, skb_data, DMA_FROM_DEVICE); |
|---|
| 1430 | 1598 | card->rx_buf_list[rd_index] = NULL; |
|---|
| 1431 | 1599 | |
|---|
| 1432 | 1600 | /* Get data length from interface header - |
|---|
| .. | .. |
|---|
| 1464 | 1632 | |
|---|
| 1465 | 1633 | if (mwifiex_map_pci_memory(adapter, skb_tmp, |
|---|
| 1466 | 1634 | MWIFIEX_RX_DATA_BUF_SIZE, |
|---|
| 1467 | | - PCI_DMA_FROMDEVICE)) |
|---|
| 1635 | + DMA_FROM_DEVICE)) |
|---|
| 1468 | 1636 | return -1; |
|---|
| 1469 | 1637 | |
|---|
| 1470 | 1638 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb_tmp); |
|---|
| .. | .. |
|---|
| 1541 | 1709 | return -1; |
|---|
| 1542 | 1710 | } |
|---|
| 1543 | 1711 | |
|---|
| 1544 | | - if (mwifiex_map_pci_memory(adapter, skb, skb->len, PCI_DMA_TODEVICE)) |
|---|
| 1712 | + if (mwifiex_map_pci_memory(adapter, skb, skb->len, DMA_TO_DEVICE)) |
|---|
| 1545 | 1713 | return -1; |
|---|
| 1546 | 1714 | |
|---|
| 1547 | 1715 | buf_pa = MWIFIEX_SKB_DMA_ADDR(skb); |
|---|
| .. | .. |
|---|
| 1553 | 1721 | mwifiex_dbg(adapter, ERROR, |
|---|
| 1554 | 1722 | "%s: failed to write download command to boot code.\n", |
|---|
| 1555 | 1723 | __func__); |
|---|
| 1556 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 1724 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 1557 | 1725 | return -1; |
|---|
| 1558 | 1726 | } |
|---|
| 1559 | 1727 | |
|---|
| .. | .. |
|---|
| 1565 | 1733 | mwifiex_dbg(adapter, ERROR, |
|---|
| 1566 | 1734 | "%s: failed to write download command to boot code.\n", |
|---|
| 1567 | 1735 | __func__); |
|---|
| 1568 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 1736 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 1569 | 1737 | return -1; |
|---|
| 1570 | 1738 | } |
|---|
| 1571 | 1739 | |
|---|
| .. | .. |
|---|
| 1574 | 1742 | mwifiex_dbg(adapter, ERROR, |
|---|
| 1575 | 1743 | "%s: failed to write command len to cmd_size scratch reg\n", |
|---|
| 1576 | 1744 | __func__); |
|---|
| 1577 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 1745 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 1578 | 1746 | return -1; |
|---|
| 1579 | 1747 | } |
|---|
| 1580 | 1748 | |
|---|
| .. | .. |
|---|
| 1583 | 1751 | CPU_INTR_DOOR_BELL)) { |
|---|
| 1584 | 1752 | mwifiex_dbg(adapter, ERROR, |
|---|
| 1585 | 1753 | "%s: failed to assert door-bell intr\n", __func__); |
|---|
| 1586 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 1754 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 1587 | 1755 | return -1; |
|---|
| 1588 | 1756 | } |
|---|
| 1589 | 1757 | |
|---|
| .. | .. |
|---|
| 1642 | 1810 | put_unaligned_le16((u16)skb->len, &payload[0]); |
|---|
| 1643 | 1811 | put_unaligned_le16(MWIFIEX_TYPE_CMD, &payload[2]); |
|---|
| 1644 | 1812 | |
|---|
| 1645 | | - if (mwifiex_map_pci_memory(adapter, skb, skb->len, PCI_DMA_TODEVICE)) |
|---|
| 1813 | + if (mwifiex_map_pci_memory(adapter, skb, skb->len, DMA_TO_DEVICE)) |
|---|
| 1646 | 1814 | return -1; |
|---|
| 1647 | 1815 | |
|---|
| 1648 | 1816 | card->cmd_buf = skb; |
|---|
| .. | .. |
|---|
| 1742 | 1910 | "info: Rx CMD Response\n"); |
|---|
| 1743 | 1911 | |
|---|
| 1744 | 1912 | if (adapter->curr_cmd) |
|---|
| 1745 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_FROMDEVICE); |
|---|
| 1913 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_FROM_DEVICE); |
|---|
| 1746 | 1914 | else |
|---|
| 1747 | | - pci_dma_sync_single_for_cpu(card->dev, |
|---|
| 1748 | | - MWIFIEX_SKB_DMA_ADDR(skb), |
|---|
| 1749 | | - MWIFIEX_UPLD_SIZE, |
|---|
| 1750 | | - PCI_DMA_FROMDEVICE); |
|---|
| 1915 | + dma_sync_single_for_cpu(&card->dev->dev, |
|---|
| 1916 | + MWIFIEX_SKB_DMA_ADDR(skb), |
|---|
| 1917 | + MWIFIEX_UPLD_SIZE, DMA_FROM_DEVICE); |
|---|
| 1751 | 1918 | |
|---|
| 1752 | 1919 | /* Unmap the command as a response has been received. */ |
|---|
| 1753 | 1920 | if (card->cmd_buf) { |
|---|
| 1754 | 1921 | mwifiex_unmap_pci_memory(adapter, card->cmd_buf, |
|---|
| 1755 | | - PCI_DMA_TODEVICE); |
|---|
| 1922 | + DMA_TO_DEVICE); |
|---|
| 1756 | 1923 | dev_kfree_skb_any(card->cmd_buf); |
|---|
| 1757 | 1924 | card->cmd_buf = NULL; |
|---|
| 1758 | 1925 | } |
|---|
| .. | .. |
|---|
| 1763 | 1930 | |
|---|
| 1764 | 1931 | if (!adapter->curr_cmd) { |
|---|
| 1765 | 1932 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
|---|
| 1766 | | - pci_dma_sync_single_for_device(card->dev, |
|---|
| 1767 | | - MWIFIEX_SKB_DMA_ADDR(skb), |
|---|
| 1768 | | - MWIFIEX_SLEEP_COOKIE_SIZE, |
|---|
| 1769 | | - PCI_DMA_FROMDEVICE); |
|---|
| 1933 | + dma_sync_single_for_device(&card->dev->dev, |
|---|
| 1934 | + MWIFIEX_SKB_DMA_ADDR(skb), |
|---|
| 1935 | + MWIFIEX_SLEEP_COOKIE_SIZE, |
|---|
| 1936 | + DMA_FROM_DEVICE); |
|---|
| 1770 | 1937 | if (mwifiex_write_reg(adapter, |
|---|
| 1771 | 1938 | PCIE_CPU_INT_EVENT, |
|---|
| 1772 | 1939 | CPU_INTR_SLEEP_CFM_DONE)) { |
|---|
| .. | .. |
|---|
| 1777 | 1944 | mwifiex_delay_for_sleep_cookie(adapter, |
|---|
| 1778 | 1945 | MWIFIEX_MAX_DELAY_COUNT); |
|---|
| 1779 | 1946 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 1780 | | - PCI_DMA_FROMDEVICE); |
|---|
| 1947 | + DMA_FROM_DEVICE); |
|---|
| 1781 | 1948 | skb_pull(skb, adapter->intf_hdr_len); |
|---|
| 1782 | 1949 | while (reg->sleep_cookie && (count++ < 10) && |
|---|
| 1783 | 1950 | mwifiex_pcie_ok_to_access_hw(adapter)) |
|---|
| .. | .. |
|---|
| 1793 | 1960 | min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len)); |
|---|
| 1794 | 1961 | skb_push(skb, adapter->intf_hdr_len); |
|---|
| 1795 | 1962 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
|---|
| 1796 | | - PCI_DMA_FROMDEVICE)) |
|---|
| 1963 | + DMA_FROM_DEVICE)) |
|---|
| 1797 | 1964 | return -1; |
|---|
| 1798 | 1965 | } else if (mwifiex_pcie_ok_to_access_hw(adapter)) { |
|---|
| 1799 | 1966 | skb_pull(skb, adapter->intf_hdr_len); |
|---|
| .. | .. |
|---|
| 1835 | 2002 | card->cmdrsp_buf = skb; |
|---|
| 1836 | 2003 | skb_push(card->cmdrsp_buf, adapter->intf_hdr_len); |
|---|
| 1837 | 2004 | if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE, |
|---|
| 1838 | | - PCI_DMA_FROMDEVICE)) |
|---|
| 2005 | + DMA_FROM_DEVICE)) |
|---|
| 1839 | 2006 | return -1; |
|---|
| 1840 | 2007 | } |
|---|
| 1841 | 2008 | |
|---|
| .. | .. |
|---|
| 1890 | 2057 | mwifiex_dbg(adapter, INFO, |
|---|
| 1891 | 2058 | "info: Read Index: %d\n", rdptr); |
|---|
| 1892 | 2059 | skb_cmd = card->evt_buf_list[rdptr]; |
|---|
| 1893 | | - mwifiex_unmap_pci_memory(adapter, skb_cmd, PCI_DMA_FROMDEVICE); |
|---|
| 2060 | + mwifiex_unmap_pci_memory(adapter, skb_cmd, DMA_FROM_DEVICE); |
|---|
| 1894 | 2061 | |
|---|
| 1895 | 2062 | /* Take the pointer and set it to event pointer in adapter |
|---|
| 1896 | 2063 | and will return back after event handling callback */ |
|---|
| .. | .. |
|---|
| 1970 | 2137 | skb_put(skb, MAX_EVENT_SIZE - skb->len); |
|---|
| 1971 | 2138 | if (mwifiex_map_pci_memory(adapter, skb, |
|---|
| 1972 | 2139 | MAX_EVENT_SIZE, |
|---|
| 1973 | | - PCI_DMA_FROMDEVICE)) |
|---|
| 2140 | + DMA_FROM_DEVICE)) |
|---|
| 1974 | 2141 | return -1; |
|---|
| 1975 | 2142 | card->evt_buf_list[rdptr] = skb; |
|---|
| 1976 | 2143 | desc = card->evtbd_ring[rdptr]; |
|---|
| .. | .. |
|---|
| 2252 | 2419 | "interrupt status during fw dnld.\n", |
|---|
| 2253 | 2420 | __func__); |
|---|
| 2254 | 2421 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 2255 | | - PCI_DMA_TODEVICE); |
|---|
| 2422 | + DMA_TO_DEVICE); |
|---|
| 2256 | 2423 | ret = -1; |
|---|
| 2257 | 2424 | goto done; |
|---|
| 2258 | 2425 | } |
|---|
| .. | .. |
|---|
| 2264 | 2431 | mwifiex_dbg(adapter, ERROR, "%s: Card failed to ACK download\n", |
|---|
| 2265 | 2432 | __func__); |
|---|
| 2266 | 2433 | mwifiex_unmap_pci_memory(adapter, skb, |
|---|
| 2267 | | - PCI_DMA_TODEVICE); |
|---|
| 2434 | + DMA_TO_DEVICE); |
|---|
| 2268 | 2435 | ret = -1; |
|---|
| 2269 | 2436 | goto done; |
|---|
| 2270 | 2437 | } |
|---|
| 2271 | 2438 | |
|---|
| 2272 | | - mwifiex_unmap_pci_memory(adapter, skb, PCI_DMA_TODEVICE); |
|---|
| 2439 | + mwifiex_unmap_pci_memory(adapter, skb, DMA_TO_DEVICE); |
|---|
| 2273 | 2440 | |
|---|
| 2274 | 2441 | offset += txlen; |
|---|
| 2275 | 2442 | } while (true); |
|---|
| .. | .. |
|---|
| 2939 | 3106 | |
|---|
| 2940 | 3107 | pci_set_master(pdev); |
|---|
| 2941 | 3108 | |
|---|
| 2942 | | - pr_notice("try set_consistent_dma_mask(32)\n"); |
|---|
| 2943 | | - ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
|---|
| 3109 | + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); |
|---|
| 2944 | 3110 | if (ret) { |
|---|
| 2945 | | - pr_err("set_dma_mask(32) failed\n"); |
|---|
| 2946 | | - goto err_set_dma_mask; |
|---|
| 2947 | | - } |
|---|
| 2948 | | - |
|---|
| 2949 | | - ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); |
|---|
| 2950 | | - if (ret) { |
|---|
| 2951 | | - pr_err("set_consistent_dma_mask(64) failed\n"); |
|---|
| 3111 | + pr_err("dma_set_mask(32) failed: %d\n", ret); |
|---|
| 2952 | 3112 | goto err_set_dma_mask; |
|---|
| 2953 | 3113 | } |
|---|
| 2954 | 3114 | |
|---|
| .. | .. |
|---|
| 2975 | 3135 | goto err_iomap2; |
|---|
| 2976 | 3136 | } |
|---|
| 2977 | 3137 | |
|---|
| 2978 | | - pr_notice("PCI memory map Virt0: %p PCI memory map Virt2: %p\n", |
|---|
| 3138 | + pr_notice("PCI memory map Virt0: %pK PCI memory map Virt2: %pK\n", |
|---|
| 2979 | 3139 | card->pci_mmap, card->pci_mmap1); |
|---|
| 2980 | 3140 | |
|---|
| 2981 | 3141 | ret = mwifiex_pcie_alloc_buffers(adapter); |
|---|
| 2982 | 3142 | if (ret) |
|---|
| 2983 | 3143 | goto err_alloc_buffers; |
|---|
| 2984 | 3144 | |
|---|
| 3145 | + if (pdev->device == PCIE_DEVICE_ID_MARVELL_88W8897) |
|---|
| 3146 | + adapter->ignore_btcoex_events = true; |
|---|
| 3147 | + |
|---|
| 2985 | 3148 | return 0; |
|---|
| 2986 | 3149 | |
|---|
| 2987 | 3150 | err_alloc_buffers: |
|---|