xref: /wlan-driver/qca-wifi-host-cmn/hif/src/sdio/regtable_sdio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _REGTABLE_SDIO_H_
20 #define _REGTABLE_SDIO_H_
21 
22 #define MISSING  0
23 extern struct hif_sdio_softc *scn;
24 
25 struct targetdef_s {
26 	uint32_t d_RTC_SOC_BASE_ADDRESS;
27 	uint32_t d_RTC_WMAC_BASE_ADDRESS;
28 	uint32_t d_SYSTEM_SLEEP_OFFSET;
29 	uint32_t d_WLAN_SYSTEM_SLEEP_OFFSET;
30 	uint32_t d_WLAN_SYSTEM_SLEEP_DISABLE_LSB;
31 	uint32_t d_WLAN_SYSTEM_SLEEP_DISABLE_MASK;
32 	uint32_t d_CLOCK_CONTROL_OFFSET;
33 	uint32_t d_CLOCK_CONTROL_SI0_CLK_MASK;
34 	uint32_t d_RESET_CONTROL_OFFSET;
35 	uint32_t d_RESET_CONTROL_MBOX_RST_MASK;
36 	uint32_t d_RESET_CONTROL_SI0_RST_MASK;
37 	uint32_t d_WLAN_RESET_CONTROL_OFFSET;
38 	uint32_t d_WLAN_RESET_CONTROL_COLD_RST_MASK;
39 	uint32_t d_WLAN_RESET_CONTROL_WARM_RST_MASK;
40 	uint32_t d_GPIO_BASE_ADDRESS;
41 	uint32_t d_GPIO_PIN0_OFFSET;
42 	uint32_t d_GPIO_PIN1_OFFSET;
43 	uint32_t d_GPIO_PIN0_CONFIG_MASK;
44 	uint32_t d_GPIO_PIN1_CONFIG_MASK;
45 	uint32_t d_SI_CONFIG_BIDIR_OD_DATA_LSB;
46 	uint32_t d_SI_CONFIG_BIDIR_OD_DATA_MASK;
47 	uint32_t d_SI_CONFIG_I2C_LSB;
48 	uint32_t d_SI_CONFIG_I2C_MASK;
49 	uint32_t d_SI_CONFIG_POS_SAMPLE_LSB;
50 	uint32_t d_SI_CONFIG_POS_SAMPLE_MASK;
51 	uint32_t d_SI_CONFIG_INACTIVE_CLK_LSB;
52 	uint32_t d_SI_CONFIG_INACTIVE_CLK_MASK;
53 	uint32_t d_SI_CONFIG_INACTIVE_DATA_LSB;
54 	uint32_t d_SI_CONFIG_INACTIVE_DATA_MASK;
55 	uint32_t d_SI_CONFIG_DIVIDER_LSB;
56 	uint32_t d_SI_CONFIG_DIVIDER_MASK;
57 	uint32_t d_SI_BASE_ADDRESS;
58 	uint32_t d_SI_CONFIG_OFFSET;
59 	uint32_t d_SI_TX_DATA0_OFFSET;
60 	uint32_t d_SI_TX_DATA1_OFFSET;
61 	uint32_t d_SI_RX_DATA0_OFFSET;
62 	uint32_t d_SI_RX_DATA1_OFFSET;
63 	uint32_t d_SI_CS_OFFSET;
64 	uint32_t d_SI_CS_DONE_ERR_MASK;
65 	uint32_t d_SI_CS_DONE_INT_MASK;
66 	uint32_t d_SI_CS_START_LSB;
67 	uint32_t d_SI_CS_START_MASK;
68 	uint32_t d_SI_CS_RX_CNT_LSB;
69 	uint32_t d_SI_CS_RX_CNT_MASK;
70 	uint32_t d_SI_CS_TX_CNT_LSB;
71 	uint32_t d_SI_CS_TX_CNT_MASK;
72 	uint32_t d_BOARD_DATA_SZ;
73 	uint32_t d_BOARD_EXT_DATA_SZ;
74 	uint32_t d_MBOX_BASE_ADDRESS;
75 	uint32_t d_LOCAL_SCRATCH_OFFSET;
76 	uint32_t d_CPU_CLOCK_OFFSET;
77 	uint32_t d_LPO_CAL_OFFSET;
78 	uint32_t d_GPIO_PIN10_OFFSET;
79 	uint32_t d_GPIO_PIN11_OFFSET;
80 	uint32_t d_GPIO_PIN12_OFFSET;
81 	uint32_t d_GPIO_PIN13_OFFSET;
82 	uint32_t d_CLOCK_GPIO_OFFSET;
83 	uint32_t d_CPU_CLOCK_STANDARD_LSB;
84 	uint32_t d_CPU_CLOCK_STANDARD_MASK;
85 	uint32_t d_LPO_CAL_ENABLE_LSB;
86 	uint32_t d_LPO_CAL_ENABLE_MASK;
87 	uint32_t d_CLOCK_GPIO_BT_CLK_OUT_EN_LSB;
88 	uint32_t d_CLOCK_GPIO_BT_CLK_OUT_EN_MASK;
89 	uint32_t d_ANALOG_INTF_BASE_ADDRESS;
90 	uint32_t d_WLAN_MAC_BASE_ADDRESS;
91 	uint32_t d_FW_INDICATOR_ADDRESS;
92 	uint32_t d_DRAM_BASE_ADDRESS;
93 	uint32_t d_SOC_CORE_BASE_ADDRESS;
94 	uint32_t d_CORE_CTRL_ADDRESS;
95 	uint32_t d_MSI_NUM_REQUEST;
96 	uint32_t d_MSI_ASSIGN_FW;
97 	uint32_t d_CORE_CTRL_CPU_INTR_MASK;
98 	uint32_t d_SR_WR_INDEX_ADDRESS;
99 	uint32_t d_DST_WATERMARK_ADDRESS;
100 
101 	/* htt_rx.c */
102 	uint32_t d_RX_MSDU_END_4_FIRST_MSDU_MASK;
103 	uint32_t d_RX_MSDU_END_4_FIRST_MSDU_LSB;
104 	uint32_t d_RX_MPDU_START_0_RETRY_LSB;
105 	uint32_t d_RX_MPDU_START_0_RETRY_MASK;
106 	uint32_t d_RX_MPDU_START_0_SEQ_NUM_MASK;
107 	uint32_t d_RX_MPDU_START_0_SEQ_NUM_LSB;
108 	uint32_t d_RX_MPDU_START_2_PN_47_32_LSB;
109 	uint32_t d_RX_MPDU_START_2_PN_47_32_MASK;
110 	uint32_t d_RX_MPDU_START_2_TID_LSB;
111 	uint32_t d_RX_MPDU_START_2_TID_MASK;
112 	uint32_t d_RX_MSDU_END_1_EXT_WAPI_PN_63_48_MASK;
113 	uint32_t d_RX_MSDU_END_1_EXT_WAPI_PN_63_48_LSB;
114 	uint32_t d_RX_MSDU_END_1_KEY_ID_OCT_MASK;
115 	uint32_t d_RX_MSDU_END_1_KEY_ID_OCT_LSB;
116 	uint32_t d_RX_MSDU_END_4_LAST_MSDU_MASK;
117 	uint32_t d_RX_MSDU_END_4_LAST_MSDU_LSB;
118 	uint32_t d_RX_ATTENTION_0_MCAST_BCAST_MASK;
119 	uint32_t d_RX_ATTENTION_0_MCAST_BCAST_LSB;
120 	uint32_t d_RX_ATTENTION_0_FRAGMENT_MASK;
121 	uint32_t d_RX_ATTENTION_0_FRAGMENT_LSB;
122 	uint32_t d_RX_ATTENTION_0_MPDU_LENGTH_ERR_MASK;
123 	uint32_t d_RX_FRAG_INFO_0_RING2_MORE_COUNT_MASK;
124 	uint32_t d_RX_FRAG_INFO_0_RING2_MORE_COUNT_LSB;
125 	uint32_t d_RX_MSDU_START_0_MSDU_LENGTH_MASK;
126 	uint32_t d_RX_MSDU_START_0_MSDU_LENGTH_LSB;
127 	uint32_t d_RX_MSDU_START_2_DECAP_FORMAT_OFFSET;
128 	uint32_t d_RX_MSDU_START_2_DECAP_FORMAT_MASK;
129 	uint32_t d_RX_MSDU_START_2_DECAP_FORMAT_LSB;
130 	uint32_t d_RX_MPDU_START_0_ENCRYPTED_MASK;
131 	uint32_t d_RX_MPDU_START_0_ENCRYPTED_LSB;
132 	uint32_t d_RX_ATTENTION_0_MORE_DATA_MASK;
133 	uint32_t d_RX_ATTENTION_0_MSDU_DONE_MASK;
134 	uint32_t d_RX_ATTENTION_0_TCP_UDP_CHKSUM_FAIL_MASK;
135 	/* end */
136 
137 	/* PLL start */
138 	uint32_t d_EFUSE_OFFSET;
139 	uint32_t d_EFUSE_XTAL_SEL_MSB;
140 	uint32_t d_EFUSE_XTAL_SEL_LSB;
141 	uint32_t d_EFUSE_XTAL_SEL_MASK;
142 	uint32_t d_BB_PLL_CONFIG_OFFSET;
143 	uint32_t d_BB_PLL_CONFIG_OUTDIV_MSB;
144 	uint32_t d_BB_PLL_CONFIG_OUTDIV_LSB;
145 	uint32_t d_BB_PLL_CONFIG_OUTDIV_MASK;
146 	uint32_t d_BB_PLL_CONFIG_FRAC_MSB;
147 	uint32_t d_BB_PLL_CONFIG_FRAC_LSB;
148 	uint32_t d_BB_PLL_CONFIG_FRAC_MASK;
149 	uint32_t d_WLAN_PLL_SETTLE_TIME_MSB;
150 	uint32_t d_WLAN_PLL_SETTLE_TIME_LSB;
151 	uint32_t d_WLAN_PLL_SETTLE_TIME_MASK;
152 	uint32_t d_WLAN_PLL_SETTLE_OFFSET;
153 	uint32_t d_WLAN_PLL_SETTLE_SW_MASK;
154 	uint32_t d_WLAN_PLL_SETTLE_RSTMASK;
155 	uint32_t d_WLAN_PLL_SETTLE_RESET;
156 	uint32_t d_WLAN_PLL_CONTROL_NOPWD_MSB;
157 	uint32_t d_WLAN_PLL_CONTROL_NOPWD_LSB;
158 	uint32_t d_WLAN_PLL_CONTROL_NOPWD_MASK;
159 	uint32_t d_WLAN_PLL_CONTROL_BYPASS_MSB;
160 	uint32_t d_WLAN_PLL_CONTROL_BYPASS_LSB;
161 	uint32_t d_WLAN_PLL_CONTROL_BYPASS_MASK;
162 	uint32_t d_WLAN_PLL_CONTROL_BYPASS_RESET;
163 	uint32_t d_WLAN_PLL_CONTROL_CLK_SEL_MSB;
164 	uint32_t d_WLAN_PLL_CONTROL_CLK_SEL_LSB;
165 	uint32_t d_WLAN_PLL_CONTROL_CLK_SEL_MASK;
166 	uint32_t d_WLAN_PLL_CONTROL_CLK_SEL_RESET;
167 	uint32_t d_WLAN_PLL_CONTROL_REFDIV_MSB;
168 	uint32_t d_WLAN_PLL_CONTROL_REFDIV_LSB;
169 	uint32_t d_WLAN_PLL_CONTROL_REFDIV_MASK;
170 	uint32_t d_WLAN_PLL_CONTROL_REFDIV_RESET;
171 	uint32_t d_WLAN_PLL_CONTROL_DIV_MSB;
172 	uint32_t d_WLAN_PLL_CONTROL_DIV_LSB;
173 	uint32_t d_WLAN_PLL_CONTROL_DIV_MASK;
174 	uint32_t d_WLAN_PLL_CONTROL_DIV_RESET;
175 	uint32_t d_WLAN_PLL_CONTROL_OFFSET;
176 	uint32_t d_WLAN_PLL_CONTROL_SW_MASK;
177 	uint32_t d_WLAN_PLL_CONTROL_RSTMASK;
178 	uint32_t d_WLAN_PLL_CONTROL_RESET;
179 	uint32_t d_SOC_CORE_CLK_CTRL_OFFSET;
180 	uint32_t d_SOC_CORE_CLK_CTRL_DIV_MSB;
181 	uint32_t d_SOC_CORE_CLK_CTRL_DIV_LSB;
182 	uint32_t d_SOC_CORE_CLK_CTRL_DIV_MASK;
183 	uint32_t d_RTC_SYNC_STATUS_PLL_CHANGING_MSB;
184 	uint32_t d_RTC_SYNC_STATUS_PLL_CHANGING_LSB;
185 	uint32_t d_RTC_SYNC_STATUS_PLL_CHANGING_MASK;
186 	uint32_t d_RTC_SYNC_STATUS_PLL_CHANGING_RESET;
187 	uint32_t d_RTC_SYNC_STATUS_OFFSET;
188 	uint32_t d_SOC_CPU_CLOCK_OFFSET;
189 	uint32_t d_SOC_CPU_CLOCK_STANDARD_MSB;
190 	uint32_t d_SOC_CPU_CLOCK_STANDARD_LSB;
191 	uint32_t d_SOC_CPU_CLOCK_STANDARD_MASK;
192 	/* PLL end */
193 
194 	uint32_t d_SOC_POWER_REG_OFFSET;
195 	uint32_t d_SOC_RESET_CONTROL_ADDRESS;
196 	uint32_t d_SOC_RESET_CONTROL_CPU_WARM_RST_MASK;
197 	uint32_t d_CPU_INTR_ADDRESS;
198 	uint32_t d_SOC_LF_TIMER_CONTROL0_ADDRESS;
199 	uint32_t d_SOC_LF_TIMER_CONTROL0_ENABLE_MASK;
200 	uint32_t d_SOC_LF_TIMER_STATUS0_ADDRESS;
201 
202 	/* chip id start */
203 	uint32_t d_SOC_CHIP_ID_ADDRESS;
204 	uint32_t d_SOC_CHIP_ID_VERSION_MASK;
205 	uint32_t d_SOC_CHIP_ID_VERSION_LSB;
206 	uint32_t d_SOC_CHIP_ID_REVISION_MASK;
207 	uint32_t d_SOC_CHIP_ID_REVISION_LSB;
208 	/* chip id end */
209 
210 	uint32_t d_A_SOC_CORE_SCRATCH_0_ADDRESS;
211 	uint32_t d_A_SOC_CORE_SCRATCH_1_ADDRESS;
212 	uint32_t d_A_SOC_CORE_SCRATCH_2_ADDRESS;
213 	uint32_t d_A_SOC_CORE_SCRATCH_3_ADDRESS;
214 	uint32_t d_A_SOC_CORE_SCRATCH_4_ADDRESS;
215 	uint32_t d_A_SOC_CORE_SCRATCH_5_ADDRESS;
216 	uint32_t d_A_SOC_CORE_SCRATCH_6_ADDRESS;
217 	uint32_t d_A_SOC_CORE_SCRATCH_7_ADDRESS;
218 	uint32_t d_A_SOC_CORE_SPARE_0_REGISTER;
219 	uint32_t d_A_SOC_CORE_SPARE_1_REGISTER;
220 
221 	uint32_t d_WLAN_DEBUG_INPUT_SEL_OFFSET;
222 	uint32_t d_WLAN_DEBUG_INPUT_SEL_SRC_MSB;
223 	uint32_t d_WLAN_DEBUG_INPUT_SEL_SRC_LSB;
224 	uint32_t d_WLAN_DEBUG_INPUT_SEL_SRC_MASK;
225 	uint32_t d_WLAN_DEBUG_CONTROL_OFFSET;
226 	uint32_t d_WLAN_DEBUG_CONTROL_ENABLE_MSB;
227 	uint32_t d_WLAN_DEBUG_CONTROL_ENABLE_LSB;
228 	uint32_t d_WLAN_DEBUG_CONTROL_ENABLE_MASK;
229 	uint32_t d_WLAN_DEBUG_OUT_OFFSET;
230 	uint32_t d_WLAN_DEBUG_OUT_DATA_MSB;
231 	uint32_t d_WLAN_DEBUG_OUT_DATA_LSB;
232 	uint32_t d_WLAN_DEBUG_OUT_DATA_MASK;
233 	uint32_t d_AMBA_DEBUG_BUS_OFFSET;
234 	uint32_t d_AMBA_DEBUG_BUS_SEL_MSB;
235 	uint32_t d_AMBA_DEBUG_BUS_SEL_LSB;
236 	uint32_t d_AMBA_DEBUG_BUS_SEL_MASK;
237 
238 #ifdef QCA_WIFI_3_0_ADRASTEA
239 	uint32_t d_Q6_ENABLE_REGISTER_0;
240 	uint32_t d_Q6_ENABLE_REGISTER_1;
241 	uint32_t d_Q6_CAUSE_REGISTER_0;
242 	uint32_t d_Q6_CAUSE_REGISTER_1;
243 	uint32_t d_Q6_CLEAR_REGISTER_0;
244 	uint32_t d_Q6_CLEAR_REGISTER_1;
245 #endif
246 };
247 
248 #define A_SOC_CORE_SPARE_0_REGISTER \
249 	(scn->targetdef->d_A_SOC_CORE_SPARE_0_REGISTER)
250 #define A_SOC_CORE_SCRATCH_0_ADDRESS  \
251 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_0_ADDRESS)
252 #define A_SOC_CORE_SCRATCH_1_ADDRESS  \
253 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_1_ADDRESS)
254 #define A_SOC_CORE_SCRATCH_2_ADDRESS  \
255 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_2_ADDRESS)
256 #define A_SOC_CORE_SCRATCH_3_ADDRESS  \
257 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_3_ADDRESS)
258 #define A_SOC_CORE_SCRATCH_4_ADDRESS  \
259 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_4_ADDRESS)
260 #define A_SOC_CORE_SCRATCH_5_ADDRESS  \
261 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_5_ADDRESS)
262 #define A_SOC_CORE_SCRATCH_6_ADDRESS  \
263 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_6_ADDRESS)
264 #define A_SOC_CORE_SCRATCH_7_ADDRESS  \
265 	(scn->targetdef->d_A_SOC_CORE_SCRATCH_7_ADDRESS)
266 #define RTC_SOC_BASE_ADDRESS  (scn->targetdef->d_RTC_SOC_BASE_ADDRESS)
267 #define RTC_WMAC_BASE_ADDRESS (scn->targetdef->d_RTC_WMAC_BASE_ADDRESS)
268 #define SYSTEM_SLEEP_OFFSET   (scn->targetdef->d_SYSTEM_SLEEP_OFFSET)
269 #define WLAN_SYSTEM_SLEEP_OFFSET \
270 	(scn->targetdef->d_WLAN_SYSTEM_SLEEP_OFFSET)
271 #define WLAN_SYSTEM_SLEEP_DISABLE_LSB \
272 	(scn->targetdef->d_WLAN_SYSTEM_SLEEP_DISABLE_LSB)
273 #define WLAN_SYSTEM_SLEEP_DISABLE_MASK \
274 	(scn->targetdef->d_WLAN_SYSTEM_SLEEP_DISABLE_MASK)
275 #define CLOCK_CONTROL_OFFSET (scn->targetdef->d_CLOCK_CONTROL_OFFSET)
276 #define CLOCK_CONTROL_SI0_CLK_MASK \
277 	(scn->targetdef->d_CLOCK_CONTROL_SI0_CLK_MASK)
278 #define RESET_CONTROL_OFFSET    (scn->targetdef->d_RESET_CONTROL_OFFSET)
279 #define RESET_CONTROL_MBOX_RST_MASK \
280 	(scn->targetdef->d_RESET_CONTROL_MBOX_RST_MASK)
281 #define RESET_CONTROL_SI0_RST_MASK \
282 	(scn->targetdef->d_RESET_CONTROL_SI0_RST_MASK)
283 #define WLAN_RESET_CONTROL_OFFSET \
284 	(scn->targetdef->d_WLAN_RESET_CONTROL_OFFSET)
285 #define WLAN_RESET_CONTROL_COLD_RST_MASK \
286 	(scn->targetdef->d_WLAN_RESET_CONTROL_COLD_RST_MASK)
287 #define WLAN_RESET_CONTROL_WARM_RST_MASK \
288 	(scn->targetdef->d_WLAN_RESET_CONTROL_WARM_RST_MASK)
289 #define GPIO_BASE_ADDRESS       (scn->targetdef->d_GPIO_BASE_ADDRESS)
290 #define GPIO_PIN0_OFFSET        (scn->targetdef->d_GPIO_PIN0_OFFSET)
291 #define GPIO_PIN1_OFFSET        (scn->targetdef->d_GPIO_PIN1_OFFSET)
292 #define GPIO_PIN0_CONFIG_MASK   (scn->targetdef->d_GPIO_PIN0_CONFIG_MASK)
293 #define GPIO_PIN1_CONFIG_MASK   (scn->targetdef->d_GPIO_PIN1_CONFIG_MASK)
294 #define A_SOC_CORE_SCRATCH_0    (scn->targetdef->d_A_SOC_CORE_SCRATCH_0)
295 #define SI_CONFIG_BIDIR_OD_DATA_LSB \
296 	(scn->targetdef->d_SI_CONFIG_BIDIR_OD_DATA_LSB)
297 #define SI_CONFIG_BIDIR_OD_DATA_MASK \
298 	(scn->targetdef->d_SI_CONFIG_BIDIR_OD_DATA_MASK)
299 #define SI_CONFIG_I2C_LSB       (scn->targetdef->d_SI_CONFIG_I2C_LSB)
300 #define SI_CONFIG_I2C_MASK \
301 	(scn->targetdef->d_SI_CONFIG_I2C_MASK)
302 #define SI_CONFIG_POS_SAMPLE_LSB \
303 	(scn->targetdef->d_SI_CONFIG_POS_SAMPLE_LSB)
304 #define SI_CONFIG_POS_SAMPLE_MASK \
305 	(scn->targetdef->d_SI_CONFIG_POS_SAMPLE_MASK)
306 #define SI_CONFIG_INACTIVE_CLK_LSB \
307 	(scn->targetdef->d_SI_CONFIG_INACTIVE_CLK_LSB)
308 #define SI_CONFIG_INACTIVE_CLK_MASK \
309 	(scn->targetdef->d_SI_CONFIG_INACTIVE_CLK_MASK)
310 #define SI_CONFIG_INACTIVE_DATA_LSB \
311 	(scn->targetdef->d_SI_CONFIG_INACTIVE_DATA_LSB)
312 #define SI_CONFIG_INACTIVE_DATA_MASK \
313 	(scn->targetdef->d_SI_CONFIG_INACTIVE_DATA_MASK)
314 #define SI_CONFIG_DIVIDER_LSB   (scn->targetdef->d_SI_CONFIG_DIVIDER_LSB)
315 #define SI_CONFIG_DIVIDER_MASK  (scn->targetdef->d_SI_CONFIG_DIVIDER_MASK)
316 #define SI_BASE_ADDRESS         (scn->targetdef->d_SI_BASE_ADDRESS)
317 #define SI_CONFIG_OFFSET        (scn->targetdef->d_SI_CONFIG_OFFSET)
318 #define SI_TX_DATA0_OFFSET      (scn->targetdef->d_SI_TX_DATA0_OFFSET)
319 #define SI_TX_DATA1_OFFSET      (scn->targetdef->d_SI_TX_DATA1_OFFSET)
320 #define SI_RX_DATA0_OFFSET      (scn->targetdef->d_SI_RX_DATA0_OFFSET)
321 #define SI_RX_DATA1_OFFSET      (scn->targetdef->d_SI_RX_DATA1_OFFSET)
322 #define SI_CS_OFFSET            (scn->targetdef->d_SI_CS_OFFSET)
323 #define SI_CS_DONE_ERR_MASK     (scn->targetdef->d_SI_CS_DONE_ERR_MASK)
324 #define SI_CS_DONE_INT_MASK     (scn->targetdef->d_SI_CS_DONE_INT_MASK)
325 #define SI_CS_START_LSB         (scn->targetdef->d_SI_CS_START_LSB)
326 #define SI_CS_START_MASK        (scn->targetdef->d_SI_CS_START_MASK)
327 #define SI_CS_RX_CNT_LSB        (scn->targetdef->d_SI_CS_RX_CNT_LSB)
328 #define SI_CS_RX_CNT_MASK       (scn->targetdef->d_SI_CS_RX_CNT_MASK)
329 #define SI_CS_TX_CNT_LSB        (scn->targetdef->d_SI_CS_TX_CNT_LSB)
330 #define SI_CS_TX_CNT_MASK       (scn->targetdef->d_SI_CS_TX_CNT_MASK)
331 #define EEPROM_SZ               (scn->targetdef->d_BOARD_DATA_SZ)
332 #define EEPROM_EXT_SZ           (scn->targetdef->d_BOARD_EXT_DATA_SZ)
333 #define MBOX_BASE_ADDRESS       (scn->targetdef->d_MBOX_BASE_ADDRESS)
334 #define LOCAL_SCRATCH_OFFSET    (scn->targetdef->d_LOCAL_SCRATCH_OFFSET)
335 #define CPU_CLOCK_OFFSET        (scn->targetdef->d_CPU_CLOCK_OFFSET)
336 #define LPO_CAL_OFFSET          (scn->targetdef->d_LPO_CAL_OFFSET)
337 #define GPIO_PIN10_OFFSET       (scn->targetdef->d_GPIO_PIN10_OFFSET)
338 #define GPIO_PIN11_OFFSET       (scn->targetdef->d_GPIO_PIN11_OFFSET)
339 #define GPIO_PIN12_OFFSET       (scn->targetdef->d_GPIO_PIN12_OFFSET)
340 #define GPIO_PIN13_OFFSET       (scn->targetdef->d_GPIO_PIN13_OFFSET)
341 #define CLOCK_GPIO_OFFSET       (scn->targetdef->d_CLOCK_GPIO_OFFSET)
342 #define CPU_CLOCK_STANDARD_LSB  (scn->targetdef->d_CPU_CLOCK_STANDARD_LSB)
343 #define CPU_CLOCK_STANDARD_MASK (scn->targetdef->d_CPU_CLOCK_STANDARD_MASK)
344 #define LPO_CAL_ENABLE_LSB      (scn->targetdef->d_LPO_CAL_ENABLE_LSB)
345 #define LPO_CAL_ENABLE_MASK     (scn->targetdef->d_LPO_CAL_ENABLE_MASK)
346 #define CLOCK_GPIO_BT_CLK_OUT_EN_LSB \
347 	(scn->targetdef->d_CLOCK_GPIO_BT_CLK_OUT_EN_LSB)
348 #define CLOCK_GPIO_BT_CLK_OUT_EN_MASK \
349 	(scn->targetdef->d_CLOCK_GPIO_BT_CLK_OUT_EN_MASK)
350 #define ANALOG_INTF_BASE_ADDRESS (scn->targetdef->d_ANALOG_INTF_BASE_ADDRESS)
351 #define WLAN_MAC_BASE_ADDRESS    (scn->targetdef->d_WLAN_MAC_BASE_ADDRESS)
352 #define FW_INDICATOR_ADDRESS     (scn->targetdef->d_FW_INDICATOR_ADDRESS)
353 #define DRAM_BASE_ADDRESS        (scn->targetdef->d_DRAM_BASE_ADDRESS)
354 #define SOC_CORE_BASE_ADDRESS    (scn->targetdef->d_SOC_CORE_BASE_ADDRESS)
355 #define CORE_CTRL_ADDRESS        (scn->targetdef->d_CORE_CTRL_ADDRESS)
356 #define CORE_CTRL_CPU_INTR_MASK  (scn->targetdef->d_CORE_CTRL_CPU_INTR_MASK)
357 #define SOC_RESET_CONTROL_ADDRESS  (scn->targetdef->d_SOC_RESET_CONTROL_ADDRESS)
358 #define SOC_RESET_CONTROL_CPU_WARM_RST_MASK \
359 	(scn->targetdef->d_SOC_RESET_CONTROL_CPU_WARM_RST_MASK)
360 #define CPU_INTR_ADDRESS        (scn->targetdef->d_CPU_INTR_ADDRESS)
361 #define SOC_LF_TIMER_CONTROL0_ADDRESS \
362 	(scn->targetdef->d_SOC_LF_TIMER_CONTROL0_ADDRESS)
363 #define SOC_LF_TIMER_CONTROL0_ENABLE_MASK \
364 	(scn->targetdef->d_SOC_LF_TIMER_CONTROL0_ENABLE_MASK)
365 #define SOC_LF_TIMER_STATUS0_ADDRESS \
366 	(scn->targetdef->d_SOC_LF_TIMER_STATUS0_ADDRESS)
367 
368 
369 #define CHIP_ID_ADDRESS           (scn->targetdef->d_SOC_CHIP_ID_ADDRESS)
370 #define SOC_CHIP_ID_REVISION_MASK (scn->targetdef->d_SOC_CHIP_ID_REVISION_MASK)
371 #define SOC_CHIP_ID_REVISION_LSB  (scn->targetdef->d_SOC_CHIP_ID_REVISION_LSB)
372 #define SOC_CHIP_ID_VERSION_MASK  (scn->targetdef->d_SOC_CHIP_ID_VERSION_MASK)
373 #define SOC_CHIP_ID_VERSION_LSB   (scn->targetdef->d_SOC_CHIP_ID_VERSION_LSB)
374 #define CHIP_ID_REVISION_GET(x) \
375 	(((x) & SOC_CHIP_ID_REVISION_MASK) >> SOC_CHIP_ID_REVISION_LSB)
376 #define CHIP_ID_VERSION_GET(x) \
377 	(((x) & SOC_CHIP_ID_VERSION_MASK) >> SOC_CHIP_ID_VERSION_LSB)
378 
379 /* misc */
380 #define SR_WR_INDEX_ADDRESS     (scn->targetdef->d_SR_WR_INDEX_ADDRESS)
381 #define DST_WATERMARK_ADDRESS   (scn->targetdef->d_DST_WATERMARK_ADDRESS)
382 #define SOC_POWER_REG_OFFSET    (scn->targetdef->d_SOC_POWER_REG_OFFSET)
383 /* end */
384 
385 /* copy_engine.c */
386 /* end */
387 /* PLL start */
388 #define EFUSE_OFFSET              (scn->targetdef->d_EFUSE_OFFSET)
389 #define EFUSE_XTAL_SEL_MSB        (scn->targetdef->d_EFUSE_XTAL_SEL_MSB)
390 #define EFUSE_XTAL_SEL_LSB        (scn->targetdef->d_EFUSE_XTAL_SEL_LSB)
391 #define EFUSE_XTAL_SEL_MASK       (scn->targetdef->d_EFUSE_XTAL_SEL_MASK)
392 #define BB_PLL_CONFIG_OFFSET      (scn->targetdef->d_BB_PLL_CONFIG_OFFSET)
393 #define BB_PLL_CONFIG_OUTDIV_MSB  (scn->targetdef->d_BB_PLL_CONFIG_OUTDIV_MSB)
394 #define BB_PLL_CONFIG_OUTDIV_LSB  (scn->targetdef->d_BB_PLL_CONFIG_OUTDIV_LSB)
395 #define BB_PLL_CONFIG_OUTDIV_MASK (scn->targetdef->d_BB_PLL_CONFIG_OUTDIV_MASK)
396 #define BB_PLL_CONFIG_FRAC_MSB    (scn->targetdef->d_BB_PLL_CONFIG_FRAC_MSB)
397 #define BB_PLL_CONFIG_FRAC_LSB    (scn->targetdef->d_BB_PLL_CONFIG_FRAC_LSB)
398 #define BB_PLL_CONFIG_FRAC_MASK   (scn->targetdef->d_BB_PLL_CONFIG_FRAC_MASK)
399 #define WLAN_PLL_SETTLE_TIME_MSB  (scn->targetdef->d_WLAN_PLL_SETTLE_TIME_MSB)
400 #define WLAN_PLL_SETTLE_TIME_LSB  (scn->targetdef->d_WLAN_PLL_SETTLE_TIME_LSB)
401 #define WLAN_PLL_SETTLE_TIME_MASK (scn->targetdef->d_WLAN_PLL_SETTLE_TIME_MASK)
402 #define WLAN_PLL_SETTLE_OFFSET    (scn->targetdef->d_WLAN_PLL_SETTLE_OFFSET)
403 #define WLAN_PLL_SETTLE_SW_MASK   (scn->targetdef->d_WLAN_PLL_SETTLE_SW_MASK)
404 #define WLAN_PLL_SETTLE_RSTMASK   (scn->targetdef->d_WLAN_PLL_SETTLE_RSTMASK)
405 #define WLAN_PLL_SETTLE_RESET     (scn->targetdef->d_WLAN_PLL_SETTLE_RESET)
406 #define WLAN_PLL_CONTROL_NOPWD_MSB  \
407 	(scn->targetdef->d_WLAN_PLL_CONTROL_NOPWD_MSB)
408 #define WLAN_PLL_CONTROL_NOPWD_LSB  \
409 	(scn->targetdef->d_WLAN_PLL_CONTROL_NOPWD_LSB)
410 #define WLAN_PLL_CONTROL_NOPWD_MASK \
411 	(scn->targetdef->d_WLAN_PLL_CONTROL_NOPWD_MASK)
412 #define WLAN_PLL_CONTROL_BYPASS_MSB \
413 	(scn->targetdef->d_WLAN_PLL_CONTROL_BYPASS_MSB)
414 #define WLAN_PLL_CONTROL_BYPASS_LSB \
415 	(scn->targetdef->d_WLAN_PLL_CONTROL_BYPASS_LSB)
416 #define WLAN_PLL_CONTROL_BYPASS_MASK \
417 	(scn->targetdef->d_WLAN_PLL_CONTROL_BYPASS_MASK)
418 #define WLAN_PLL_CONTROL_BYPASS_RESET \
419 	(scn->targetdef->d_WLAN_PLL_CONTROL_BYPASS_RESET)
420 #define WLAN_PLL_CONTROL_CLK_SEL_MSB \
421 	(scn->targetdef->d_WLAN_PLL_CONTROL_CLK_SEL_MSB)
422 #define WLAN_PLL_CONTROL_CLK_SEL_LSB \
423 	(scn->targetdef->d_WLAN_PLL_CONTROL_CLK_SEL_LSB)
424 #define WLAN_PLL_CONTROL_CLK_SEL_MASK \
425 	(scn->targetdef->d_WLAN_PLL_CONTROL_CLK_SEL_MASK)
426 #define WLAN_PLL_CONTROL_CLK_SEL_RESET \
427 	(scn->targetdef->d_WLAN_PLL_CONTROL_CLK_SEL_RESET)
428 #define WLAN_PLL_CONTROL_REFDIV_MSB \
429 	(scn->targetdef->d_WLAN_PLL_CONTROL_REFDIV_MSB)
430 #define WLAN_PLL_CONTROL_REFDIV_LSB \
431 	(scn->targetdef->d_WLAN_PLL_CONTROL_REFDIV_LSB)
432 #define WLAN_PLL_CONTROL_REFDIV_MASK \
433 	(scn->targetdef->d_WLAN_PLL_CONTROL_REFDIV_MASK)
434 #define WLAN_PLL_CONTROL_REFDIV_RESET \
435 	(scn->targetdef->d_WLAN_PLL_CONTROL_REFDIV_RESET)
436 #define WLAN_PLL_CONTROL_DIV_MSB   (scn->targetdef->d_WLAN_PLL_CONTROL_DIV_MSB)
437 #define WLAN_PLL_CONTROL_DIV_LSB   (scn->targetdef->d_WLAN_PLL_CONTROL_DIV_LSB)
438 #define WLAN_PLL_CONTROL_DIV_MASK  (scn->targetdef->d_WLAN_PLL_CONTROL_DIV_MASK)
439 #define WLAN_PLL_CONTROL_DIV_RESET \
440 	(scn->targetdef->d_WLAN_PLL_CONTROL_DIV_RESET)
441 #define WLAN_PLL_CONTROL_OFFSET    (scn->targetdef->d_WLAN_PLL_CONTROL_OFFSET)
442 #define WLAN_PLL_CONTROL_SW_MASK   (scn->targetdef->d_WLAN_PLL_CONTROL_SW_MASK)
443 #define WLAN_PLL_CONTROL_RSTMASK   (scn->targetdef->d_WLAN_PLL_CONTROL_RSTMASK)
444 #define WLAN_PLL_CONTROL_RESET     (scn->targetdef->d_WLAN_PLL_CONTROL_RESET)
445 #define SOC_CORE_CLK_CTRL_OFFSET   (scn->targetdef->d_SOC_CORE_CLK_CTRL_OFFSET)
446 #define SOC_CORE_CLK_CTRL_DIV_MSB  (scn->targetdef->d_SOC_CORE_CLK_CTRL_DIV_MSB)
447 #define SOC_CORE_CLK_CTRL_DIV_LSB  (scn->targetdef->d_SOC_CORE_CLK_CTRL_DIV_LSB)
448 #define SOC_CORE_CLK_CTRL_DIV_MASK \
449 	(scn->targetdef->d_SOC_CORE_CLK_CTRL_DIV_MASK)
450 #define RTC_SYNC_STATUS_PLL_CHANGING_MSB \
451 	(scn->targetdef->d_RTC_SYNC_STATUS_PLL_CHANGING_MSB)
452 #define RTC_SYNC_STATUS_PLL_CHANGING_LSB \
453 	(scn->targetdef->d_RTC_SYNC_STATUS_PLL_CHANGING_LSB)
454 #define RTC_SYNC_STATUS_PLL_CHANGING_MASK \
455 	(scn->targetdef->d_RTC_SYNC_STATUS_PLL_CHANGING_MASK)
456 #define RTC_SYNC_STATUS_PLL_CHANGING_RESET \
457 	(scn->targetdef->d_RTC_SYNC_STATUS_PLL_CHANGING_RESET)
458 #define RTC_SYNC_STATUS_OFFSET      (scn->targetdef->d_RTC_SYNC_STATUS_OFFSET)
459 #define SOC_CPU_CLOCK_OFFSET        (scn->targetdef->d_SOC_CPU_CLOCK_OFFSET)
460 #define SOC_CPU_CLOCK_STANDARD_MSB \
461 	(scn->targetdef->d_SOC_CPU_CLOCK_STANDARD_MSB)
462 #define SOC_CPU_CLOCK_STANDARD_LSB \
463 	(scn->targetdef->d_SOC_CPU_CLOCK_STANDARD_LSB)
464 #define SOC_CPU_CLOCK_STANDARD_MASK \
465 	(scn->targetdef->d_SOC_CPU_CLOCK_STANDARD_MASK)
466 /* PLL end */
467 
468 /* SET macros */
469 #define WLAN_SYSTEM_SLEEP_DISABLE_SET(x) \
470 	(((x) << WLAN_SYSTEM_SLEEP_DISABLE_LSB) & \
471 	    WLAN_SYSTEM_SLEEP_DISABLE_MASK)
472 #define SI_CONFIG_BIDIR_OD_DATA_SET(x) \
473 	(((x) << SI_CONFIG_BIDIR_OD_DATA_LSB) & SI_CONFIG_BIDIR_OD_DATA_MASK)
474 #define SI_CONFIG_I2C_SET(x)  (((x) << SI_CONFIG_I2C_LSB) & SI_CONFIG_I2C_MASK)
475 #define SI_CONFIG_POS_SAMPLE_SET(x) \
476 	(((x) << SI_CONFIG_POS_SAMPLE_LSB) & SI_CONFIG_POS_SAMPLE_MASK)
477 #define SI_CONFIG_INACTIVE_CLK_SET(x) \
478 	(((x) << SI_CONFIG_INACTIVE_CLK_LSB) & SI_CONFIG_INACTIVE_CLK_MASK)
479 #define SI_CONFIG_INACTIVE_DATA_SET(x) \
480 	(((x) << SI_CONFIG_INACTIVE_DATA_LSB) & SI_CONFIG_INACTIVE_DATA_MASK)
481 #define SI_CONFIG_DIVIDER_SET(x) \
482 	(((x) << SI_CONFIG_DIVIDER_LSB) & SI_CONFIG_DIVIDER_MASK)
483 #define SI_CS_START_SET(x)  (((x) << SI_CS_START_LSB) & SI_CS_START_MASK)
484 #define SI_CS_RX_CNT_SET(x) (((x) << SI_CS_RX_CNT_LSB) & SI_CS_RX_CNT_MASK)
485 #define SI_CS_TX_CNT_SET(x) (((x) << SI_CS_TX_CNT_LSB) & SI_CS_TX_CNT_MASK)
486 #define LPO_CAL_ENABLE_SET(x) \
487 	(((x) << LPO_CAL_ENABLE_LSB) & LPO_CAL_ENABLE_MASK)
488 #define CPU_CLOCK_STANDARD_SET(x) \
489 	(((x) << CPU_CLOCK_STANDARD_LSB) & CPU_CLOCK_STANDARD_MASK)
490 #define CLOCK_GPIO_BT_CLK_OUT_EN_SET(x) \
491 	(((x) << CLOCK_GPIO_BT_CLK_OUT_EN_LSB) & CLOCK_GPIO_BT_CLK_OUT_EN_MASK)
492 /* copy_engine.c */
493 /* end */
494 /* PLL start */
495 #define EFUSE_XTAL_SEL_GET(x) \
496 	(((x) & EFUSE_XTAL_SEL_MASK) >> EFUSE_XTAL_SEL_LSB)
497 #define EFUSE_XTAL_SEL_SET(x) \
498 	(((x) << EFUSE_XTAL_SEL_LSB) & EFUSE_XTAL_SEL_MASK)
499 #define BB_PLL_CONFIG_OUTDIV_GET(x) \
500 	(((x) & BB_PLL_CONFIG_OUTDIV_MASK) >> BB_PLL_CONFIG_OUTDIV_LSB)
501 #define BB_PLL_CONFIG_OUTDIV_SET(x) \
502 	(((x) << BB_PLL_CONFIG_OUTDIV_LSB) & BB_PLL_CONFIG_OUTDIV_MASK)
503 #define BB_PLL_CONFIG_FRAC_GET(x) \
504 	(((x) & BB_PLL_CONFIG_FRAC_MASK) >> BB_PLL_CONFIG_FRAC_LSB)
505 #define BB_PLL_CONFIG_FRAC_SET(x) \
506 	(((x) << BB_PLL_CONFIG_FRAC_LSB) & BB_PLL_CONFIG_FRAC_MASK)
507 #define WLAN_PLL_SETTLE_TIME_GET(x) \
508 	(((x) & WLAN_PLL_SETTLE_TIME_MASK) >> WLAN_PLL_SETTLE_TIME_LSB)
509 #define WLAN_PLL_SETTLE_TIME_SET(x) \
510 	(((x) << WLAN_PLL_SETTLE_TIME_LSB) & WLAN_PLL_SETTLE_TIME_MASK)
511 #define WLAN_PLL_CONTROL_NOPWD_GET(x) \
512 	(((x) & WLAN_PLL_CONTROL_NOPWD_MASK) >> WLAN_PLL_CONTROL_NOPWD_LSB)
513 #define WLAN_PLL_CONTROL_NOPWD_SET(x) \
514 	(((x) << WLAN_PLL_CONTROL_NOPWD_LSB) & WLAN_PLL_CONTROL_NOPWD_MASK)
515 #define WLAN_PLL_CONTROL_BYPASS_GET(x) \
516 	(((x) & WLAN_PLL_CONTROL_BYPASS_MASK) >> WLAN_PLL_CONTROL_BYPASS_LSB)
517 #define WLAN_PLL_CONTROL_BYPASS_SET(x) \
518 	(((x) << WLAN_PLL_CONTROL_BYPASS_LSB) & WLAN_PLL_CONTROL_BYPASS_MASK)
519 #define WLAN_PLL_CONTROL_CLK_SEL_GET(x) \
520 	(((x) & WLAN_PLL_CONTROL_CLK_SEL_MASK) >> WLAN_PLL_CONTROL_CLK_SEL_LSB)
521 #define WLAN_PLL_CONTROL_CLK_SEL_SET(x) \
522 	(((x) << WLAN_PLL_CONTROL_CLK_SEL_LSB) & WLAN_PLL_CONTROL_CLK_SEL_MASK)
523 #define WLAN_PLL_CONTROL_REFDIV_GET(x) \
524 	(((x) & WLAN_PLL_CONTROL_REFDIV_MASK) >> WLAN_PLL_CONTROL_REFDIV_LSB)
525 #define WLAN_PLL_CONTROL_REFDIV_SET(x) \
526 	(((x) << WLAN_PLL_CONTROL_REFDIV_LSB) & WLAN_PLL_CONTROL_REFDIV_MASK)
527 #define WLAN_PLL_CONTROL_DIV_GET(x) \
528 	(((x) & WLAN_PLL_CONTROL_DIV_MASK) >> WLAN_PLL_CONTROL_DIV_LSB)
529 #define WLAN_PLL_CONTROL_DIV_SET(x) \
530 	(((x) << WLAN_PLL_CONTROL_DIV_LSB) & WLAN_PLL_CONTROL_DIV_MASK)
531 #define SOC_CORE_CLK_CTRL_DIV_GET(x) \
532 	(((x) & SOC_CORE_CLK_CTRL_DIV_MASK) >> SOC_CORE_CLK_CTRL_DIV_LSB)
533 #define SOC_CORE_CLK_CTRL_DIV_SET(x) \
534 	(((x) << SOC_CORE_CLK_CTRL_DIV_LSB) & SOC_CORE_CLK_CTRL_DIV_MASK)
535 #define RTC_SYNC_STATUS_PLL_CHANGING_GET(x) \
536 	(((x) & RTC_SYNC_STATUS_PLL_CHANGING_MASK) >> \
537 		RTC_SYNC_STATUS_PLL_CHANGING_LSB)
538 #define RTC_SYNC_STATUS_PLL_CHANGING_SET(x) \
539 	(((x) << RTC_SYNC_STATUS_PLL_CHANGING_LSB) & \
540 		RTC_SYNC_STATUS_PLL_CHANGING_MASK)
541 #define SOC_CPU_CLOCK_STANDARD_GET(x) \
542 	(((x) & SOC_CPU_CLOCK_STANDARD_MASK) >> SOC_CPU_CLOCK_STANDARD_LSB)
543 #define SOC_CPU_CLOCK_STANDARD_SET(x) \
544 	(((x) << SOC_CPU_CLOCK_STANDARD_LSB) & SOC_CPU_CLOCK_STANDARD_MASK)
545 /* PLL end */
546 
547 #ifdef QCA_WIFI_3_0_ADRASTEA
548 #define Q6_ENABLE_REGISTER_0 \
549 	(scn->targetdef->d_Q6_ENABLE_REGISTER_0)
550 #define Q6_ENABLE_REGISTER_1 \
551 	(scn->targetdef->d_Q6_ENABLE_REGISTER_1)
552 #define Q6_CAUSE_REGISTER_0 \
553 	(scn->targetdef->d_Q6_CAUSE_REGISTER_0)
554 #define Q6_CAUSE_REGISTER_1 \
555 	(scn->targetdef->d_Q6_CAUSE_REGISTER_1)
556 #define Q6_CLEAR_REGISTER_0 \
557 	(scn->targetdef->d_Q6_CLEAR_REGISTER_0)
558 #define Q6_CLEAR_REGISTER_1 \
559 	(scn->targetdef->d_Q6_CLEAR_REGISTER_1)
560 #endif
561 
562 struct hostdef_s {
563 	uint32_t d_INT_STATUS_ENABLE_ERROR_LSB;
564 	uint32_t d_INT_STATUS_ENABLE_ERROR_MASK;
565 	uint32_t d_INT_STATUS_ENABLE_CPU_LSB;
566 	uint32_t d_INT_STATUS_ENABLE_CPU_MASK;
567 	uint32_t d_INT_STATUS_ENABLE_COUNTER_LSB;
568 	uint32_t d_INT_STATUS_ENABLE_COUNTER_MASK;
569 	uint32_t d_INT_STATUS_ENABLE_MBOX_DATA_LSB;
570 	uint32_t d_INT_STATUS_ENABLE_MBOX_DATA_MASK;
571 	uint32_t d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB;
572 	uint32_t d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK;
573 	uint32_t d_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB;
574 	uint32_t d_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK;
575 	uint32_t d_COUNTER_INT_STATUS_ENABLE_BIT_LSB;
576 	uint32_t d_COUNTER_INT_STATUS_ENABLE_BIT_MASK;
577 	uint32_t d_INT_STATUS_ENABLE_ADDRESS;
578 	uint32_t d_CPU_INT_STATUS_ENABLE_BIT_LSB;
579 	uint32_t d_CPU_INT_STATUS_ENABLE_BIT_MASK;
580 	uint32_t d_HOST_INT_STATUS_ADDRESS;
581 	uint32_t d_CPU_INT_STATUS_ADDRESS;
582 	uint32_t d_ERROR_INT_STATUS_ADDRESS;
583 	uint32_t d_ERROR_INT_STATUS_WAKEUP_MASK;
584 	uint32_t d_ERROR_INT_STATUS_WAKEUP_LSB;
585 	uint32_t d_ERROR_INT_STATUS_RX_UNDERFLOW_MASK;
586 	uint32_t d_ERROR_INT_STATUS_RX_UNDERFLOW_LSB;
587 	uint32_t d_ERROR_INT_STATUS_TX_OVERFLOW_MASK;
588 	uint32_t d_ERROR_INT_STATUS_TX_OVERFLOW_LSB;
589 	uint32_t d_COUNT_DEC_ADDRESS;
590 	uint32_t d_HOST_INT_STATUS_CPU_MASK;
591 	uint32_t d_HOST_INT_STATUS_CPU_LSB;
592 	uint32_t d_HOST_INT_STATUS_ERROR_MASK;
593 	uint32_t d_HOST_INT_STATUS_ERROR_LSB;
594 	uint32_t d_HOST_INT_STATUS_COUNTER_MASK;
595 	uint32_t d_HOST_INT_STATUS_COUNTER_LSB;
596 	uint32_t d_RX_LOOKAHEAD_VALID_ADDRESS;
597 	uint32_t d_WINDOW_DATA_ADDRESS;
598 	uint32_t d_WINDOW_READ_ADDR_ADDRESS;
599 	uint32_t d_WINDOW_WRITE_ADDR_ADDRESS;
600 	uint32_t d_SOC_GLOBAL_RESET_ADDRESS;
601 	uint32_t d_RTC_STATE_ADDRESS;
602 	uint32_t d_RTC_STATE_COLD_RESET_MASK;
603 	uint32_t d_RTC_STATE_V_MASK;
604 	uint32_t d_RTC_STATE_V_LSB;
605 	uint32_t d_FW_IND_EVENT_PENDING;
606 	uint32_t d_FW_IND_INITIALIZED;
607 	uint32_t d_FW_IND_HELPER;
608 	uint32_t d_RTC_STATE_V_ON;
609 #if defined(SDIO_3_0)
610 	uint32_t d_HOST_INT_STATUS_MBOX_DATA_MASK;
611 	uint32_t d_HOST_INT_STATUS_MBOX_DATA_LSB;
612 #endif
613 	uint32_t d_MSI_MAGIC_ADR_ADDRESS;
614 	uint32_t d_MSI_MAGIC_ADDRESS;
615 	uint32_t d_ENABLE_MSI;
616 	uint32_t d_MUX_ID_MASK;
617 	uint32_t d_TRANSACTION_ID_MASK;
618 	uint32_t d_DESC_DATA_FLAG_MASK;
619 };
620 #define DESC_DATA_FLAG_MASK        (scn->hostdef->d_DESC_DATA_FLAG_MASK)
621 #define MUX_ID_MASK                (scn->hostdef->d_MUX_ID_MASK)
622 #define TRANSACTION_ID_MASK        (scn->hostdef->d_TRANSACTION_ID_MASK)
623 #define ENABLE_MSI                 (scn->hostdef->d_ENABLE_MSI)
624 #define INT_STATUS_ENABLE_ERROR_LSB \
625 	(scn->hostdef->d_INT_STATUS_ENABLE_ERROR_LSB)
626 #define INT_STATUS_ENABLE_ERROR_MASK \
627 	(scn->hostdef->d_INT_STATUS_ENABLE_ERROR_MASK)
628 #define INT_STATUS_ENABLE_CPU_LSB  (scn->hostdef->d_INT_STATUS_ENABLE_CPU_LSB)
629 #define INT_STATUS_ENABLE_CPU_MASK (scn->hostdef->d_INT_STATUS_ENABLE_CPU_MASK)
630 #define INT_STATUS_ENABLE_COUNTER_LSB \
631 	(scn->hostdef->d_INT_STATUS_ENABLE_COUNTER_LSB)
632 #define INT_STATUS_ENABLE_COUNTER_MASK \
633 	(scn->hostdef->d_INT_STATUS_ENABLE_COUNTER_MASK)
634 #define INT_STATUS_ENABLE_MBOX_DATA_LSB \
635 	(scn->hostdef->d_INT_STATUS_ENABLE_MBOX_DATA_LSB)
636 #define INT_STATUS_ENABLE_MBOX_DATA_MASK \
637 	(scn->hostdef->d_INT_STATUS_ENABLE_MBOX_DATA_MASK)
638 #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB \
639 	(scn->hostdef->d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB)
640 #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK \
641 	(scn->hostdef->d_ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK)
642 #define ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB \
643 	(scn->hostdef->d_ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB)
644 #define ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK \
645 	(scn->hostdef->d_ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK)
646 #define COUNTER_INT_STATUS_ENABLE_BIT_LSB \
647 	(scn->hostdef->d_COUNTER_INT_STATUS_ENABLE_BIT_LSB)
648 #define COUNTER_INT_STATUS_ENABLE_BIT_MASK \
649 	(scn->hostdef->d_COUNTER_INT_STATUS_ENABLE_BIT_MASK)
650 #define INT_STATUS_ENABLE_ADDRESS \
651 	(scn->hostdef->d_INT_STATUS_ENABLE_ADDRESS)
652 #define CPU_INT_STATUS_ENABLE_BIT_LSB \
653 	(scn->hostdef->d_CPU_INT_STATUS_ENABLE_BIT_LSB)
654 #define CPU_INT_STATUS_ENABLE_BIT_MASK \
655 	(scn->hostdef->d_CPU_INT_STATUS_ENABLE_BIT_MASK)
656 #define HOST_INT_STATUS_ADDRESS     (scn->hostdef->d_HOST_INT_STATUS_ADDRESS)
657 #define CPU_INT_STATUS_ADDRESS      (scn->hostdef->d_CPU_INT_STATUS_ADDRESS)
658 #define ERROR_INT_STATUS_ADDRESS    (scn->hostdef->d_ERROR_INT_STATUS_ADDRESS)
659 #define ERROR_INT_STATUS_WAKEUP_MASK \
660 	(scn->hostdef->d_ERROR_INT_STATUS_WAKEUP_MASK)
661 #define ERROR_INT_STATUS_WAKEUP_LSB \
662 	(scn->hostdef->d_ERROR_INT_STATUS_WAKEUP_LSB)
663 #define ERROR_INT_STATUS_RX_UNDERFLOW_MASK \
664 	(scn->hostdef->d_ERROR_INT_STATUS_RX_UNDERFLOW_MASK)
665 #define ERROR_INT_STATUS_RX_UNDERFLOW_LSB \
666 	(scn->hostdef->d_ERROR_INT_STATUS_RX_UNDERFLOW_LSB)
667 #define ERROR_INT_STATUS_TX_OVERFLOW_MASK \
668 	(scn->hostdef->d_ERROR_INT_STATUS_TX_OVERFLOW_MASK)
669 #define ERROR_INT_STATUS_TX_OVERFLOW_LSB \
670 	(scn->hostdef->d_ERROR_INT_STATUS_TX_OVERFLOW_LSB)
671 #define COUNT_DEC_ADDRESS          (scn->hostdef->d_COUNT_DEC_ADDRESS)
672 #define HOST_INT_STATUS_CPU_MASK   (scn->hostdef->d_HOST_INT_STATUS_CPU_MASK)
673 #define HOST_INT_STATUS_CPU_LSB    (scn->hostdef->d_HOST_INT_STATUS_CPU_LSB)
674 #define HOST_INT_STATUS_ERROR_MASK (scn->hostdef->d_HOST_INT_STATUS_ERROR_MASK)
675 #define HOST_INT_STATUS_ERROR_LSB  (scn->hostdef->d_HOST_INT_STATUS_ERROR_LSB)
676 #define HOST_INT_STATUS_COUNTER_MASK \
677 	(scn->hostdef->d_HOST_INT_STATUS_COUNTER_MASK)
678 #define HOST_INT_STATUS_COUNTER_LSB \
679 	(scn->hostdef->d_HOST_INT_STATUS_COUNTER_LSB)
680 #define RX_LOOKAHEAD_VALID_ADDRESS (scn->hostdef->d_RX_LOOKAHEAD_VALID_ADDRESS)
681 #define WINDOW_DATA_ADDRESS        (scn->hostdef->d_WINDOW_DATA_ADDRESS)
682 #define WINDOW_READ_ADDR_ADDRESS   (scn->hostdef->d_WINDOW_READ_ADDR_ADDRESS)
683 #define WINDOW_WRITE_ADDR_ADDRESS  (scn->hostdef->d_WINDOW_WRITE_ADDR_ADDRESS)
684 #define SOC_GLOBAL_RESET_ADDRESS   (scn->hostdef->d_SOC_GLOBAL_RESET_ADDRESS)
685 #define RTC_STATE_ADDRESS          (scn->hostdef->d_RTC_STATE_ADDRESS)
686 #define RTC_STATE_COLD_RESET_MASK  (scn->hostdef->d_RTC_STATE_COLD_RESET_MASK)
687 #define RTC_STATE_V_MASK           (scn->hostdef->d_RTC_STATE_V_MASK)
688 #define RTC_STATE_V_LSB            (scn->hostdef->d_RTC_STATE_V_LSB)
689 #define FW_IND_EVENT_PENDING       (scn->hostdef->d_FW_IND_EVENT_PENDING)
690 #define FW_IND_INITIALIZED         (scn->hostdef->d_FW_IND_INITIALIZED)
691 #define FW_IND_HELPER              (scn->hostdef->d_FW_IND_HELPER)
692 #define RTC_STATE_V_ON             (scn->hostdef->d_RTC_STATE_V_ON)
693 #if defined(SDIO_3_0)
694 #define HOST_INT_STATUS_MBOX_DATA_MASK \
695 	(scn->hostdef->d_HOST_INT_STATUS_MBOX_DATA_MASK)
696 #define HOST_INT_STATUS_MBOX_DATA_LSB \
697 	(scn->hostdef->d_HOST_INT_STATUS_MBOX_DATA_LSB)
698 #endif
699 
700 #if !defined(MSI_MAGIC_ADR_ADDRESS)
701 #define MSI_MAGIC_ADR_ADDRESS 0
702 #define MSI_MAGIC_ADDRESS 0
703 #endif
704 
705 /* SET/GET macros */
706 #define INT_STATUS_ENABLE_ERROR_SET(x) \
707 	(((x) << INT_STATUS_ENABLE_ERROR_LSB) & INT_STATUS_ENABLE_ERROR_MASK)
708 #define INT_STATUS_ENABLE_CPU_SET(x) \
709 	(((x) << INT_STATUS_ENABLE_CPU_LSB) & INT_STATUS_ENABLE_CPU_MASK)
710 #define INT_STATUS_ENABLE_COUNTER_SET(x) \
711 	(((x) << INT_STATUS_ENABLE_COUNTER_LSB) & \
712 		INT_STATUS_ENABLE_COUNTER_MASK)
713 #define INT_STATUS_ENABLE_MBOX_DATA_SET(x) \
714 	(((x) << INT_STATUS_ENABLE_MBOX_DATA_LSB) & \
715 	 INT_STATUS_ENABLE_MBOX_DATA_MASK)
716 #define CPU_INT_STATUS_ENABLE_BIT_SET(x) \
717 	(((x) << CPU_INT_STATUS_ENABLE_BIT_LSB) & \
718 		CPU_INT_STATUS_ENABLE_BIT_MASK)
719 #define ERROR_STATUS_ENABLE_RX_UNDERFLOW_SET(x) \
720 	(((x) << ERROR_STATUS_ENABLE_RX_UNDERFLOW_LSB) & \
721 		ERROR_STATUS_ENABLE_RX_UNDERFLOW_MASK)
722 #define ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(x) \
723 	(((x) << ERROR_STATUS_ENABLE_TX_OVERFLOW_LSB) & \
724 		ERROR_STATUS_ENABLE_TX_OVERFLOW_MASK)
725 #define COUNTER_INT_STATUS_ENABLE_BIT_SET(x) \
726 	(((x) << COUNTER_INT_STATUS_ENABLE_BIT_LSB) & \
727 		COUNTER_INT_STATUS_ENABLE_BIT_MASK)
728 #define ERROR_INT_STATUS_WAKEUP_GET(x) \
729 	(((x) & ERROR_INT_STATUS_WAKEUP_MASK) >> \
730 		ERROR_INT_STATUS_WAKEUP_LSB)
731 #define ERROR_INT_STATUS_RX_UNDERFLOW_GET(x) \
732 	(((x) & ERROR_INT_STATUS_RX_UNDERFLOW_MASK) >> \
733 		ERROR_INT_STATUS_RX_UNDERFLOW_LSB)
734 #define ERROR_INT_STATUS_TX_OVERFLOW_GET(x) \
735 	(((x) & ERROR_INT_STATUS_TX_OVERFLOW_MASK) >> \
736 		ERROR_INT_STATUS_TX_OVERFLOW_LSB)
737 #define HOST_INT_STATUS_CPU_GET(x) \
738 	(((x) & HOST_INT_STATUS_CPU_MASK) >> HOST_INT_STATUS_CPU_LSB)
739 #define HOST_INT_STATUS_ERROR_GET(x) \
740 	(((x) & HOST_INT_STATUS_ERROR_MASK) >> HOST_INT_STATUS_ERROR_LSB)
741 #define HOST_INT_STATUS_COUNTER_GET(x) \
742 	(((x) & HOST_INT_STATUS_COUNTER_MASK) >> HOST_INT_STATUS_COUNTER_LSB)
743 #define RTC_STATE_V_GET(x) \
744 	(((x) & RTC_STATE_V_MASK) >> RTC_STATE_V_LSB)
745 #if defined(SDIO_3_0)
746 #define HOST_INT_STATUS_MBOX_DATA_GET(x) \
747 	(((x) & HOST_INT_STATUS_MBOX_DATA_MASK) >> \
748 		HOST_INT_STATUS_MBOX_DATA_LSB)
749 #endif
750 
751 #define INVALID_REG_LOC_DUMMY_DATA 0xAA
752 
753 #define AR6320_CORE_CLK_DIV_ADDR        0x403fa8
754 #define AR6320_CPU_PLL_INIT_DONE_ADDR   0x403fd0
755 #define AR6320_CPU_SPEED_ADDR           0x403fa4
756 #define AR6320V2_CORE_CLK_DIV_ADDR      0x403fd8
757 #define AR6320V2_CPU_PLL_INIT_DONE_ADDR 0x403fd0
758 #define AR6320V2_CPU_SPEED_ADDR         0x403fd4
759 #define AR6320V3_CORE_CLK_DIV_ADDR      0x404028
760 #define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
761 #define AR6320V3_CPU_SPEED_ADDR         0x404024
762 
763 enum a_refclk_speed_t {
764 	SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */
765 	SOC_REFCLK_48_MHZ = 0,
766 	SOC_REFCLK_19_2_MHZ = 1,
767 	SOC_REFCLK_24_MHZ = 2,
768 	SOC_REFCLK_26_MHZ = 3,
769 	SOC_REFCLK_37_4_MHZ = 4,
770 	SOC_REFCLK_38_4_MHZ = 5,
771 	SOC_REFCLK_40_MHZ = 6,
772 	SOC_REFCLK_52_MHZ = 7,
773 };
774 
775 #define A_REFCLK_UNKNOWN    SOC_REFCLK_UNKNOWN
776 #define A_REFCLK_48_MHZ     SOC_REFCLK_48_MHZ
777 #define A_REFCLK_19_2_MHZ   SOC_REFCLK_19_2_MHZ
778 #define A_REFCLK_24_MHZ     SOC_REFCLK_24_MHZ
779 #define A_REFCLK_26_MHZ     SOC_REFCLK_26_MHZ
780 #define A_REFCLK_37_4_MHZ   SOC_REFCLK_37_4_MHZ
781 #define A_REFCLK_38_4_MHZ   SOC_REFCLK_38_4_MHZ
782 #define A_REFCLK_40_MHZ     SOC_REFCLK_40_MHZ
783 #define A_REFCLK_52_MHZ     SOC_REFCLK_52_MHZ
784 
785 #define TARGET_CPU_FREQ 176000000
786 
787 struct wlan_pll_s {
788 	uint32_t refdiv;
789 	uint32_t div;
790 	uint32_t rnfrac;
791 	uint32_t outdiv;
792 };
793 
794 struct cmnos_clock_s {
795 	enum a_refclk_speed_t refclk_speed;
796 	uint32_t refclk_hz;
797 	uint32_t pll_settling_time;     /* 50us */
798 	struct wlan_pll_s wlan_pll;
799 };
800 
801 struct tgt_reg_section {
802 	uint32_t start_addr;
803 	uint32_t end_addr;
804 };
805 
806 
807 struct tgt_reg_table {
808 	const struct tgt_reg_section *section;
809 	uint32_t section_size;
810 };
811 #endif /* _REGTABLE_SDIO_H_ */
812