xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_cmn_reg.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-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  /**
21  * @file cdp_txrx_cmn.h
22  * @brief Define the host data path converged API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_CMN_REG_H_
26 #define _CDP_TXRX_CMN_REG_H_
27 
28 #include "hif_main.h"
29 #include "cdp_txrx_cmn_struct.h"
30 
31 #define MOB_DRV_LEGACY_DP 0xdeed
32 /* Lithium device IDs */
33 #define LITHIUM_DP		0xfffd
34 /* Beryllium device IDs */
35 #define BERYLLIUM_DP		0xaffe
36 
37 /* RHINE device IDs */
38 #define RHINE_DP		0xbff0
39 /* Use device IDs for attach in future */
40 
41 /* enum cdp_arch_type - enum for DP arch type
42  * CDP_ARCH_TYPE_LI - for lithium
43  * CDP_ARCH_TYPE_BE - for beryllium
44  * CDP_ARCH_TYPE_NONE - not supported
45  */
46 enum cdp_arch_type {
47 	CDP_ARCH_TYPE_NONE = -1,
48 	CDP_ARCH_TYPE_LI,
49 	CDP_ARCH_TYPE_BE,
50 	CDP_ARCH_TYPE_RH,
51 };
52 
53 #if defined(DP_TXRX_SOC_ATTACH)
54 static inline ol_txrx_soc_handle
ol_txrx_soc_attach(void * scn_handle,struct ol_if_ops * dp_ol_if_ops)55 ol_txrx_soc_attach(void *scn_handle, struct ol_if_ops *dp_ol_if_ops)
56 {
57 	return NULL;
58 }
59 #else
60 ol_txrx_soc_handle
61 ol_txrx_soc_attach(void *scn_handle, struct ol_if_ops *dp_ol_if_ops);
62 #endif
63 
64 #if defined(QCA_WIFI_QCA8074) || defined(QCA_WIFI_QCA6018) || \
65 	defined(QCA_WIFI_QCA5018) || defined(QCA_WIFI_QCA9574) || \
66 	defined(QCA_WIFI_QCA5332)
67 
68 /**
69  * dp_soc_attach_wifi3() - Attach txrx SOC
70  * @ctrl_psoc:	Opaque SOC handle from Ctrl plane
71  * @params: soc attach params
72  *
73  * Return: DP SOC handle on success, NULL on failure
74  */
75 struct cdp_soc_t *
76 dp_soc_attach_wifi3(struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
77 		    struct cdp_soc_attach_params *params);
78 
79 /**
80  * dp_soc_init_wifi3() - Initialize txrx SOC
81  * @soc: Opaque DP SOC handle
82  * @ctrl_psoc: Opaque SOC handle from control plane
83  * @hif_handle: Opaque HIF handle
84  * @htc_handle: Opaque HTC handle
85  * @qdf_osdev: QDF device
86  * @ol_ops: Offload Operations
87  * @device_id: Device ID
88  *
89  * Return: DP SOC handle on success, NULL on failure
90  */
91 void *dp_soc_init_wifi3(struct cdp_soc_t *soc,
92 			struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
93 			struct hif_opaque_softc *hif_handle,
94 			HTC_HANDLE htc_handle, qdf_device_t qdf_osdev,
95 			struct ol_if_ops *ol_ops, uint16_t device_id);
96 #else
97 static inline struct cdp_soc_t *
dp_soc_attach_wifi3(struct cdp_ctrl_objmgr_psoc * ctrl_psoc,struct cdp_soc_attach_params * params)98 dp_soc_attach_wifi3(struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
99 		    struct cdp_soc_attach_params *params)
100 {
101 	return NULL;
102 }
103 
104 static inline
dp_soc_init_wifi3(struct cdp_soc_t * soc,struct cdp_ctrl_objmgr_psoc * ctrl_psoc,struct hif_opaque_softc * hif_handle,HTC_HANDLE htc_handle,qdf_device_t qdf_osdev,struct ol_if_ops * ol_ops,uint16_t device_id)105 void *dp_soc_init_wifi3(struct cdp_soc_t *soc,
106 			struct cdp_ctrl_objmgr_psoc *ctrl_psoc,
107 			struct hif_opaque_softc *hif_handle,
108 			HTC_HANDLE htc_handle, qdf_device_t qdf_osdev,
109 			struct ol_if_ops *ol_ops, uint16_t device_id)
110 {
111 	return NULL;
112 }
113 #endif /* QCA_WIFI_QCA8074 */
114 
cdp_get_arch_type_from_devid(uint16_t devid)115 static inline int cdp_get_arch_type_from_devid(uint16_t devid)
116 {
117 	switch (devid) {
118 	case LITHIUM_DP: /*FIXME Add lithium device IDs */
119 	case QCA8074_DEVICE_ID: /* Hawekeye */
120 	case QCA8074V2_DEVICE_ID: /* Hawekeye V2*/
121 	case QCA9574_DEVICE_ID:
122 	case QCA5018_DEVICE_ID:
123 	case QCA6290_DEVICE_ID:
124 	case QCN9000_DEVICE_ID:
125 	case QCN6122_DEVICE_ID:
126 	case QCN9160_DEVICE_ID:
127 	case QCA6390_DEVICE_ID:
128 	case QCA6490_DEVICE_ID:
129 	case QCA6750_DEVICE_ID:
130 	case QCA6390_EMULATION_DEVICE_ID:
131 	case RUMIM2M_DEVICE_ID_NODE0: /*lithium emulation */
132 	case RUMIM2M_DEVICE_ID_NODE1: /*lithium emulation */
133 	case RUMIM2M_DEVICE_ID_NODE2: /*lithium emulation */
134 	case RUMIM2M_DEVICE_ID_NODE3: /*lithium emulation */
135 	case RUMIM2M_DEVICE_ID_NODE4: /*lithium emulation */
136 	case RUMIM2M_DEVICE_ID_NODE5: /*lithium emulation */
137 		return CDP_ARCH_TYPE_LI;
138 	case BERYLLIUM_DP:
139 	case KIWI_DEVICE_ID:
140 	case QCN9224_DEVICE_ID:
141 	case QCA5332_DEVICE_ID:
142 	case MANGO_DEVICE_ID:
143 	case PEACH_DEVICE_ID:
144 	case QCN6432_DEVICE_ID:
145 		return CDP_ARCH_TYPE_BE;
146 	case RHINE_DP:
147 		return CDP_ARCH_TYPE_RH;
148 	default:
149 		return CDP_ARCH_TYPE_NONE;
150 	}
151 }
152 
153 static inline
cdp_soc_attach(u_int16_t devid,struct hif_opaque_softc * hif_handle,struct cdp_ctrl_objmgr_psoc * psoc,HTC_HANDLE htc_handle,qdf_device_t qdf_dev,struct ol_if_ops * dp_ol_if_ops)154 ol_txrx_soc_handle cdp_soc_attach(u_int16_t devid,
155 				  struct hif_opaque_softc *hif_handle,
156 				  struct cdp_ctrl_objmgr_psoc *psoc,
157 				  HTC_HANDLE htc_handle,
158 				  qdf_device_t qdf_dev,
159 				  struct ol_if_ops *dp_ol_if_ops)
160 {
161 	struct cdp_soc_attach_params params = {0};
162 
163 	params.hif_handle = hif_handle;
164 	params.device_id = devid;
165 	params.htc_handle = htc_handle;
166 	params.qdf_osdev = qdf_dev;
167 	params.ol_ops = dp_ol_if_ops;
168 
169 	switch (devid) {
170 	case LITHIUM_DP: /*FIXME Add lithium device IDs */
171 	case BERYLLIUM_DP:
172 	case RHINE_DP:
173 	case QCA8074_DEVICE_ID: /* Hawekeye */
174 	case QCA8074V2_DEVICE_ID: /* Hawekeye V2*/
175 	case QCA5018_DEVICE_ID:
176 	case QCA6290_DEVICE_ID:
177 	case QCN9000_DEVICE_ID:
178 	case QCN6122_DEVICE_ID:
179 	case QCN9160_DEVICE_ID:
180 	case QCN6432_DEVICE_ID:
181 	case QCA6390_DEVICE_ID:
182 	case QCA6490_DEVICE_ID:
183 	case QCA6750_DEVICE_ID:
184 	case QCA6390_EMULATION_DEVICE_ID:
185 	case RUMIM2M_DEVICE_ID_NODE0: /*lithium emulation */
186 	case RUMIM2M_DEVICE_ID_NODE1: /*lithium emulation */
187 	case RUMIM2M_DEVICE_ID_NODE2: /*lithium emulation */
188 	case RUMIM2M_DEVICE_ID_NODE3: /*lithium emulation */
189 	case RUMIM2M_DEVICE_ID_NODE4: /*lithium emulation */
190 	case RUMIM2M_DEVICE_ID_NODE5: /*lithium emulation */
191 	case KIWI_DEVICE_ID:
192 	case QCN9224_DEVICE_ID:
193 	case MANGO_DEVICE_ID:
194 	case PEACH_DEVICE_ID:
195 	case QCA5332_DEVICE_ID:
196 		return dp_soc_attach_wifi3(psoc, &params);
197 	break;
198 	default:
199 		return ol_txrx_soc_attach(psoc, dp_ol_if_ops);
200 	}
201 	return NULL;
202 }
203 
204 #endif /*_CDP_TXRX_CMN_REG_H_ */
205