Debian Codegraph @

drivers/net/wireless/ath/ath12k/wifi7/ce.c

raw
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
2 /*
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5 */
6
7 #include <linux/types.h>
8 #include <linux/bitops.h>
9 #include <linux/bitfield.h>
10
11 #include "../core.h"
12 #include "../ce.h"
13 #include "ce.h"
14 #include "../dp_rx.h"
15
16 /* Copy Engine (CE) configs for QCN9274 */
17 /* Target firmware's Copy Engine configuration. */
18 const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_qcn9274[] = {
19 /* CE0: host->target HTC control and raw streams */
20 {
21 .pipenum = __cpu_to_le32(0),
22 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
23 .nentries = __cpu_to_le32(32),
24 .nbytes_max = __cpu_to_le32(2048),
25 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
26 .reserved = __cpu_to_le32(0),
27 },
28
29 /* CE1: target->host HTT + HTC control */
30 {
31 .pipenum = __cpu_to_le32(1),
32 .pipedir = __cpu_to_le32(PIPEDIR_IN),
33 .nentries = __cpu_to_le32(32),
34 .nbytes_max = __cpu_to_le32(2048),
35 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
36 .reserved = __cpu_to_le32(0),
37 },
38
39 /* CE2: target->host WMI */
40 {
41 .pipenum = __cpu_to_le32(2),
42 .pipedir = __cpu_to_le32(PIPEDIR_IN),
43 .nentries = __cpu_to_le32(32),
44 .nbytes_max = __cpu_to_le32(2048),
45 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
46 .reserved = __cpu_to_le32(0),
47 },
48
49 /* CE3: host->target WMI (mac0) */
50 {
51 .pipenum = __cpu_to_le32(3),
52 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
53 .nentries = __cpu_to_le32(32),
54 .nbytes_max = __cpu_to_le32(2048),
55 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
56 .reserved = __cpu_to_le32(0),
57 },
58
59 /* CE4: host->target HTT */
60 {
61 .pipenum = __cpu_to_le32(4),
62 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
63 .nentries = __cpu_to_le32(256),
64 .nbytes_max = __cpu_to_le32(256),
65 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
66 .reserved = __cpu_to_le32(0),
67 },
68
69 /* CE5: target->host Pktlog */
70 {
71 .pipenum = __cpu_to_le32(5),
72 .pipedir = __cpu_to_le32(PIPEDIR_IN),
73 .nentries = __cpu_to_le32(32),
74 .nbytes_max = __cpu_to_le32(2048),
75 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
76 .reserved = __cpu_to_le32(0),
77 },
78
79 /* CE6: Reserved for target autonomous hif_memcpy */
80 {
81 .pipenum = __cpu_to_le32(6),
82 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
83 .nentries = __cpu_to_le32(32),
84 .nbytes_max = __cpu_to_le32(16384),
85 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
86 .reserved = __cpu_to_le32(0),
87 },
88
89 /* CE7: host->target WMI (mac1) */
90 {
91 .pipenum = __cpu_to_le32(7),
92 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
93 .nentries = __cpu_to_le32(32),
94 .nbytes_max = __cpu_to_le32(2048),
95 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
96 .reserved = __cpu_to_le32(0),
97 },
98
99 /* CE8: Reserved for target autonomous hif_memcpy */
100 {
101 .pipenum = __cpu_to_le32(8),
102 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
103 .nentries = __cpu_to_le32(32),
104 .nbytes_max = __cpu_to_le32(16384),
105 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
106 .reserved = __cpu_to_le32(0),
107 },
108
109 /* CE9, 10 and 11: Reserved for MHI */
110
111 /* CE12: Target CV prefetch */
112 {
113 .pipenum = __cpu_to_le32(12),
114 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
115 .nentries = __cpu_to_le32(32),
116 .nbytes_max = __cpu_to_le32(2048),
117 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
118 .reserved = __cpu_to_le32(0),
119 },
120
121 /* CE13: Target CV prefetch */
122 {
123 .pipenum = __cpu_to_le32(13),
124 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
125 .nentries = __cpu_to_le32(32),
126 .nbytes_max = __cpu_to_le32(2048),
127 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
128 .reserved = __cpu_to_le32(0),
129 },
130
131 /* CE14: WMI logging/CFR/Spectral/Radar */
132 {
133 .pipenum = __cpu_to_le32(14),
134 .pipedir = __cpu_to_le32(PIPEDIR_IN),
135 .nentries = __cpu_to_le32(32),
136 .nbytes_max = __cpu_to_le32(2048),
137 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
138 .reserved = __cpu_to_le32(0),
139 },
140
141 /* CE15: Reserved */
142 };
143
144 /* Map from service/endpoint to Copy Engine.
145 * This table is derived from the CE_PCI TABLE, above.
146 * It is passed to the Target at startup for use by firmware.
147 * Pipe direction:
148 * PIPEDIR_OUT = UL = host -> target
149 * PIPEDIR_IN = DL = target -> host
150 */
151 const struct service_to_pipe
152 ath12k_wifi7_target_service_to_ce_map_wlan_qcn9274[] = {
153 {
154 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
155 __cpu_to_le32(PIPEDIR_OUT),
156 __cpu_to_le32(3),
157 },
158 {
159 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
160 __cpu_to_le32(PIPEDIR_IN),
161 __cpu_to_le32(2),
162 },
163 {
164 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
165 __cpu_to_le32(PIPEDIR_OUT),
166 __cpu_to_le32(3),
167 },
168 {
169 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
170 __cpu_to_le32(PIPEDIR_IN),
171 __cpu_to_le32(2),
172 },
173 {
174 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
175 __cpu_to_le32(PIPEDIR_OUT),
176 __cpu_to_le32(3),
177 },
178 {
179 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
180 __cpu_to_le32(PIPEDIR_IN),
181 __cpu_to_le32(2),
182 },
183 {
184 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
185 __cpu_to_le32(PIPEDIR_OUT),
186 __cpu_to_le32(3),
187 },
188 {
189 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
190 __cpu_to_le32(PIPEDIR_IN),
191 __cpu_to_le32(2),
192 },
193 {
194 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
195 __cpu_to_le32(PIPEDIR_OUT),
196 __cpu_to_le32(3),
197 },
198 {
199 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
200 __cpu_to_le32(PIPEDIR_IN),
201 __cpu_to_le32(2),
202 },
203 {
204 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
205 __cpu_to_le32(PIPEDIR_OUT),
206 __cpu_to_le32(0),
207 },
208 {
209 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
210 __cpu_to_le32(PIPEDIR_IN),
211 __cpu_to_le32(1),
212 },
213 {
214 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
215 __cpu_to_le32(PIPEDIR_OUT),
216 __cpu_to_le32(0),
217 },
218 {
219 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
220 __cpu_to_le32(PIPEDIR_IN),
221 __cpu_to_le32(1),
222 },
223 {
224 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
225 __cpu_to_le32(PIPEDIR_OUT),
226 __cpu_to_le32(4),
227 },
228 {
229 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
230 __cpu_to_le32(PIPEDIR_IN),
231 __cpu_to_le32(1),
232 },
233 {
234 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
235 __cpu_to_le32(PIPEDIR_OUT),
236 __cpu_to_le32(7),
237 },
238 {
239 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_MAC1),
240 __cpu_to_le32(PIPEDIR_IN),
241 __cpu_to_le32(2),
242 },
243 {
244 __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
245 __cpu_to_le32(PIPEDIR_IN),
246 __cpu_to_le32(5),
247 },
248 {
249 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
250 __cpu_to_le32(PIPEDIR_IN),
251 __cpu_to_le32(14),
252 },
253
254 /* (Additions here) */
255
256 { /* must be last */
257 __cpu_to_le32(0),
258 __cpu_to_le32(0),
259 __cpu_to_le32(0),
260 },
261 };
262
263 const struct ce_attr ath12k_wifi7_host_ce_config_qcn9274[] = {
264 /* CE0: host->target HTC control and raw streams */
265 {
266 .flags = CE_ATTR_FLAGS,
267 .src_nentries = 16,
268 .src_sz_max = 2048,
269 .dest_nentries = 0,
270 },
271
272 /* CE1: target->host HTT + HTC control */
273 {
274 .flags = CE_ATTR_FLAGS,
275 .src_nentries = 0,
276 .src_sz_max = 2048,
277 .dest_nentries = 512,
278 .recv_cb = ath12k_htc_rx_completion_handler,
279 },
280
281 /* CE2: target->host WMI */
282 {
283 .flags = CE_ATTR_FLAGS,
284 .src_nentries = 0,
285 .src_sz_max = 2048,
286 .dest_nentries = 128,
287 .recv_cb = ath12k_htc_rx_completion_handler,
288 },
289
290 /* CE3: host->target WMI (mac0) */
291 {
292 .flags = CE_ATTR_FLAGS,
293 .src_nentries = 32,
294 .src_sz_max = 2048,
295 .dest_nentries = 0,
296 },
297
298 /* CE4: host->target HTT */
299 {
300 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
301 .src_nentries = 2048,
302 .src_sz_max = 256,
303 .dest_nentries = 0,
304 },
305
306 /* CE5: target->host pktlog */
307 {
308 .flags = CE_ATTR_FLAGS,
309 .src_nentries = 0,
310 .src_sz_max = 2048,
311 .dest_nentries = 512,
312 .recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
313 },
314
315 /* CE6: target autonomous hif_memcpy */
316 {
317 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
318 .src_nentries = 0,
319 .src_sz_max = 0,
320 .dest_nentries = 0,
321 },
322
323 /* CE7: host->target WMI (mac1) */
324 {
325 .flags = CE_ATTR_FLAGS,
326 .src_nentries = 32,
327 .src_sz_max = 2048,
328 .dest_nentries = 0,
329 },
330
331 /* CE8: target autonomous hif_memcpy */
332 {
333 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
334 .src_nentries = 0,
335 .src_sz_max = 0,
336 .dest_nentries = 0,
337 },
338
339 /* CE9: MHI */
340 {
341 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
342 .src_nentries = 0,
343 .src_sz_max = 0,
344 .dest_nentries = 0,
345 },
346
347 /* CE10: MHI */
348 {
349 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
350 .src_nentries = 0,
351 .src_sz_max = 0,
352 .dest_nentries = 0,
353 },
354
355 /* CE11: MHI */
356 {
357 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
358 .src_nentries = 0,
359 .src_sz_max = 0,
360 .dest_nentries = 0,
361 },
362
363 /* CE12: CV Prefetch */
364 {
365 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
366 .src_nentries = 0,
367 .src_sz_max = 0,
368 .dest_nentries = 0,
369 },
370
371 /* CE13: CV Prefetch */
372 {
373 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
374 .src_nentries = 0,
375 .src_sz_max = 0,
376 .dest_nentries = 0,
377 },
378
379 /* CE14: target->host dbg log */
380 {
381 .flags = CE_ATTR_FLAGS,
382 .src_nentries = 0,
383 .src_sz_max = 2048,
384 .dest_nentries = 512,
385 .recv_cb = ath12k_htc_rx_completion_handler,
386 },
387
388 /* CE15: reserved for future use */
389 {
390 .flags = (CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
391 .src_nentries = 0,
392 .src_sz_max = 0,
393 .dest_nentries = 0,
394 },
395 };
396
397 /* Copy Engine (CE) configs for WCN7850 */
398 /* Target firmware's Copy Engine configuration. */
399 const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_wcn7850[] = {
400 /* CE0: host->target HTC control and raw streams */
401 {
402 .pipenum = __cpu_to_le32(0),
403 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
404 .nentries = __cpu_to_le32(32),
405 .nbytes_max = __cpu_to_le32(2048),
406 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
407 .reserved = __cpu_to_le32(0),
408 },
409
410 /* CE1: target->host HTT + HTC control */
411 {
412 .pipenum = __cpu_to_le32(1),
413 .pipedir = __cpu_to_le32(PIPEDIR_IN),
414 .nentries = __cpu_to_le32(32),
415 .nbytes_max = __cpu_to_le32(2048),
416 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
417 .reserved = __cpu_to_le32(0),
418 },
419
420 /* CE2: target->host WMI */
421 {
422 .pipenum = __cpu_to_le32(2),
423 .pipedir = __cpu_to_le32(PIPEDIR_IN),
424 .nentries = __cpu_to_le32(32),
425 .nbytes_max = __cpu_to_le32(2048),
426 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
427 .reserved = __cpu_to_le32(0),
428 },
429
430 /* CE3: host->target WMI */
431 {
432 .pipenum = __cpu_to_le32(3),
433 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
434 .nentries = __cpu_to_le32(32),
435 .nbytes_max = __cpu_to_le32(2048),
436 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
437 .reserved = __cpu_to_le32(0),
438 },
439
440 /* CE4: host->target HTT */
441 {
442 .pipenum = __cpu_to_le32(4),
443 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
444 .nentries = __cpu_to_le32(256),
445 .nbytes_max = __cpu_to_le32(256),
446 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
447 .reserved = __cpu_to_le32(0),
448 },
449
450 /* CE5: target->host Pktlog */
451 {
452 .pipenum = __cpu_to_le32(5),
453 .pipedir = __cpu_to_le32(PIPEDIR_IN),
454 .nentries = __cpu_to_le32(32),
455 .nbytes_max = __cpu_to_le32(2048),
456 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
457 .reserved = __cpu_to_le32(0),
458 },
459
460 /* CE6: Reserved for target autonomous hif_memcpy */
461 {
462 .pipenum = __cpu_to_le32(6),
463 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
464 .nentries = __cpu_to_le32(32),
465 .nbytes_max = __cpu_to_le32(16384),
466 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
467 .reserved = __cpu_to_le32(0),
468 },
469
470 /* CE7 used only by Host */
471 {
472 .pipenum = __cpu_to_le32(7),
473 .pipedir = __cpu_to_le32(PIPEDIR_INOUT_H2H),
474 .nentries = __cpu_to_le32(0),
475 .nbytes_max = __cpu_to_le32(0),
476 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
477 .reserved = __cpu_to_le32(0),
478 },
479
480 /* CE8 target->host used only by IPA */
481 {
482 .pipenum = __cpu_to_le32(8),
483 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
484 .nentries = __cpu_to_le32(32),
485 .nbytes_max = __cpu_to_le32(16384),
486 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
487 .reserved = __cpu_to_le32(0),
488 },
489 /* CE 9, 10, 11 are used by MHI driver */
490 };
491
492 const struct service_to_pipe
493 ath12k_wifi7_target_service_to_ce_map_wlan_wcn7850[] = {
494 {
495 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
496 __cpu_to_le32(PIPEDIR_OUT),
497 __cpu_to_le32(3),
498 },
499 {
500 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
501 __cpu_to_le32(PIPEDIR_IN),
502 __cpu_to_le32(2),
503 },
504 {
505 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
506 __cpu_to_le32(PIPEDIR_OUT),
507 __cpu_to_le32(3),
508 },
509 {
510 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
511 __cpu_to_le32(PIPEDIR_IN),
512 __cpu_to_le32(2),
513 },
514 {
515 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
516 __cpu_to_le32(PIPEDIR_OUT),
517 __cpu_to_le32(3),
518 },
519 {
520 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
521 __cpu_to_le32(PIPEDIR_IN),
522 __cpu_to_le32(2),
523 },
524 {
525 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
526 __cpu_to_le32(PIPEDIR_OUT),
527 __cpu_to_le32(3),
528 },
529 {
530 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
531 __cpu_to_le32(PIPEDIR_IN),
532 __cpu_to_le32(2),
533 },
534 {
535 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
536 __cpu_to_le32(PIPEDIR_OUT),
537 __cpu_to_le32(3),
538 },
539 {
540 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
541 __cpu_to_le32(PIPEDIR_IN),
542 __cpu_to_le32(2),
543 },
544 {
545 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
546 __cpu_to_le32(PIPEDIR_OUT),
547 __cpu_to_le32(0),
548 },
549 {
550 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
551 __cpu_to_le32(PIPEDIR_IN),
552 __cpu_to_le32(2),
553 },
554 {
555 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
556 __cpu_to_le32(PIPEDIR_OUT),
557 __cpu_to_le32(4),
558 },
559 {
560 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
561 __cpu_to_le32(PIPEDIR_IN),
562 __cpu_to_le32(1),
563 },
564
565 /* (Additions here) */
566
567 { /* must be last */
568 __cpu_to_le32(0),
569 __cpu_to_le32(0),
570 __cpu_to_le32(0),
571 },
572 };
573
574 const struct ce_attr ath12k_wifi7_host_ce_config_wcn7850[] = {
575 /* CE0: host->target HTC control and raw streams */
576 {
577 .flags = CE_ATTR_FLAGS,
578 .src_nentries = 16,
579 .src_sz_max = 2048,
580 .dest_nentries = 0,
581 },
582
583 /* CE1: target->host HTT + HTC control */
584 {
585 .flags = CE_ATTR_FLAGS,
586 .src_nentries = 0,
587 .src_sz_max = 2048,
588 .dest_nentries = 512,
589 .recv_cb = ath12k_htc_rx_completion_handler,
590 },
591
592 /* CE2: target->host WMI */
593 {
594 .flags = CE_ATTR_FLAGS,
595 .src_nentries = 0,
596 .src_sz_max = 2048,
597 .dest_nentries = 64,
598 .recv_cb = ath12k_htc_rx_completion_handler,
599 },
600
601 /* CE3: host->target WMI (mac0) */
602 {
603 .flags = CE_ATTR_FLAGS,
604 .src_nentries = 32,
605 .src_sz_max = 2048,
606 .dest_nentries = 0,
607 },
608
609 /* CE4: host->target HTT */
610 {
611 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
612 .src_nentries = 2048,
613 .src_sz_max = 256,
614 .dest_nentries = 0,
615 },
616
617 /* CE5: target->host pktlog */
618 {
619 .flags = CE_ATTR_FLAGS,
620 .src_nentries = 0,
621 .src_sz_max = 0,
622 .dest_nentries = 0,
623 },
624
625 /* CE6: target autonomous hif_memcpy */
626 {
627 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
628 .src_nentries = 0,
629 .src_sz_max = 0,
630 .dest_nentries = 0,
631 },
632
633 /* CE7: host->target WMI (mac1) */
634 {
635 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
636 .src_nentries = 0,
637 .src_sz_max = 2048,
638 .dest_nentries = 0,
639 },
640
641 /* CE8: target autonomous hif_memcpy */
642 {
643 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
644 .src_nentries = 0,
645 .src_sz_max = 0,
646 .dest_nentries = 0,
647 },
648 };
649
650 /* Copy Engine (CE) configs for IPQ5332 */
651 /* Target firmware's Copy Engine configuration. */
652 const struct ce_pipe_config ath12k_wifi7_target_ce_config_wlan_ipq5332[] = {
653 /* CE0: host->target HTC control and raw streams */
654 {
655 .pipenum = __cpu_to_le32(0),
656 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
657 .nentries = __cpu_to_le32(32),
658 .nbytes_max = __cpu_to_le32(2048),
659 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
660 .reserved = __cpu_to_le32(0),
661 },
662
663 /* CE1: target->host HTT */
664 {
665 .pipenum = __cpu_to_le32(1),
666 .pipedir = __cpu_to_le32(PIPEDIR_IN),
667 .nentries = __cpu_to_le32(32),
668 .nbytes_max = __cpu_to_le32(2048),
669 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
670 .reserved = __cpu_to_le32(0),
671 },
672
673 /* CE2: target->host WMI + HTC control */
674 {
675 .pipenum = __cpu_to_le32(2),
676 .pipedir = __cpu_to_le32(PIPEDIR_IN),
677 .nentries = __cpu_to_le32(32),
678 .nbytes_max = __cpu_to_le32(2048),
679 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
680 .reserved = __cpu_to_le32(0),
681 },
682
683 /* CE3: host->target WMI */
684 {
685 .pipenum = __cpu_to_le32(3),
686 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
687 .nentries = __cpu_to_le32(32),
688 .nbytes_max = __cpu_to_le32(2048),
689 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
690 .reserved = __cpu_to_le32(0),
691 },
692
693 /* CE4: host->target HTT */
694 {
695 .pipenum = __cpu_to_le32(4),
696 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
697 .nentries = __cpu_to_le32(256),
698 .nbytes_max = __cpu_to_le32(256),
699 .flags = __cpu_to_le32(CE_ATTR_FLAGS | CE_ATTR_DIS_INTR),
700 .reserved = __cpu_to_le32(0),
701 },
702
703 /* CE5: Target -> host PKTLOG */
704 {
705 .pipenum = __cpu_to_le32(5),
706 .pipedir = __cpu_to_le32(PIPEDIR_IN),
707 .nentries = __cpu_to_le32(32),
708 .nbytes_max = __cpu_to_le32(2048),
709 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
710 .reserved = __cpu_to_le32(0),
711 },
712
713 /* CE6: Reserved for target autonomous HIF_memcpy */
714 {
715 .pipenum = __cpu_to_le32(6),
716 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
717 .nentries = __cpu_to_le32(32),
718 .nbytes_max = __cpu_to_le32(16384),
719 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
720 .reserved = __cpu_to_le32(0),
721 },
722
723 /* CE7: Reserved for CV Prefetch */
724 {
725 .pipenum = __cpu_to_le32(7),
726 .pipedir = __cpu_to_le32(PIPEDIR_OUT),
727 .nentries = __cpu_to_le32(32),
728 .nbytes_max = __cpu_to_le32(2048),
729 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
730 .reserved = __cpu_to_le32(0),
731 },
732
733 /* CE8: Reserved for target generic HIF memcpy */
734 {
735 .pipenum = __cpu_to_le32(8),
736 .pipedir = __cpu_to_le32(PIPEDIR_INOUT),
737 .nentries = __cpu_to_le32(32),
738 .nbytes_max = __cpu_to_le32(16384),
739 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
740 .reserved = __cpu_to_le32(0),
741 },
742
743 /* CE9: WMI logging/CFR/Spectral/Radar/ */
744 {
745 .pipenum = __cpu_to_le32(9),
746 .pipedir = __cpu_to_le32(PIPEDIR_IN),
747 .nentries = __cpu_to_le32(32),
748 .nbytes_max = __cpu_to_le32(2048),
749 .flags = __cpu_to_le32(CE_ATTR_FLAGS),
750 .reserved = __cpu_to_le32(0),
751 },
752
753 /* CE10: Unused TBD */
754 {
755 .pipenum = __cpu_to_le32(10),
756 .pipedir = __cpu_to_le32(PIPEDIR_NONE),
757 .nentries = __cpu_to_le32(0),
758 .nbytes_max = __cpu_to_le32(0),
759 .flags = __cpu_to_le32(0),
760 .reserved = __cpu_to_le32(0),
761 },
762 /* CE11: Unused TBD */
763 {
764 .pipenum = __cpu_to_le32(11),
765 .pipedir = __cpu_to_le32(PIPEDIR_NONE),
766 .nentries = __cpu_to_le32(0),
767 .nbytes_max = __cpu_to_le32(0),
768 .flags = __cpu_to_le32(0),
769 .reserved = __cpu_to_le32(0),
770 },
771 };
772
773 const struct service_to_pipe
774 ath12k_wifi7_target_service_to_ce_map_wlan_ipq5332[] = {
775 {
776 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
777 __cpu_to_le32(PIPEDIR_OUT),
778 __cpu_to_le32(3),
779 },
780 {
781 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VO),
782 __cpu_to_le32(PIPEDIR_IN),
783 __cpu_to_le32(2),
784 },
785 {
786 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
787 __cpu_to_le32(PIPEDIR_OUT),
788 __cpu_to_le32(3),
789 },
790 {
791 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BK),
792 __cpu_to_le32(PIPEDIR_IN),
793 __cpu_to_le32(2),
794 },
795 {
796 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
797 __cpu_to_le32(PIPEDIR_OUT),
798 __cpu_to_le32(3),
799 },
800 {
801 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_BE),
802 __cpu_to_le32(PIPEDIR_IN),
803 __cpu_to_le32(2),
804 },
805 {
806 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
807 __cpu_to_le32(PIPEDIR_OUT),
808 __cpu_to_le32(3),
809 },
810 {
811 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_DATA_VI),
812 __cpu_to_le32(PIPEDIR_IN),
813 __cpu_to_le32(2),
814 },
815 {
816 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
817 __cpu_to_le32(PIPEDIR_OUT),
818 __cpu_to_le32(3),
819 },
820 {
821 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL),
822 __cpu_to_le32(PIPEDIR_IN),
823 __cpu_to_le32(2),
824 },
825 {
826 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
827 __cpu_to_le32(PIPEDIR_OUT),
828 __cpu_to_le32(0),
829 },
830 {
831 __cpu_to_le32(ATH12K_HTC_SVC_ID_RSVD_CTRL),
832 __cpu_to_le32(PIPEDIR_IN),
833 __cpu_to_le32(1),
834 },
835 {
836 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
837 __cpu_to_le32(PIPEDIR_OUT),
838 __cpu_to_le32(0),
839 },
840 {
841 __cpu_to_le32(ATH12K_HTC_SVC_ID_TEST_RAW_STREAMS),
842 __cpu_to_le32(PIPEDIR_IN),
843 __cpu_to_le32(1),
844 },
845 {
846 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
847 __cpu_to_le32(PIPEDIR_OUT),
848 __cpu_to_le32(4),
849 },
850 {
851 __cpu_to_le32(ATH12K_HTC_SVC_ID_HTT_DATA_MSG),
852 __cpu_to_le32(PIPEDIR_IN),
853 __cpu_to_le32(1),
854 },
855 {
856 __cpu_to_le32(ATH12K_HTC_SVC_ID_PKT_LOG),
857 __cpu_to_le32(PIPEDIR_IN),
858 __cpu_to_le32(5),
859 },
860 {
861 __cpu_to_le32(ATH12K_HTC_SVC_ID_WMI_CONTROL_DIAG),
862 __cpu_to_le32(PIPEDIR_IN),
863 __cpu_to_le32(9),
864 },
865 /* (Additions here) */
866
867 { /* must be last */
868 __cpu_to_le32(0),
869 __cpu_to_le32(0),
870 __cpu_to_le32(0),
871 },
872 };
873
874 const struct ce_attr ath12k_wifi7_host_ce_config_ipq5332[] = {
875 /* CE0: host->target HTC control and raw streams */
876 {
877 .flags = CE_ATTR_FLAGS,
878 .src_nentries = 16,
879 .src_sz_max = 2048,
880 .dest_nentries = 0,
881 },
882
883 /* CE1: target->host HTT + HTC control */
884 {
885 .flags = CE_ATTR_FLAGS,
886 .src_nentries = 0,
887 .src_sz_max = 2048,
888 .dest_nentries = 512,
889 .recv_cb = ath12k_htc_rx_completion_handler,
890 },
891
892 /* CE2: target->host WMI */
893 {
894 .flags = CE_ATTR_FLAGS,
895 .src_nentries = 0,
896 .src_sz_max = 2048,
897 .dest_nentries = 128,
898 .recv_cb = ath12k_htc_rx_completion_handler,
899 },
900
901 /* CE3: host->target WMI */
902 {
903 .flags = CE_ATTR_FLAGS,
904 .src_nentries = 32,
905 .src_sz_max = 2048,
906 .dest_nentries = 0,
907 },
908
909 /* CE4: host->target HTT */
910 {
911 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
912 .src_nentries = 2048,
913 .src_sz_max = 256,
914 .dest_nentries = 0,
915 },
916
917 /* CE5: target -> host PKTLOG */
918 {
919 .flags = CE_ATTR_FLAGS,
920 .src_nentries = 0,
921 .src_sz_max = 2048,
922 .dest_nentries = 512,
923 .recv_cb = ath12k_dp_htt_htc_t2h_msg_handler,
924 },
925
926 /* CE6: Target autonomous HIF_memcpy */
927 {
928 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
929 .src_nentries = 0,
930 .src_sz_max = 0,
931 .dest_nentries = 0,
932 },
933
934 /* CE7: CV Prefetch */
935 {
936 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
937 .src_nentries = 0,
938 .src_sz_max = 0,
939 .dest_nentries = 0,
940 },
941
942 /* CE8: Target HIF memcpy (Generic HIF memcypy) */
943 {
944 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
945 .src_nentries = 0,
946 .src_sz_max = 0,
947 .dest_nentries = 0,
948 },
949
950 /* CE9: WMI logging/CFR/Spectral/Radar */
951 {
952 .flags = CE_ATTR_FLAGS,
953 .src_nentries = 0,
954 .src_sz_max = 2048,
955 .dest_nentries = 128,
956 },
957
958 /* CE10: Unused */
959 {
960 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
961 .src_nentries = 0,
962 .src_sz_max = 0,
963 .dest_nentries = 0,
964 },
965
966 /* CE11: Unused */
967 {
968 .flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
969 .src_nentries = 0,
970 .src_sz_max = 0,
971 .dest_nentries = 0,
972 },
973 };