1 /*
2 * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for
6 * any purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #include "targaddrs.h"
21 #include "target_type.h"
22 #include "cepci.h"
23 #include "regtable.h"
24 #include "ar6320def.h"
25 #include "ar6320v2def.h"
26 #include "hif_main.h"
27 #include "adrastea_reg_def.h"
28 #include "wcn6450def.h"
29
30 #include "targetdef.h"
31 #include "hostdef.h"
32
hif_target_register_tbl_attach(struct hif_softc * scn,u32 target_type)33 void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type)
34 {
35 switch (target_type) {
36 case TARGET_TYPE_AR6320:
37 scn->targetdef = &ar6320_targetdef;
38 scn->target_ce_def = &ar6320_ce_targetdef;
39 break;
40 case TARGET_TYPE_AR6320V2:
41 scn->targetdef = &ar6320v2_targetdef;
42 scn->target_ce_def = &ar6320v2_ce_targetdef;
43 break;
44 case TARGET_TYPE_ADRASTEA:
45 scn->targetdef = &adrastea_targetdef;
46 scn->target_ce_def = &adrastea_ce_targetdef;
47 break;
48 case TARGET_TYPE_QCN7605:
49 scn->targetdef = &genoa_targetdef;
50 scn->target_ce_def = &genoa_ce_targetdef;
51 break;
52 #if defined(AR6002_HEADERS_DEF)
53 case TARGET_TYPE_AR6002:
54 scn->targetdef = AR6002_TARGETdef;
55 break;
56 #endif
57 #if defined(AR6003_HEADERS_DEF)
58 case TARGET_TYPE_AR6003:
59 scn->targetdef = AR6003_TARGETdef;
60 break;
61 #endif
62 #if defined(AR6004_HEADERS_DEF)
63 case TARGET_TYPE_AR6004:
64 scn->targetdef = AR6004_TARGETdef;
65 break;
66 #endif
67 #if defined(AR9888_HEADERS_DEF)
68 case TARGET_TYPE_AR9888:
69 scn->targetdef = AR9888_TARGETdef;
70 scn->target_ce_def = AR9888_CE_TARGETdef;
71 break;
72 #endif
73 #if defined(AR9888V2_HEADERS_DEF)
74 case TARGET_TYPE_AR9888V2:
75 scn->targetdef = AR9888V2_TARGETdef;
76 scn->target_ce_def = AR9888_CE_TARGETdef;
77 break;
78 #endif
79 #if defined(AR900B_HEADERS_DEF)
80 case TARGET_TYPE_AR900B:
81 scn->targetdef = AR900B_TARGETdef;
82 scn->target_ce_def = AR900B_CE_TARGETdef;
83 break;
84 #endif
85 #if defined(QCA9984_HEADERS_DEF)
86 case TARGET_TYPE_QCA9984:
87 scn->targetdef = QCA9984_TARGETdef;
88 scn->target_ce_def = QCA9984_CE_TARGETdef;
89 break;
90 #endif
91 #if defined(QCA9888_HEADERS_DEF)
92 case TARGET_TYPE_QCA9888:
93 scn->targetdef = QCA9888_TARGETdef;
94 scn->target_ce_def = QCA9888_CE_TARGETdef;
95 break;
96 #endif
97 #if defined(QCA8074_HEADERS_DEF)
98 case TARGET_TYPE_QCA8074:
99 scn->targetdef = QCA8074_TARGETdef;
100 scn->target_ce_def = QCA8074_CE_TARGETdef;
101 break;
102 #endif
103
104 #if defined(QCA6290_HEADERS_DEF)
105 case TARGET_TYPE_QCA6290:
106 scn->targetdef = QCA6290_TARGETdef;
107 scn->target_ce_def = QCA6290_CE_TARGETdef;
108 break;
109 #endif
110 #if defined(QCA8074V2_HEADERS_DEF)
111 case TARGET_TYPE_QCA8074V2:
112 scn->targetdef = QCA8074V2_TARGETDEF;
113 scn->target_ce_def = QCA8074V2_CE_TARGETDEF;
114 break;
115 #endif
116 #if defined(QCA6018_HEADERS_DEF)
117 case TARGET_TYPE_QCA6018:
118 scn->targetdef = QCA6018_TARGETDEF;
119 scn->target_ce_def = QCA6018_CE_TARGETDEF;
120 break;
121 #endif
122 #if defined(QCA9574_HEADERS_DEF)
123 case TARGET_TYPE_QCA9574:
124 scn->targetdef = QCA9574_TARGETDEF;
125 scn->target_ce_def = QCA9574_CE_TARGETDEF;
126 hif_info("TARGET_TYPE_QCA9574");
127 break;
128 #endif
129
130 #if defined(QCN9000_HEADERS_DEF)
131 case TARGET_TYPE_QCN9000:
132 scn->targetdef = QCN9000_TARGETDEF;
133 scn->target_ce_def = QCN9000_CE_TARGETDEF;
134 hif_info("TARGET_TYPE_QCN9000");
135 break;
136 #endif
137
138 #if defined(QCN9224_HEADERS_DEF)
139 case TARGET_TYPE_QCN9224:
140 scn->targetdef = QCN9224_TARGETDEF;
141 scn->target_ce_def = QCN9224_CE_TARGETDEF;
142 hif_info("TARGET_TYPE_QCN9224");
143 break;
144 #endif
145
146 #if defined(QCN6122_HEADERS_DEF)
147 case TARGET_TYPE_QCN6122:
148 scn->targetdef = QCN6122_TARGETDEF;
149 scn->target_ce_def = QCN6122_CE_TARGETDEF;
150 hif_info("TARGET_TYPE_QCN6122");
151 break;
152 #endif
153
154 #if defined(QCN9160_HEADERS_DEF)
155 case TARGET_TYPE_QCN9160:
156 scn->targetdef = QCN9160_TARGETDEF;
157 scn->target_ce_def = QCN9160_CE_TARGETDEF;
158 hif_info("TARGET_TYPE_QCN9160");
159 break;
160 #endif
161
162 #if defined(QCN6432_HEADERS_DEF)
163 case TARGET_TYPE_QCN6432:
164 scn->targetdef = QCN6432_TARGETDEF;
165 scn->target_ce_def = QCN6432_CE_TARGETDEF;
166 hif_info("TARGET_TYPE_QCN6432");
167 break;
168 #endif
169
170 #if defined(QCA5018_HEADERS_DEF)
171 case TARGET_TYPE_QCA5018:
172 scn->targetdef = QCA5018_TARGETDEF;
173 scn->target_ce_def = QCA5018_CE_TARGETDEF;
174 hif_info("TARGET_TYPE_QCA5018");
175 break;
176 #endif
177
178 #if defined(QCA5332_HEADERS_DEF)
179 case TARGET_TYPE_QCA5332:
180 scn->targetdef = QCA5332_TARGETDEF;
181 scn->target_ce_def = QCA5332_CE_TARGETDEF;
182 hif_info("TARGET_TYPE_QCA5332");
183 break;
184 #endif
185
186 #if defined(QCA6390_HEADERS_DEF)
187 case TARGET_TYPE_QCA6390:
188 scn->targetdef = QCA6390_TARGETdef;
189 scn->target_ce_def = QCA6390_CE_TARGETdef;
190 hif_info("TARGET_TYPE_QCA6390");
191 break;
192 #endif /* QCA6390_HEADERS_DEF */
193
194 #if defined(QCA6490_HEADERS_DEF)
195 case TARGET_TYPE_QCA6490:
196 scn->targetdef = QCA6490_TARGETdef;
197 scn->target_ce_def = QCA6490_CE_TARGETdef;
198 hif_info("TARGET_TYPE_QCA6490");
199 break;
200 #endif /* QCA6490_HEADERS_DEF */
201
202 #if defined(KIWI_HEADERS_DEF)
203 case TARGET_TYPE_KIWI:
204 scn->targetdef = KIWI_TARGETdef;
205 scn->target_ce_def = KIWI_CE_TARGETdef;
206 hif_info("TARGET_TYPE_KIWI");
207 break;
208
209 case TARGET_TYPE_MANGO:
210 scn->targetdef = KIWI_TARGETdef;
211 scn->target_ce_def = KIWI_CE_TARGETdef;
212 hif_info("TARGET_TYPE_MANGO");
213 break;
214
215 case TARGET_TYPE_PEACH:
216 scn->targetdef = KIWI_TARGETdef;
217 scn->target_ce_def = KIWI_CE_TARGETdef;
218 hif_info("TARGET_TYPE_PEACH");
219 break;
220 #endif /* KIWI_HEADERS_DEF */
221
222 #if defined(QCA6750_HEADERS_DEF)
223 case TARGET_TYPE_QCA6750:
224 scn->targetdef = QCA6750_TARGETdef;
225 scn->target_ce_def = QCA6750_CE_TARGETdef;
226 hif_info("TARGET_TYPE_QCA6750");
227 break;
228 #endif /* QCA6750_HEADERS_DEF */
229
230 #if defined(WCN6450_HEADERS_DEF)
231 case TARGET_TYPE_WCN6450:
232 scn->targetdef = &wcn6450_targetdef;
233 scn->target_ce_def = &wcn6450_ce_targetdef;
234 hif_info("TARGET_TYPE_WCN6450");
235 break;
236 #endif /* WCN6450_HEADERS_DEF */
237
238 default:
239 break;
240 }
241 }
242
hif_register_tbl_attach(struct hif_softc * scn,u32 hif_type)243 void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type)
244 {
245 switch (hif_type) {
246 case HIF_TYPE_AR6320V2:
247 scn->hostdef = &ar6320v2_hostdef;
248 break;
249 case HIF_TYPE_ADRASTEA:
250 scn->hostdef = &adrastea_hostdef;
251 scn->host_shadow_regs = &adrastea_host_shadow_regs;
252 break;
253 case HIF_TYPE_QCN7605:
254 scn->hostdef = &genoa_hostdef;
255 scn->host_shadow_regs = &genoa_host_shadow_regs;
256 break;
257 #if defined(AR6002_HEADERS_DEF)
258 case HIF_TYPE_AR6002:
259 scn->hostdef = AR6002_HOSTdef;
260 break;
261 #endif
262 #if defined(AR6003_HEADERS_DEF)
263 case HIF_TYPE_AR6003:
264 scn->hostdef = AR6003_HOSTdef;
265 break;
266 #endif
267 #if defined(AR6004_HEADERS_DEF)
268 case HIF_TYPE_AR6004:
269 scn->hostdef = AR6004_HOSTdef;
270 break;
271 #endif
272 #if defined(AR9888_HEADERS_DEF)
273 case HIF_TYPE_AR9888:
274 scn->hostdef = AR9888_HOSTdef;
275 break;
276 #endif
277 #if defined(AR9888V2_HEADERS_DEF)
278 case HIF_TYPE_AR9888V2:
279 scn->hostdef = AR9888V2_HOSTdef;
280 break;
281 #endif
282 #if defined(AR900B_HEADERS_DEF)
283 case HIF_TYPE_AR900B:
284 scn->hostdef = AR900B_HOSTdef;
285 break;
286 #endif
287 #if defined(QCA9984_HEADERS_DEF)
288 case HIF_TYPE_QCA9984:
289 scn->hostdef = QCA9984_HOSTdef;
290 break;
291 #endif
292 #if defined(QCA9888_HEADERS_DEF)
293 case HIF_TYPE_QCA9888:
294 scn->hostdef = QCA9888_HOSTdef;
295 break;
296 #endif
297
298 #if defined(QCA8074_HEADERS_DEF)
299 case HIF_TYPE_QCA8074:
300 scn->hostdef = QCA8074_HOSTdef;
301 break;
302 #endif
303 #if defined(QCA8074V2_HEADERS_DEF)
304 case HIF_TYPE_QCA8074V2:
305 scn->hostdef = QCA8074V2_HOSTDEF;
306 break;
307 #endif
308 #if defined(QCA6018_HEADERS_DEF)
309 case HIF_TYPE_QCA6018:
310 scn->hostdef = QCA6018_HOSTDEF;
311 hif_info("HIF_TYPE_QCA6018");
312 break;
313 #endif
314 #if defined(QCA6290_HEADERS_DEF)
315 case HIF_TYPE_QCA6290:
316 scn->hostdef = QCA6290_HOSTdef;
317 break;
318 #endif
319 #if defined(QCN9000_HEADERS_DEF)
320 case HIF_TYPE_QCN9000:
321 scn->hostdef = QCN9000_HOSTDEF;
322 break;
323 #endif
324 #if defined(QCN9224_HEADERS_DEF)
325 case HIF_TYPE_QCN9224:
326 if (scn->target_info.soc_version == 1)
327 qdf_assert_always(0);
328 scn->hostdef = QCN9224_HOSTDEF;
329 break;
330 #endif
331 #if defined(QCN6122_HEADERS_DEF)
332 case HIF_TYPE_QCN6122:
333 scn->hostdef = QCN6122_HOSTDEF;
334 break;
335 #endif
336 #if defined(QCN9160_HEADERS_DEF)
337 case HIF_TYPE_QCN9160:
338 scn->hostdef = QCN9160_HOSTDEF;
339 break;
340 #endif
341 #if defined(QCN6432_HEADERS_DEF)
342 case HIF_TYPE_QCN6432:
343 scn->hostdef = QCN6432_HOSTDEF;
344 break;
345 #endif
346 #if defined(QCA5018_HEADERS_DEF)
347 case HIF_TYPE_QCA5018:
348 scn->hostdef = QCA5018_HOSTDEF;
349 break;
350 #endif
351 #if defined(QCA5332_HEADERS_DEF)
352 case HIF_TYPE_QCA5332:
353 scn->hostdef = QCA5332_HOSTDEF;
354 break;
355 #endif
356 #if defined(QCA9574_HEADERS_DEF)
357 case HIF_TYPE_QCA9574:
358 scn->hostdef = QCA9574_HOSTDEF;
359 hif_info("HIF_TYPE_QCA9574");
360 break;
361 #endif
362
363 #if defined(QCA6390_HEADERS_DEF)
364 case HIF_TYPE_QCA6390:
365 scn->hostdef = QCA6390_HOSTdef;
366 hif_info("HIF_TYPE_QCA6390");
367 break;
368 #endif /* QCA6390_HEADERS_DEF */
369
370 #if defined(QCA6490_HEADERS_DEF)
371 case HIF_TYPE_QCA6490:
372 scn->hostdef = QCA6490_HOSTdef;
373 hif_info("HIF_TYPE_QCA6490");
374 break;
375 #endif /* QCA6490_HEADERS_DEF */
376
377 #if defined(KIWI_HEADERS_DEF)
378 case HIF_TYPE_KIWI:
379 scn->hostdef = KIWI_HOSTdef;
380 hif_info("HIF_TYPE_KIWI");
381 break;
382
383 case HIF_TYPE_MANGO:
384 scn->hostdef = KIWI_HOSTdef;
385 hif_info("HIF_TYPE_MANGO");
386 break;
387
388 case HIF_TYPE_PEACH:
389 scn->hostdef = KIWI_HOSTdef;
390 hif_info("HIF_TYPE_PEACH");
391 break;
392 #endif /* KIWI_HEADERS_DEF */
393
394 #if defined(QCA6750_HEADERS_DEF)
395 case HIF_TYPE_QCA6750:
396 scn->hostdef = QCA6750_HOSTdef;
397 hif_info("HIF_TYPE_QCA6750");
398 break;
399 #endif /* QCA6750_HEADERS_DEF */
400
401 #if defined(WCN6450_HEADERS_DEF)
402 case HIF_TYPE_WCN6450:
403 scn->hostdef = &wcn6450_hostdef;
404 scn->host_shadow_regs = &wcn6450_host_shadow_regs;
405 hif_info("HIF_TYPE_WCN6450");
406 break;
407 #endif /* WCN6450_HEADERS_DEF */
408
409 default:
410 break;
411 }
412 }
413