9a16349b2892dee79a589f1bce38de985ca6701d
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath11k / 0020-wifi-ath11k-update-ce-configurations-for-IPQ5018.patch
1 From 26af7aabd2d8225c6b2056234626ba5099610871 Mon Sep 17 00:00:00 2001
2 From: Sriram R <quic_srirrama@quicinc.com>
3 Date: Fri, 2 Dec 2022 23:37:14 +0200
4 Subject: [PATCH] wifi: ath11k: update ce configurations for IPQ5018
5
6 IPQ5018 is a single pdev device. Update host
7 and target CE configurations accordingly.
8
9 Tested-on: IPQ5018 hw1.0 AHB WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
10
11 Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
12 Co-developed-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
13 Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
14 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
15 Link: https://lore.kernel.org/r/20221122132152.17771-4-quic_kathirve@quicinc.com
16 ---
17 drivers/net/wireless/ath/ath11k/core.c | 4 +
18 drivers/net/wireless/ath/ath11k/core.h | 3 +
19 drivers/net/wireless/ath/ath11k/hw.c | 191 +++++++++++++++++++++++++
20 3 files changed, 198 insertions(+)
21
22 --- a/drivers/net/wireless/ath/ath11k/core.c
23 +++ b/drivers/net/wireless/ath/ath11k/core.c
24 @@ -630,6 +630,10 @@ static const struct ath11k_hw_params ath
25 .internal_sleep_clock = false,
26 .host_ce_config = ath11k_host_ce_config_qcn9074,
27 .ce_count = CE_CNT_5018,
28 + .target_ce_config = ath11k_target_ce_config_wlan_ipq5018,
29 + .target_ce_count = TARGET_CE_CNT_5018,
30 + .svc_to_ce_map = ath11k_target_service_to_ce_map_wlan_ipq5018,
31 + .svc_to_ce_map_len = SVC_CE_MAP_LEN_5018,
32 .rxdma1_enable = true,
33 .num_rxmda_per_pdev = RXDMA_PER_PDEV_5018,
34 .rx_mac_buf_ring = false,
35 --- a/drivers/net/wireless/ath/ath11k/core.h
36 +++ b/drivers/net/wireless/ath/ath11k/core.h
37 @@ -1146,6 +1146,9 @@ extern const struct service_to_pipe ath1
38 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qca6390[];
39 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qca6390[];
40
41 +extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[];
42 +extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[];
43 +
44 extern const struct ce_pipe_config ath11k_target_ce_config_wlan_qcn9074[];
45 extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_qcn9074[];
46 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab);
47 --- a/drivers/net/wireless/ath/ath11k/hw.c
48 +++ b/drivers/net/wireless/ath/ath11k/hw.c
49 @@ -1972,6 +1972,197 @@ const struct ath11k_hw_ring_mask ath11k_
50 },
51 };
52
53 +/* Target firmware's Copy Engine configuration for IPQ5018 */
54 +const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq5018[] = {
55 + /* CE0: host->target HTC control and raw streams */
56 + {
57 + .pipenum = __cpu_to_le32(0),
58 + .pipedir = __cpu_to_le32(PIPEDIR_OUT),
59 + .nentries = __cpu_to_le32(32),
60 + .nbytes_max = __cpu_to_le32(2048),
61 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
62 + .reserved = __cpu_to_le32(0),
63 + },
64 +
65 + /* CE1: target->host HTT + HTC control */
66 + {
67 + .pipenum = __cpu_to_le32(1),
68 + .pipedir = __cpu_to_le32(PIPEDIR_IN),
69 + .nentries = __cpu_to_le32(32),
70 + .nbytes_max = __cpu_to_le32(2048),
71 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
72 + .reserved = __cpu_to_le32(0),
73 + },
74 +
75 + /* CE2: target->host WMI */
76 + {
77 + .pipenum = __cpu_to_le32(2),
78 + .pipedir = __cpu_to_le32(PIPEDIR_IN),
79 + .nentries = __cpu_to_le32(32),
80 + .nbytes_max = __cpu_to_le32(2048),
81 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
82 + .reserved = __cpu_to_le32(0),
83 + },
84 +
85 + /* CE3: host->target WMI */
86 + {
87 + .pipenum = __cpu_to_le32(3),
88 + .pipedir = __cpu_to_le32(PIPEDIR_OUT),
89 + .nentries = __cpu_to_le32(32),
90 + .nbytes_max = __cpu_to_le32(2048),
91 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
92 + .reserved = __cpu_to_le32(0),
93 + },
94 +
95 + /* CE4: host->target HTT */
96 + {
97 + .pipenum = __cpu_to_le32(4),
98 + .pipedir = __cpu_to_le32(PIPEDIR_OUT),
99 + .nentries = __cpu_to_le32(256),
100 + .nbytes_max = __cpu_to_le32(256),
101 + .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
102 + .reserved = __cpu_to_le32(0),
103 + },
104 +
105 + /* CE5: target->host Pktlog */
106 + {
107 + .pipenum = __cpu_to_le32(5),
108 + .pipedir = __cpu_to_le32(PIPEDIR_IN),
109 + .nentries = __cpu_to_le32(32),
110 + .nbytes_max = __cpu_to_le32(2048),
111 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
112 + .reserved = __cpu_to_le32(0),
113 + },
114 +
115 + /* CE6: Reserved for target autonomous hif_memcpy */
116 + {
117 + .pipenum = __cpu_to_le32(6),
118 + .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
119 + .nentries = __cpu_to_le32(32),
120 + .nbytes_max = __cpu_to_le32(16384),
121 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
122 + .reserved = __cpu_to_le32(0),
123 + },
124 +
125 + /* CE7 used only by Host */
126 + {
127 + .pipenum = __cpu_to_le32(7),
128 + .pipedir = __cpu_to_le32(PIPEDIR_OUT),
129 + .nentries = __cpu_to_le32(32),
130 + .nbytes_max = __cpu_to_le32(2048),
131 + .flags = __cpu_to_le32(0x2000),
132 + .reserved = __cpu_to_le32(0),
133 + },
134 +
135 + /* CE8 target->host used only by IPA */
136 + {
137 + .pipenum = __cpu_to_le32(8),
138 + .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
139 + .nentries = __cpu_to_le32(32),
140 + .nbytes_max = __cpu_to_le32(16384),
141 + .flags = __cpu_to_le32(CE_ATTR_FLAGS),
142 + .reserved = __cpu_to_le32(0),
143 + },
144 +};
145 +
146 +/* Map from service/endpoint to Copy Engine for IPQ5018.
147 + * This table is derived from the CE TABLE, above.
148 + * It is passed to the Target at startup for use by firmware.
149 + */
150 +const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq5018[] = {
151 + {
152 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
153 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
154 + .pipenum = __cpu_to_le32(3),
155 + },
156 + {
157 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VO),
158 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
159 + .pipenum = __cpu_to_le32(2),
160 + },
161 + {
162 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
163 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
164 + .pipenum = __cpu_to_le32(3),
165 + },
166 + {
167 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BK),
168 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
169 + .pipenum = __cpu_to_le32(2),
170 + },
171 + {
172 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
173 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
174 + .pipenum = __cpu_to_le32(3),
175 + },
176 + {
177 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_BE),
178 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
179 + .pipenum = __cpu_to_le32(2),
180 + },
181 + {
182 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
183 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
184 + .pipenum = __cpu_to_le32(3),
185 + },
186 + {
187 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_DATA_VI),
188 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
189 + .pipenum = __cpu_to_le32(2),
190 + },
191 + {
192 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
193 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
194 + .pipenum = __cpu_to_le32(3),
195 + },
196 + {
197 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_WMI_CONTROL),
198 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
199 + .pipenum = __cpu_to_le32(2),
200 + },
201 +
202 + {
203 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
204 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
205 + .pipenum = __cpu_to_le32(0),
206 + },
207 + {
208 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_RSVD_CTRL),
209 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
210 + .pipenum = __cpu_to_le32(1),
211 + },
212 +
213 + {
214 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
215 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
216 + .pipenum = __cpu_to_le32(0),
217 + },
218 + {
219 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_TEST_RAW_STREAMS),
220 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
221 + .pipenum = __cpu_to_le32(1),
222 + },
223 + {
224 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
225 + .pipedir = __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
226 + .pipenum = __cpu_to_le32(4),
227 + },
228 + {
229 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_HTT_DATA_MSG),
230 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
231 + .pipenum = __cpu_to_le32(1),
232 + },
233 + {
234 + .service_id = __cpu_to_le32(ATH11K_HTC_SVC_ID_PKT_LOG),
235 + .pipedir = __cpu_to_le32(PIPEDIR_IN), /* in = DL = target -> host */
236 + .pipenum = __cpu_to_le32(5),
237 + },
238 +
239 + /* (Additions here) */
240 +
241 + { /* terminator entry */ }
242 +};
243 +
244 const struct ath11k_hw_regs ipq8074_regs = {
245 /* SW2TCL(x) R0 ring configuration address */
246 .hal_tcl1_ring_base_lsb = 0x00000510,