diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath10k/pci.c')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/pci.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 3fca200b986c..930785a724e1 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c | |||
@@ -57,12 +57,6 @@ MODULE_PARM_DESC(reset_mode, "0: auto, 1: warm only (default: 0)"); | |||
57 | #define ATH10K_PCI_TARGET_WAIT 3000 | 57 | #define ATH10K_PCI_TARGET_WAIT 3000 |
58 | #define ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS 3 | 58 | #define ATH10K_PCI_NUM_WARM_RESET_ATTEMPTS 3 |
59 | 59 | ||
60 | #define QCA988X_2_0_DEVICE_ID (0x003c) | ||
61 | #define QCA6164_2_1_DEVICE_ID (0x0041) | ||
62 | #define QCA6174_2_1_DEVICE_ID (0x003e) | ||
63 | #define QCA99X0_2_0_DEVICE_ID (0x0040) | ||
64 | #define QCA9377_1_0_DEVICE_ID (0x0042) | ||
65 | |||
66 | static const struct pci_device_id ath10k_pci_id_table[] = { | 60 | static const struct pci_device_id ath10k_pci_id_table[] = { |
67 | { PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */ | 61 | { PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */ |
68 | { PCI_VDEVICE(ATHEROS, QCA6164_2_1_DEVICE_ID) }, /* PCI-E QCA6164 V2.1 */ | 62 | { PCI_VDEVICE(ATHEROS, QCA6164_2_1_DEVICE_ID) }, /* PCI-E QCA6164 V2.1 */ |
@@ -92,7 +86,9 @@ static const struct ath10k_pci_supp_chip ath10k_pci_supp_chips[] = { | |||
92 | { QCA6174_2_1_DEVICE_ID, QCA6174_HW_3_2_CHIP_ID_REV }, | 86 | { QCA6174_2_1_DEVICE_ID, QCA6174_HW_3_2_CHIP_ID_REV }, |
93 | 87 | ||
94 | { QCA99X0_2_0_DEVICE_ID, QCA99X0_HW_2_0_CHIP_ID_REV }, | 88 | { QCA99X0_2_0_DEVICE_ID, QCA99X0_HW_2_0_CHIP_ID_REV }, |
89 | |||
95 | { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_0_CHIP_ID_REV }, | 90 | { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_0_CHIP_ID_REV }, |
91 | { QCA9377_1_0_DEVICE_ID, QCA9377_HW_1_1_CHIP_ID_REV }, | ||
96 | }; | 92 | }; |
97 | 93 | ||
98 | static void ath10k_pci_buffer_cleanup(struct ath10k *ar); | 94 | static void ath10k_pci_buffer_cleanup(struct ath10k *ar); |
@@ -111,8 +107,9 @@ static void ath10k_pci_htc_tx_cb(struct ath10k_ce_pipe *ce_state); | |||
111 | static void ath10k_pci_htc_rx_cb(struct ath10k_ce_pipe *ce_state); | 107 | static void ath10k_pci_htc_rx_cb(struct ath10k_ce_pipe *ce_state); |
112 | static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state); | 108 | static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state); |
113 | static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state); | 109 | static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state); |
110 | static void ath10k_pci_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state); | ||
114 | 111 | ||
115 | static const struct ce_attr host_ce_config_wlan[] = { | 112 | static struct ce_attr host_ce_config_wlan[] = { |
116 | /* CE0: host->target HTC control and raw streams */ | 113 | /* CE0: host->target HTC control and raw streams */ |
117 | { | 114 | { |
118 | .flags = CE_ATTR_FLAGS, | 115 | .flags = CE_ATTR_FLAGS, |
@@ -128,7 +125,7 @@ static const struct ce_attr host_ce_config_wlan[] = { | |||
128 | .src_nentries = 0, | 125 | .src_nentries = 0, |
129 | .src_sz_max = 2048, | 126 | .src_sz_max = 2048, |
130 | .dest_nentries = 512, | 127 | .dest_nentries = 512, |
131 | .recv_cb = ath10k_pci_htc_rx_cb, | 128 | .recv_cb = ath10k_pci_htt_htc_rx_cb, |
132 | }, | 129 | }, |
133 | 130 | ||
134 | /* CE2: target->host WMI */ | 131 | /* CE2: target->host WMI */ |
@@ -217,7 +214,7 @@ static const struct ce_attr host_ce_config_wlan[] = { | |||
217 | }; | 214 | }; |
218 | 215 | ||
219 | /* Target firmware's Copy Engine configuration. */ | 216 | /* Target firmware's Copy Engine configuration. */ |
220 | static const struct ce_pipe_config target_ce_config_wlan[] = { | 217 | static struct ce_pipe_config target_ce_config_wlan[] = { |
221 | /* CE0: host->target HTC control and raw streams */ | 218 | /* CE0: host->target HTC control and raw streams */ |
222 | { | 219 | { |
223 | .pipenum = __cpu_to_le32(0), | 220 | .pipenum = __cpu_to_le32(0), |
@@ -330,7 +327,7 @@ static const struct ce_pipe_config target_ce_config_wlan[] = { | |||
330 | * This table is derived from the CE_PCI TABLE, above. | 327 | * This table is derived from the CE_PCI TABLE, above. |
331 | * It is passed to the Target at startup for use by firmware. | 328 | * It is passed to the Target at startup for use by firmware. |
332 | */ | 329 | */ |
333 | static const struct service_to_pipe target_service_to_ce_map_wlan[] = { | 330 | static struct service_to_pipe target_service_to_ce_map_wlan[] = { |
334 | { | 331 | { |
335 | __cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO), | 332 | __cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO), |
336 | __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ | 333 | __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ |
@@ -1208,6 +1205,16 @@ static void ath10k_pci_htc_rx_cb(struct ath10k_ce_pipe *ce_state) | |||
1208 | ath10k_pci_process_rx_cb(ce_state, ath10k_htc_rx_completion_handler); | 1205 | ath10k_pci_process_rx_cb(ce_state, ath10k_htc_rx_completion_handler); |
1209 | } | 1206 | } |
1210 | 1207 | ||
1208 | static void ath10k_pci_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state) | ||
1209 | { | ||
1210 | /* CE4 polling needs to be done whenever CE pipe which transports | ||
1211 | * HTT Rx (target->host) is processed. | ||
1212 | */ | ||
1213 | ath10k_ce_per_engine_service(ce_state->ar, 4); | ||
1214 | |||
1215 | ath10k_pci_process_rx_cb(ce_state, ath10k_htc_rx_completion_handler); | ||
1216 | } | ||
1217 | |||
1211 | /* Called by lower (CE) layer when a send to HTT Target completes. */ | 1218 | /* Called by lower (CE) layer when a send to HTT Target completes. */ |
1212 | static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state) | 1219 | static void ath10k_pci_htt_tx_cb(struct ath10k_ce_pipe *ce_state) |
1213 | { | 1220 | { |
@@ -2027,6 +2034,29 @@ static int ath10k_pci_init_config(struct ath10k *ar) | |||
2027 | return 0; | 2034 | return 0; |
2028 | } | 2035 | } |
2029 | 2036 | ||
2037 | static void ath10k_pci_override_ce_config(struct ath10k *ar) | ||
2038 | { | ||
2039 | struct ce_attr *attr; | ||
2040 | struct ce_pipe_config *config; | ||
2041 | |||
2042 | /* For QCA6174 we're overriding the Copy Engine 5 configuration, | ||
2043 | * since it is currently used for other feature. | ||
2044 | */ | ||
2045 | |||
2046 | /* Override Host's Copy Engine 5 configuration */ | ||
2047 | attr = &host_ce_config_wlan[5]; | ||
2048 | attr->src_sz_max = 0; | ||
2049 | attr->dest_nentries = 0; | ||
2050 | |||
2051 | /* Override Target firmware's Copy Engine configuration */ | ||
2052 | config = &target_ce_config_wlan[5]; | ||
2053 | config->pipedir = __cpu_to_le32(PIPEDIR_OUT); | ||
2054 | config->nbytes_max = __cpu_to_le32(2048); | ||
2055 | |||
2056 | /* Map from service/endpoint to Copy Engine */ | ||
2057 | target_service_to_ce_map_wlan[15].pipenum = __cpu_to_le32(1); | ||
2058 | } | ||
2059 | |||
2030 | static int ath10k_pci_alloc_pipes(struct ath10k *ar) | 2060 | static int ath10k_pci_alloc_pipes(struct ath10k *ar) |
2031 | { | 2061 | { |
2032 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); | 2062 | struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); |
@@ -3020,6 +3050,9 @@ static int ath10k_pci_probe(struct pci_dev *pdev, | |||
3020 | goto err_core_destroy; | 3050 | goto err_core_destroy; |
3021 | } | 3051 | } |
3022 | 3052 | ||
3053 | if (QCA_REV_6174(ar)) | ||
3054 | ath10k_pci_override_ce_config(ar); | ||
3055 | |||
3023 | ret = ath10k_pci_alloc_pipes(ar); | 3056 | ret = ath10k_pci_alloc_pipes(ar); |
3024 | if (ret) { | 3057 | if (ret) { |
3025 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", | 3058 | ath10k_err(ar, "failed to allocate copy engine pipes: %d\n", |