aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2015-01-24 05:14:49 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2015-01-27 09:01:02 -0500
commitd63955b33b3bee45d784ffdfafeb93076c765660 (patch)
tree483722661763983bcd56f5d7f121c10f200d8850
parent3ec79e3a75ed062cb0c13ceef0690929b777cf59 (diff)
ath10k: add support for qca6174
The QCA6174 in combination with new wmi-tlv firmware is capable of multi-channel, beamforming, tdls and other features. This patch just makes it possible to boot these devices and do some basic stuff like connect to an AP without encryption. Some things may not work or may be unreliable. New features will be implemented later. This will be addressed eventually with future patches. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/Makefile3
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.c12
-rw-r--r--drivers/net/wireless/ath/ath10k/ce.h2
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c44
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h6
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.c58
-rw-r--r--drivers/net/wireless/ath/ath10k/hw.h102
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c105
-rw-r--r--drivers/net/wireless/ath/ath10k/targaddrs.h5
9 files changed, 302 insertions, 35 deletions
diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile
index 6c0c23e79bda..f4dbb3e93bf8 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -9,7 +9,8 @@ ath10k_core-y += mac.o \
9 txrx.o \ 9 txrx.o \
10 wmi.o \ 10 wmi.o \
11 wmi-tlv.o \ 11 wmi-tlv.o \
12 bmi.o 12 bmi.o \
13 hw.o
13 14
14ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o 15ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += spectral.o
15ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o 16ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c
index 42ec79327943..e508c65b6ba8 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -803,7 +803,7 @@ int ath10k_ce_disable_interrupts(struct ath10k *ar)
803 int ce_id; 803 int ce_id;
804 804
805 for (ce_id = 0; ce_id < CE_COUNT; ce_id++) { 805 for (ce_id = 0; ce_id < CE_COUNT; ce_id++) {
806 u32 ctrl_addr = ath10k_ce_base_address(ce_id); 806 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
807 807
808 ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr); 808 ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
809 ath10k_ce_error_intr_disable(ar, ctrl_addr); 809 ath10k_ce_error_intr_disable(ar, ctrl_addr);
@@ -832,7 +832,7 @@ static int ath10k_ce_init_src_ring(struct ath10k *ar,
832 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 832 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
833 struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; 833 struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id];
834 struct ath10k_ce_ring *src_ring = ce_state->src_ring; 834 struct ath10k_ce_ring *src_ring = ce_state->src_ring;
835 u32 nentries, ctrl_addr = ath10k_ce_base_address(ce_id); 835 u32 nentries, ctrl_addr = ath10k_ce_base_address(ar, ce_id);
836 836
837 nentries = roundup_pow_of_two(attr->src_nentries); 837 nentries = roundup_pow_of_two(attr->src_nentries);
838 838
@@ -869,7 +869,7 @@ static int ath10k_ce_init_dest_ring(struct ath10k *ar,
869 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); 869 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
870 struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id]; 870 struct ath10k_ce_pipe *ce_state = &ar_pci->ce_states[ce_id];
871 struct ath10k_ce_ring *dest_ring = ce_state->dest_ring; 871 struct ath10k_ce_ring *dest_ring = ce_state->dest_ring;
872 u32 nentries, ctrl_addr = ath10k_ce_base_address(ce_id); 872 u32 nentries, ctrl_addr = ath10k_ce_base_address(ar, ce_id);
873 873
874 nentries = roundup_pow_of_two(attr->dest_nentries); 874 nentries = roundup_pow_of_two(attr->dest_nentries);
875 875
@@ -1051,7 +1051,7 @@ int ath10k_ce_init_pipe(struct ath10k *ar, unsigned int ce_id,
1051 1051
1052static void ath10k_ce_deinit_src_ring(struct ath10k *ar, unsigned int ce_id) 1052static void ath10k_ce_deinit_src_ring(struct ath10k *ar, unsigned int ce_id)
1053{ 1053{
1054 u32 ctrl_addr = ath10k_ce_base_address(ce_id); 1054 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
1055 1055
1056 ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, 0); 1056 ath10k_ce_src_ring_base_addr_set(ar, ctrl_addr, 0);
1057 ath10k_ce_src_ring_size_set(ar, ctrl_addr, 0); 1057 ath10k_ce_src_ring_size_set(ar, ctrl_addr, 0);
@@ -1061,7 +1061,7 @@ static void ath10k_ce_deinit_src_ring(struct ath10k *ar, unsigned int ce_id)
1061 1061
1062static void ath10k_ce_deinit_dest_ring(struct ath10k *ar, unsigned int ce_id) 1062static void ath10k_ce_deinit_dest_ring(struct ath10k *ar, unsigned int ce_id)
1063{ 1063{
1064 u32 ctrl_addr = ath10k_ce_base_address(ce_id); 1064 u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
1065 1065
1066 ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, 0); 1066 ath10k_ce_dest_ring_base_addr_set(ar, ctrl_addr, 0);
1067 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, 0); 1067 ath10k_ce_dest_ring_size_set(ar, ctrl_addr, 0);
@@ -1098,7 +1098,7 @@ int ath10k_ce_alloc_pipe(struct ath10k *ar, int ce_id,
1098 1098
1099 ce_state->ar = ar; 1099 ce_state->ar = ar;
1100 ce_state->id = ce_id; 1100 ce_state->id = ce_id;
1101 ce_state->ctrl_addr = ath10k_ce_base_address(ce_id); 1101 ce_state->ctrl_addr = ath10k_ce_base_address(ar, ce_id);
1102 ce_state->attr_flags = attr->flags; 1102 ce_state->attr_flags = attr->flags;
1103 ce_state->src_sz_max = attr->src_sz_max; 1103 ce_state->src_sz_max = attr->src_sz_max;
1104 1104
diff --git a/drivers/net/wireless/ath/ath10k/ce.h b/drivers/net/wireless/ath/ath10k/ce.h
index 617a151e8ce4..c18647b87f71 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -394,7 +394,7 @@ struct ce_attr {
394#define DST_WATERMARK_HIGH_RESET 0 394#define DST_WATERMARK_HIGH_RESET 0
395#define DST_WATERMARK_ADDRESS 0x0050 395#define DST_WATERMARK_ADDRESS 0x0050
396 396
397static inline u32 ath10k_ce_base_address(unsigned int ce_id) 397static inline u32 ath10k_ce_base_address(struct ath10k *ar, unsigned int ce_id)
398{ 398{
399 return CE0_BASE_ADDRESS + (CE1_BASE_ADDRESS - CE0_BASE_ADDRESS) * ce_id; 399 return CE0_BASE_ADDRESS + (CE1_BASE_ADDRESS - CE0_BASE_ADDRESS) * ce_id;
400} 400}
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 6860afbe68d9..5e9e1a6958f4 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -57,6 +57,34 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
57 .board_ext_size = QCA988X_BOARD_EXT_DATA_SZ, 57 .board_ext_size = QCA988X_BOARD_EXT_DATA_SZ,
58 }, 58 },
59 }, 59 },
60 {
61 .id = QCA6174_HW_2_1_VERSION,
62 .name = "qca6174 hw2.1",
63 .patch_load_addr = QCA6174_HW_2_1_PATCH_LOAD_ADDR,
64 .uart_pin = 6,
65 .fw = {
66 .dir = QCA6174_HW_2_1_FW_DIR,
67 .fw = QCA6174_HW_2_1_FW_FILE,
68 .otp = QCA6174_HW_2_1_OTP_FILE,
69 .board = QCA6174_HW_2_1_BOARD_DATA_FILE,
70 .board_size = QCA6174_BOARD_DATA_SZ,
71 .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
72 },
73 },
74 {
75 .id = QCA6174_HW_3_0_VERSION,
76 .name = "qca6174 hw3.0",
77 .patch_load_addr = QCA6174_HW_3_0_PATCH_LOAD_ADDR,
78 .uart_pin = 6,
79 .fw = {
80 .dir = QCA6174_HW_3_0_FW_DIR,
81 .fw = QCA6174_HW_3_0_FW_FILE,
82 .otp = QCA6174_HW_3_0_OTP_FILE,
83 .board = QCA6174_HW_3_0_BOARD_DATA_FILE,
84 .board_size = QCA6174_BOARD_DATA_SZ,
85 .board_ext_size = QCA6174_BOARD_EXT_DATA_SZ,
86 },
87 },
60}; 88};
61 89
62static void ath10k_send_suspend_complete(struct ath10k *ar) 90static void ath10k_send_suspend_complete(struct ath10k *ar)
@@ -1308,6 +1336,7 @@ EXPORT_SYMBOL(ath10k_core_unregister);
1308 1336
1309struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, 1337struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
1310 enum ath10k_bus bus, 1338 enum ath10k_bus bus,
1339 enum ath10k_hw_rev hw_rev,
1311 const struct ath10k_hif_ops *hif_ops) 1340 const struct ath10k_hif_ops *hif_ops)
1312{ 1341{
1313 struct ath10k *ar; 1342 struct ath10k *ar;
@@ -1320,9 +1349,24 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
1320 ar->ath_common.priv = ar; 1349 ar->ath_common.priv = ar;
1321 ar->ath_common.hw = ar->hw; 1350 ar->ath_common.hw = ar->hw;
1322 ar->dev = dev; 1351 ar->dev = dev;
1352 ar->hw_rev = hw_rev;
1323 ar->hif.ops = hif_ops; 1353 ar->hif.ops = hif_ops;
1324 ar->hif.bus = bus; 1354 ar->hif.bus = bus;
1325 1355
1356 switch (hw_rev) {
1357 case ATH10K_HW_QCA988X:
1358 ar->regs = &qca988x_regs;
1359 break;
1360 case ATH10K_HW_QCA6174:
1361 ar->regs = &qca6174_regs;
1362 break;
1363 default:
1364 ath10k_err(ar, "unsupported core hardware revision %d\n",
1365 hw_rev);
1366 ret = -ENOTSUPP;
1367 goto err_free_mac;
1368 }
1369
1326 init_completion(&ar->scan.started); 1370 init_completion(&ar->scan.started);
1327 init_completion(&ar->scan.completed); 1371 init_completion(&ar->scan.completed);
1328 init_completion(&ar->scan.on_channel); 1372 init_completion(&ar->scan.on_channel);
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 774d8ceb4053..2d9f87143089 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -471,6 +471,7 @@ struct ath10k {
471 struct device *dev; 471 struct device *dev;
472 u8 mac_addr[ETH_ALEN]; 472 u8 mac_addr[ETH_ALEN];
473 473
474 enum ath10k_hw_rev hw_rev;
474 u32 chip_id; 475 u32 chip_id;
475 u32 target_version; 476 u32 target_version;
476 u8 fw_version_major; 477 u8 fw_version_major;
@@ -486,9 +487,6 @@ struct ath10k {
486 487
487 DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT); 488 DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
488 489
489 struct targetdef *targetdef;
490 struct hostdef *hostdef;
491
492 bool p2p; 490 bool p2p;
493 491
494 struct { 492 struct {
@@ -498,6 +496,7 @@ struct ath10k {
498 496
499 struct completion target_suspend; 497 struct completion target_suspend;
500 498
499 const struct ath10k_hw_regs *regs;
501 struct ath10k_bmi bmi; 500 struct ath10k_bmi bmi;
502 struct ath10k_wmi wmi; 501 struct ath10k_wmi wmi;
503 struct ath10k_htc htc; 502 struct ath10k_htc htc;
@@ -662,6 +661,7 @@ struct ath10k {
662 661
663struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, 662struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev,
664 enum ath10k_bus bus, 663 enum ath10k_bus bus,
664 enum ath10k_hw_rev hw_rev,
665 const struct ath10k_hif_ops *hif_ops); 665 const struct ath10k_hif_ops *hif_ops);
666void ath10k_core_destroy(struct ath10k *ar); 666void ath10k_core_destroy(struct ath10k *ar);
667 667
diff --git a/drivers/net/wireless/ath/ath10k/hw.c b/drivers/net/wireless/ath/ath10k/hw.c
new file mode 100644
index 000000000000..839a8791fb9e
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/hw.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include <linux/types.h>
18#include "hw.h"
19
20const struct ath10k_hw_regs qca988x_regs = {
21 .rtc_state_cold_reset_mask = 0x00000400,
22 .rtc_soc_base_address = 0x00004000,
23 .rtc_wmac_base_address = 0x00005000,
24 .soc_core_base_address = 0x00009000,
25 .ce_wrapper_base_address = 0x00057000,
26 .ce0_base_address = 0x00057400,
27 .ce1_base_address = 0x00057800,
28 .ce2_base_address = 0x00057c00,
29 .ce3_base_address = 0x00058000,
30 .ce4_base_address = 0x00058400,
31 .ce5_base_address = 0x00058800,
32 .ce6_base_address = 0x00058c00,
33 .ce7_base_address = 0x00059000,
34 .soc_reset_control_si0_rst_mask = 0x00000001,
35 .soc_reset_control_ce_rst_mask = 0x00040000,
36 .soc_chip_id_address = 0x00ec,
37 .scratch_3_address = 0x0030,
38};
39
40const struct ath10k_hw_regs qca6174_regs = {
41 .rtc_state_cold_reset_mask = 0x00002000,
42 .rtc_soc_base_address = 0x00000800,
43 .rtc_wmac_base_address = 0x00001000,
44 .soc_core_base_address = 0x0003a000,
45 .ce_wrapper_base_address = 0x00034000,
46 .ce0_base_address = 0x00034400,
47 .ce1_base_address = 0x00034800,
48 .ce2_base_address = 0x00034c00,
49 .ce3_base_address = 0x00035000,
50 .ce4_base_address = 0x00035400,
51 .ce5_base_address = 0x00035800,
52 .ce6_base_address = 0x00035c00,
53 .ce7_base_address = 0x00036000,
54 .soc_reset_control_si0_rst_mask = 0x00000000,
55 .soc_reset_control_ce_rst_mask = 0x00000001,
56 .soc_chip_id_address = 0x000f0,
57 .scratch_3_address = 0x0028,
58};
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 7b771ae7789f..577127844ec8 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -34,6 +34,43 @@
34#define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin" 34#define QCA988X_HW_2_0_BOARD_DATA_FILE "board.bin"
35#define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234 35#define QCA988X_HW_2_0_PATCH_LOAD_ADDR 0x1234
36 36
37/* QCA6174 target BMI version signatures */
38#define QCA6174_HW_1_0_VERSION 0x05000000
39#define QCA6174_HW_1_1_VERSION 0x05000001
40#define QCA6174_HW_1_3_VERSION 0x05000003
41#define QCA6174_HW_2_1_VERSION 0x05010000
42#define QCA6174_HW_3_0_VERSION 0x05020000
43
44enum qca6174_pci_rev {
45 QCA6174_PCI_REV_1_1 = 0x11,
46 QCA6174_PCI_REV_1_3 = 0x13,
47 QCA6174_PCI_REV_2_0 = 0x20,
48 QCA6174_PCI_REV_3_0 = 0x30,
49};
50
51enum qca6174_chip_id_rev {
52 QCA6174_HW_1_0_CHIP_ID_REV = 0,
53 QCA6174_HW_1_1_CHIP_ID_REV = 1,
54 QCA6174_HW_1_3_CHIP_ID_REV = 2,
55 QCA6174_HW_2_1_CHIP_ID_REV = 4,
56 QCA6174_HW_2_2_CHIP_ID_REV = 5,
57 QCA6174_HW_3_0_CHIP_ID_REV = 8,
58 QCA6174_HW_3_1_CHIP_ID_REV = 9,
59 QCA6174_HW_3_2_CHIP_ID_REV = 10,
60};
61
62#define QCA6174_HW_2_1_FW_DIR "ath10k/QCA6174/hw2.1"
63#define QCA6174_HW_2_1_FW_FILE "firmware.bin"
64#define QCA6174_HW_2_1_OTP_FILE "otp.bin"
65#define QCA6174_HW_2_1_BOARD_DATA_FILE "board.bin"
66#define QCA6174_HW_2_1_PATCH_LOAD_ADDR 0x1234
67
68#define QCA6174_HW_3_0_FW_DIR "ath10k/QCA6174/hw3.0"
69#define QCA6174_HW_3_0_FW_FILE "firmware.bin"
70#define QCA6174_HW_3_0_OTP_FILE "otp.bin"
71#define QCA6174_HW_3_0_BOARD_DATA_FILE "board.bin"
72#define QCA6174_HW_3_0_PATCH_LOAD_ADDR 0x1234
73
37#define ATH10K_FW_API2_FILE "firmware-2.bin" 74#define ATH10K_FW_API2_FILE "firmware-2.bin"
38#define ATH10K_FW_API3_FILE "firmware-3.bin" 75#define ATH10K_FW_API3_FILE "firmware-3.bin"
39 76
@@ -81,6 +118,37 @@ enum ath10k_fw_wmi_op_version {
81 ATH10K_FW_WMI_OP_VERSION_MAX, 118 ATH10K_FW_WMI_OP_VERSION_MAX,
82}; 119};
83 120
121enum ath10k_hw_rev {
122 ATH10K_HW_QCA988X,
123 ATH10K_HW_QCA6174,
124};
125
126struct ath10k_hw_regs {
127 u32 rtc_state_cold_reset_mask;
128 u32 rtc_soc_base_address;
129 u32 rtc_wmac_base_address;
130 u32 soc_core_base_address;
131 u32 ce_wrapper_base_address;
132 u32 ce0_base_address;
133 u32 ce1_base_address;
134 u32 ce2_base_address;
135 u32 ce3_base_address;
136 u32 ce4_base_address;
137 u32 ce5_base_address;
138 u32 ce6_base_address;
139 u32 ce7_base_address;
140 u32 soc_reset_control_si0_rst_mask;
141 u32 soc_reset_control_ce_rst_mask;
142 u32 soc_chip_id_address;
143 u32 scratch_3_address;
144};
145
146extern const struct ath10k_hw_regs qca988x_regs;
147extern const struct ath10k_hw_regs qca6174_regs;
148
149#define QCA_REV_988X(ar) ((ar)->hw_rev == ATH10K_HW_QCA988X)
150#define QCA_REV_6174(ar) ((ar)->hw_rev == ATH10K_HW_QCA6174)
151
84/* Known pecularities: 152/* Known pecularities:
85 * - current FW doesn't support raw rx mode (last tested v599) 153 * - current FW doesn't support raw rx mode (last tested v599)
86 * - current FW dumps upon raw tx mode (last tested v599) 154 * - current FW dumps upon raw tx mode (last tested v599)
@@ -225,7 +293,7 @@ struct ath10k_pktlog_hdr {
225/* as of IP3.7.1 */ 293/* as of IP3.7.1 */
226#define RTC_STATE_V_ON 3 294#define RTC_STATE_V_ON 3
227 295
228#define RTC_STATE_COLD_RESET_MASK 0x00000400 296#define RTC_STATE_COLD_RESET_MASK ar->regs->rtc_state_cold_reset_mask
229#define RTC_STATE_V_LSB 0 297#define RTC_STATE_V_LSB 0
230#define RTC_STATE_V_MASK 0x00000007 298#define RTC_STATE_V_MASK 0x00000007
231#define RTC_STATE_ADDRESS 0x0000 299#define RTC_STATE_ADDRESS 0x0000
@@ -234,12 +302,12 @@ struct ath10k_pktlog_hdr {
234#define PCIE_SOC_WAKE_RESET 0x00000000 302#define PCIE_SOC_WAKE_RESET 0x00000000
235#define SOC_GLOBAL_RESET_ADDRESS 0x0008 303#define SOC_GLOBAL_RESET_ADDRESS 0x0008
236 304
237#define RTC_SOC_BASE_ADDRESS 0x00004000 305#define RTC_SOC_BASE_ADDRESS ar->regs->rtc_soc_base_address
238#define RTC_WMAC_BASE_ADDRESS 0x00005000 306#define RTC_WMAC_BASE_ADDRESS ar->regs->rtc_wmac_base_address
239#define MAC_COEX_BASE_ADDRESS 0x00006000 307#define MAC_COEX_BASE_ADDRESS 0x00006000
240#define BT_COEX_BASE_ADDRESS 0x00007000 308#define BT_COEX_BASE_ADDRESS 0x00007000
241#define SOC_PCIE_BASE_ADDRESS 0x00008000 309#define SOC_PCIE_BASE_ADDRESS 0x00008000
242#define SOC_CORE_BASE_ADDRESS 0x00009000 310#define SOC_CORE_BASE_ADDRESS ar->regs->soc_core_base_address
243#define WLAN_UART_BASE_ADDRESS 0x0000c000 311#define WLAN_UART_BASE_ADDRESS 0x0000c000
244#define WLAN_SI_BASE_ADDRESS 0x00010000 312#define WLAN_SI_BASE_ADDRESS 0x00010000
245#define WLAN_GPIO_BASE_ADDRESS 0x00014000 313#define WLAN_GPIO_BASE_ADDRESS 0x00014000
@@ -248,23 +316,23 @@ struct ath10k_pktlog_hdr {
248#define EFUSE_BASE_ADDRESS 0x00030000 316#define EFUSE_BASE_ADDRESS 0x00030000
249#define FPGA_REG_BASE_ADDRESS 0x00039000 317#define FPGA_REG_BASE_ADDRESS 0x00039000
250#define WLAN_UART2_BASE_ADDRESS 0x00054c00 318#define WLAN_UART2_BASE_ADDRESS 0x00054c00
251#define CE_WRAPPER_BASE_ADDRESS 0x00057000 319#define CE_WRAPPER_BASE_ADDRESS ar->regs->ce_wrapper_base_address
252#define CE0_BASE_ADDRESS 0x00057400 320#define CE0_BASE_ADDRESS ar->regs->ce0_base_address
253#define CE1_BASE_ADDRESS 0x00057800 321#define CE1_BASE_ADDRESS ar->regs->ce1_base_address
254#define CE2_BASE_ADDRESS 0x00057c00 322#define CE2_BASE_ADDRESS ar->regs->ce2_base_address
255#define CE3_BASE_ADDRESS 0x00058000 323#define CE3_BASE_ADDRESS ar->regs->ce3_base_address
256#define CE4_BASE_ADDRESS 0x00058400 324#define CE4_BASE_ADDRESS ar->regs->ce4_base_address
257#define CE5_BASE_ADDRESS 0x00058800 325#define CE5_BASE_ADDRESS ar->regs->ce5_base_address
258#define CE6_BASE_ADDRESS 0x00058c00 326#define CE6_BASE_ADDRESS ar->regs->ce6_base_address
259#define CE7_BASE_ADDRESS 0x00059000 327#define CE7_BASE_ADDRESS ar->regs->ce7_base_address
260#define DBI_BASE_ADDRESS 0x00060000 328#define DBI_BASE_ADDRESS 0x00060000
261#define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000 329#define WLAN_ANALOG_INTF_PCIE_BASE_ADDRESS 0x0006c000
262#define PCIE_LOCAL_BASE_ADDRESS 0x00080000 330#define PCIE_LOCAL_BASE_ADDRESS 0x00080000
263 331
264#define SOC_RESET_CONTROL_ADDRESS 0x00000000 332#define SOC_RESET_CONTROL_ADDRESS 0x00000000
265#define SOC_RESET_CONTROL_OFFSET 0x00000000 333#define SOC_RESET_CONTROL_OFFSET 0x00000000
266#define SOC_RESET_CONTROL_SI0_RST_MASK 0x00000001 334#define SOC_RESET_CONTROL_SI0_RST_MASK ar->regs->soc_reset_control_si0_rst_mask
267#define SOC_RESET_CONTROL_CE_RST_MASK 0x00040000 335#define SOC_RESET_CONTROL_CE_RST_MASK ar->regs->soc_reset_control_ce_rst_mask
268#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040 336#define SOC_RESET_CONTROL_CPU_WARM_RST_MASK 0x00000040
269#define SOC_CPU_CLOCK_OFFSET 0x00000020 337#define SOC_CPU_CLOCK_OFFSET 0x00000020
270#define SOC_CPU_CLOCK_STANDARD_LSB 0 338#define SOC_CPU_CLOCK_STANDARD_LSB 0
@@ -278,7 +346,7 @@ struct ath10k_pktlog_hdr {
278#define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050 346#define SOC_LF_TIMER_CONTROL0_ADDRESS 0x00000050
279#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004 347#define SOC_LF_TIMER_CONTROL0_ENABLE_MASK 0x00000004
280 348
281#define SOC_CHIP_ID_ADDRESS 0x000000ec 349#define SOC_CHIP_ID_ADDRESS ar->regs->soc_chip_id_address
282#define SOC_CHIP_ID_REV_LSB 8 350#define SOC_CHIP_ID_REV_LSB 8
283#define SOC_CHIP_ID_REV_MASK 0x00000f00 351#define SOC_CHIP_ID_REV_MASK 0x00000f00
284 352
@@ -334,7 +402,7 @@ struct ath10k_pktlog_hdr {
334#define PCIE_INTR_ENABLE_ADDRESS 0x0008 402#define PCIE_INTR_ENABLE_ADDRESS 0x0008
335#define PCIE_INTR_CAUSE_ADDRESS 0x000c 403#define PCIE_INTR_CAUSE_ADDRESS 0x000c
336#define PCIE_INTR_CLR_ADDRESS 0x0014 404#define PCIE_INTR_CLR_ADDRESS 0x0014
337#define SCRATCH_3_ADDRESS 0x0030 405#define SCRATCH_3_ADDRESS ar->regs->scratch_3_address
338#define CPU_INTR_ADDRESS 0x0010 406#define CPU_INTR_ADDRESS 0x0010
339 407
340/* Firmware indications to the Host via SCRATCH_3 register. */ 408/* Firmware indications to the Host via SCRATCH_3 register. */
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index e0c9f4633a82..a31746df7acc 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -58,9 +58,11 @@ MODULE_PARM_DESC(reset_mode, "0: auto, 1: warm only (default: 0)");
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) 60#define QCA988X_2_0_DEVICE_ID (0x003c)
61#define QCA6174_2_1_DEVICE_ID (0x003e)
61 62
62static const struct pci_device_id ath10k_pci_id_table[] = { 63static const struct pci_device_id ath10k_pci_id_table[] = {
63 { PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */ 64 { PCI_VDEVICE(ATHEROS, QCA988X_2_0_DEVICE_ID) }, /* PCI-E QCA988X V2 */
65 { PCI_VDEVICE(ATHEROS, QCA6174_2_1_DEVICE_ID) }, /* PCI-E QCA6174 V2.1 */
64 {0} 66 {0}
65}; 67};
66 68
@@ -70,6 +72,11 @@ static const struct ath10k_pci_supp_chip ath10k_pci_supp_chips[] = {
70 * because of that. 72 * because of that.
71 */ 73 */
72 { QCA988X_2_0_DEVICE_ID, QCA988X_HW_2_0_CHIP_ID_REV }, 74 { QCA988X_2_0_DEVICE_ID, QCA988X_HW_2_0_CHIP_ID_REV },
75 { QCA6174_2_1_DEVICE_ID, QCA6174_HW_2_1_CHIP_ID_REV },
76 { QCA6174_2_1_DEVICE_ID, QCA6174_HW_2_2_CHIP_ID_REV },
77 { QCA6174_2_1_DEVICE_ID, QCA6174_HW_3_0_CHIP_ID_REV },
78 { QCA6174_2_1_DEVICE_ID, QCA6174_HW_3_1_CHIP_ID_REV },
79 { QCA6174_2_1_DEVICE_ID, QCA6174_HW_3_2_CHIP_ID_REV },
73}; 80};
74 81
75static void ath10k_pci_buffer_cleanup(struct ath10k *ar); 82static void ath10k_pci_buffer_cleanup(struct ath10k *ar);
@@ -1506,6 +1513,35 @@ static int ath10k_pci_wake_target_cpu(struct ath10k *ar)
1506 return 0; 1513 return 0;
1507} 1514}
1508 1515
1516static int ath10k_pci_get_num_banks(struct ath10k *ar)
1517{
1518 struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1519
1520 switch (ar_pci->pdev->device) {
1521 case QCA988X_2_0_DEVICE_ID:
1522 return 1;
1523 case QCA6174_2_1_DEVICE_ID:
1524 switch (MS(ar->chip_id, SOC_CHIP_ID_REV)) {
1525 case QCA6174_HW_1_0_CHIP_ID_REV:
1526 case QCA6174_HW_1_1_CHIP_ID_REV:
1527 return 3;
1528 case QCA6174_HW_1_3_CHIP_ID_REV:
1529 return 2;
1530 case QCA6174_HW_2_1_CHIP_ID_REV:
1531 case QCA6174_HW_2_2_CHIP_ID_REV:
1532 return 6;
1533 case QCA6174_HW_3_0_CHIP_ID_REV:
1534 case QCA6174_HW_3_1_CHIP_ID_REV:
1535 case QCA6174_HW_3_2_CHIP_ID_REV:
1536 return 9;
1537 }
1538 break;
1539 }
1540
1541 ath10k_warn(ar, "unknown number of banks, assuming 1\n");
1542 return 1;
1543}
1544
1509static int ath10k_pci_init_config(struct ath10k *ar) 1545static int ath10k_pci_init_config(struct ath10k *ar)
1510{ 1546{
1511 u32 interconnect_targ_addr; 1547 u32 interconnect_targ_addr;
@@ -1616,7 +1652,8 @@ static int ath10k_pci_init_config(struct ath10k *ar)
1616 /* first bank is switched to IRAM */ 1652 /* first bank is switched to IRAM */
1617 ealloc_value |= ((HI_EARLY_ALLOC_MAGIC << HI_EARLY_ALLOC_MAGIC_SHIFT) & 1653 ealloc_value |= ((HI_EARLY_ALLOC_MAGIC << HI_EARLY_ALLOC_MAGIC_SHIFT) &
1618 HI_EARLY_ALLOC_MAGIC_MASK); 1654 HI_EARLY_ALLOC_MAGIC_MASK);
1619 ealloc_value |= ((1 << HI_EARLY_ALLOC_IRAM_BANKS_SHIFT) & 1655 ealloc_value |= ((ath10k_pci_get_num_banks(ar) <<
1656 HI_EARLY_ALLOC_IRAM_BANKS_SHIFT) &
1620 HI_EARLY_ALLOC_IRAM_BANKS_MASK); 1657 HI_EARLY_ALLOC_IRAM_BANKS_MASK);
1621 1658
1622 ret = ath10k_pci_diag_write32(ar, ealloc_targ_addr, ealloc_value); 1659 ret = ath10k_pci_diag_write32(ar, ealloc_targ_addr, ealloc_value);
@@ -1812,12 +1849,12 @@ static int ath10k_pci_warm_reset(struct ath10k *ar)
1812 return 0; 1849 return 0;
1813} 1850}
1814 1851
1815static int ath10k_pci_chip_reset(struct ath10k *ar) 1852static int ath10k_pci_qca988x_chip_reset(struct ath10k *ar)
1816{ 1853{
1817 int i, ret; 1854 int i, ret;
1818 u32 val; 1855 u32 val;
1819 1856
1820 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip reset\n"); 1857 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot 988x chip reset\n");
1821 1858
1822 /* Some hardware revisions (e.g. CUS223v2) has issues with cold reset. 1859 /* Some hardware revisions (e.g. CUS223v2) has issues with cold reset.
1823 * It is thus preferred to use warm reset which is safer but may not be 1860 * It is thus preferred to use warm reset which is safer but may not be
@@ -1881,11 +1918,53 @@ static int ath10k_pci_chip_reset(struct ath10k *ar)
1881 return ret; 1918 return ret;
1882 } 1919 }
1883 1920
1884 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot chip reset complete (cold)\n"); 1921 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot qca988x chip reset complete (cold)\n");
1922
1923 return 0;
1924}
1925
1926static int ath10k_pci_qca6174_chip_reset(struct ath10k *ar)
1927{
1928 int ret;
1929
1930 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot qca6174 chip reset\n");
1931
1932 /* FIXME: QCA6174 requires cold + warm reset to work. */
1933
1934 ret = ath10k_pci_cold_reset(ar);
1935 if (ret) {
1936 ath10k_warn(ar, "failed to cold reset: %d\n", ret);
1937 return ret;
1938 }
1939
1940 ret = ath10k_pci_wait_for_target_init(ar);
1941 if (ret) {
1942 ath10k_warn(ar, "failed to wait for target after cold reset: %d\n",
1943 ret);
1944 return ret;
1945 }
1946
1947 ret = ath10k_pci_warm_reset(ar);
1948 if (ret) {
1949 ath10k_warn(ar, "failed to warm reset: %d\n", ret);
1950 return ret;
1951 }
1952
1953 ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot qca6174 chip reset complete (cold)\n");
1885 1954
1886 return 0; 1955 return 0;
1887} 1956}
1888 1957
1958static int ath10k_pci_chip_reset(struct ath10k *ar)
1959{
1960 if (QCA_REV_988X(ar))
1961 return ath10k_pci_qca988x_chip_reset(ar);
1962 else if (QCA_REV_6174(ar))
1963 return ath10k_pci_qca6174_chip_reset(ar);
1964 else
1965 return -ENOTSUPP;
1966}
1967
1889static int ath10k_pci_hif_power_up(struct ath10k *ar) 1968static int ath10k_pci_hif_power_up(struct ath10k *ar)
1890{ 1969{
1891 int ret; 1970 int ret;
@@ -2511,11 +2590,23 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
2511 int ret = 0; 2590 int ret = 0;
2512 struct ath10k *ar; 2591 struct ath10k *ar;
2513 struct ath10k_pci *ar_pci; 2592 struct ath10k_pci *ar_pci;
2593 enum ath10k_hw_rev hw_rev;
2514 u32 chip_id; 2594 u32 chip_id;
2515 2595
2516 ar = ath10k_core_create(sizeof(*ar_pci), &pdev->dev, 2596 switch (pci_dev->device) {
2517 ATH10K_BUS_PCI, 2597 case QCA988X_2_0_DEVICE_ID:
2518 &ath10k_pci_hif_ops); 2598 hw_rev = ATH10K_HW_QCA988X;
2599 break;
2600 case QCA6174_2_1_DEVICE_ID:
2601 hw_rev = ATH10K_HW_QCA6174;
2602 break;
2603 default:
2604 WARN_ON(1);
2605 return -ENOTSUPP;
2606 }
2607
2608 ar = ath10k_core_create(sizeof(*ar_pci), &pdev->dev, ATH10K_BUS_PCI,
2609 hw_rev, &ath10k_pci_hif_ops);
2519 if (!ar) { 2610 if (!ar) {
2520 dev_err(&pdev->dev, "failed to allocate core\n"); 2611 dev_err(&pdev->dev, "failed to allocate core\n");
2521 return -ENOMEM; 2612 return -ENOMEM;
diff --git a/drivers/net/wireless/ath/ath10k/targaddrs.h b/drivers/net/wireless/ath/ath10k/targaddrs.h
index 9d0ae30f9ff1..a417aae52623 100644
--- a/drivers/net/wireless/ath/ath10k/targaddrs.h
+++ b/drivers/net/wireless/ath/ath10k/targaddrs.h
@@ -18,6 +18,8 @@
18#ifndef __TARGADDRS_H__ 18#ifndef __TARGADDRS_H__
19#define __TARGADDRS_H__ 19#define __TARGADDRS_H__
20 20
21#include "hw.h"
22
21/* 23/*
22 * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the 24 * xxx_HOST_INTEREST_ADDRESS is the address in Target RAM of the
23 * host_interest structure. It must match the address of the _host_interest 25 * host_interest structure. It must match the address of the _host_interest
@@ -445,4 +447,7 @@ Fw Mode/SubMode Mask
445#define QCA988X_BOARD_DATA_SZ 7168 447#define QCA988X_BOARD_DATA_SZ 7168
446#define QCA988X_BOARD_EXT_DATA_SZ 0 448#define QCA988X_BOARD_EXT_DATA_SZ 0
447 449
450#define QCA6174_BOARD_DATA_SZ 8192
451#define QCA6174_BOARD_EXT_DATA_SZ 0
452
448#endif /* __TARGADDRS_H__ */ 453#endif /* __TARGADDRS_H__ */