1b7d5e03cSMatthew Dillon /*
2b7d5e03cSMatthew Dillon * Copyright (c) 2013 Qualcomm Atheros, Inc.
3b7d5e03cSMatthew Dillon *
4b7d5e03cSMatthew Dillon * Permission to use, copy, modify, and/or distribute this software for any
5b7d5e03cSMatthew Dillon * purpose with or without fee is hereby granted, provided that the above
6b7d5e03cSMatthew Dillon * copyright notice and this permission notice appear in all copies.
7b7d5e03cSMatthew Dillon *
8b7d5e03cSMatthew Dillon * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9b7d5e03cSMatthew Dillon * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10b7d5e03cSMatthew Dillon * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11b7d5e03cSMatthew Dillon * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12b7d5e03cSMatthew Dillon * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13b7d5e03cSMatthew Dillon * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14b7d5e03cSMatthew Dillon * PERFORMANCE OF THIS SOFTWARE.
15b7d5e03cSMatthew Dillon */
16b7d5e03cSMatthew Dillon
17b7d5e03cSMatthew Dillon #include "opt_ah.h"
18b7d5e03cSMatthew Dillon
19b7d5e03cSMatthew Dillon #include "ah.h"
20b7d5e03cSMatthew Dillon #include "ah_internal.h"
21b7d5e03cSMatthew Dillon #include "ah_devid.h"
22b7d5e03cSMatthew Dillon
23b7d5e03cSMatthew Dillon #include "ar9300/ar9300desc.h"
24b7d5e03cSMatthew Dillon #include "ar9300/ar9300.h"
25b7d5e03cSMatthew Dillon #include "ar9300/ar9300reg.h"
26b7d5e03cSMatthew Dillon #include "ar9300/ar9300phy.h"
27b7d5e03cSMatthew Dillon #include "ar9300/ar9300paprd.h"
28b7d5e03cSMatthew Dillon
29b7d5e03cSMatthew Dillon #include "ar9300/ar9300_stub.h"
30b7d5e03cSMatthew Dillon #include "ar9300/ar9300_stub_funcs.h"
31b7d5e03cSMatthew Dillon
32b7d5e03cSMatthew Dillon
33b7d5e03cSMatthew Dillon /* Add static register initialization vectors */
34b7d5e03cSMatthew Dillon #include "ar9300/ar9300_osprey22.ini"
35b7d5e03cSMatthew Dillon #include "ar9300/ar9330_11.ini"
36b7d5e03cSMatthew Dillon #include "ar9300/ar9330_12.ini"
37b7d5e03cSMatthew Dillon #include "ar9300/ar9340.ini"
38b7d5e03cSMatthew Dillon #include "ar9300/ar9485.ini"
39b7d5e03cSMatthew Dillon #include "ar9300/ar9485_1_1.ini"
40b7d5e03cSMatthew Dillon #include "ar9300/ar9300_jupiter10.ini"
41b7d5e03cSMatthew Dillon #include "ar9300/ar9300_jupiter20.ini"
42*a20e5e51SMatthew Dillon #include "ar9300/ar9462_2p1_initvals.h"
43b7d5e03cSMatthew Dillon #include "ar9300/ar9580.ini"
44b7d5e03cSMatthew Dillon #include "ar9300/ar955x.ini"
45*a20e5e51SMatthew Dillon #include "ar9300/ar953x.ini"
46b7d5e03cSMatthew Dillon #include "ar9300/ar9300_aphrodite10.ini"
47b7d5e03cSMatthew Dillon
48b7d5e03cSMatthew Dillon
49b7d5e03cSMatthew Dillon /* Include various freebsd specific HAL methods */
50b7d5e03cSMatthew Dillon #include "ar9300/ar9300_freebsd.h"
51b7d5e03cSMatthew Dillon
52b7d5e03cSMatthew Dillon /* XXX duplicate in ar9300_radio.c ? */
53b7d5e03cSMatthew Dillon static HAL_BOOL ar9300_get_chip_power_limits(struct ath_hal *ah,
54b7d5e03cSMatthew Dillon struct ieee80211_channel *chan);
55b7d5e03cSMatthew Dillon
56b7d5e03cSMatthew Dillon static inline HAL_STATUS ar9300_init_mac_addr(struct ath_hal *ah);
57b7d5e03cSMatthew Dillon static inline HAL_STATUS ar9300_hw_attach(struct ath_hal *ah);
58b7d5e03cSMatthew Dillon static inline void ar9300_hw_detach(struct ath_hal *ah);
59b7d5e03cSMatthew Dillon static int16_t ar9300_get_nf_adjust(struct ath_hal *ah,
60b7d5e03cSMatthew Dillon const HAL_CHANNEL_INTERNAL *c);
61b7d5e03cSMatthew Dillon #if 0
62b7d5e03cSMatthew Dillon int ar9300_get_cal_intervals(struct ath_hal *ah, HAL_CALIBRATION_TIMER **timerp,
63b7d5e03cSMatthew Dillon HAL_CAL_QUERY query);
64b7d5e03cSMatthew Dillon #endif
65b7d5e03cSMatthew Dillon
66b7d5e03cSMatthew Dillon #if ATH_TRAFFIC_FAST_RECOVER
67b7d5e03cSMatthew Dillon unsigned long ar9300_get_pll3_sqsum_dvc(struct ath_hal *ah);
68b7d5e03cSMatthew Dillon #endif
69b7d5e03cSMatthew Dillon static int ar9300_init_offsets(struct ath_hal *ah, u_int16_t devid);
70b7d5e03cSMatthew Dillon
71b7d5e03cSMatthew Dillon
72b7d5e03cSMatthew Dillon static void
73b7d5e03cSMatthew Dillon ar9300_disable_pcie_phy(struct ath_hal *ah);
74b7d5e03cSMatthew Dillon
75b7d5e03cSMatthew Dillon static const HAL_PERCAL_DATA iq_cal_single_sample =
76b7d5e03cSMatthew Dillon {IQ_MISMATCH_CAL,
77b7d5e03cSMatthew Dillon MIN_CAL_SAMPLES,
78b7d5e03cSMatthew Dillon PER_MAX_LOG_COUNT,
79b7d5e03cSMatthew Dillon ar9300_iq_cal_collect,
80b7d5e03cSMatthew Dillon ar9300_iq_calibration};
81b7d5e03cSMatthew Dillon
82b7d5e03cSMatthew Dillon #if 0
83b7d5e03cSMatthew Dillon static HAL_CALIBRATION_TIMER ar9300_cals[] =
84b7d5e03cSMatthew Dillon { {IQ_MISMATCH_CAL, /* Cal type */
85b7d5e03cSMatthew Dillon 1200000, /* Cal interval */
86b7d5e03cSMatthew Dillon 0 /* Cal timestamp */
87b7d5e03cSMatthew Dillon },
88b7d5e03cSMatthew Dillon {TEMP_COMP_CAL,
89b7d5e03cSMatthew Dillon 5000,
90b7d5e03cSMatthew Dillon 0
91b7d5e03cSMatthew Dillon },
92b7d5e03cSMatthew Dillon };
93b7d5e03cSMatthew Dillon #endif
94b7d5e03cSMatthew Dillon
95b7d5e03cSMatthew Dillon #if ATH_PCIE_ERROR_MONITOR
96b7d5e03cSMatthew Dillon
ar9300_start_pcie_error_monitor(struct ath_hal * ah,int b_auto_stop)97b7d5e03cSMatthew Dillon int ar9300_start_pcie_error_monitor(struct ath_hal *ah, int b_auto_stop)
98b7d5e03cSMatthew Dillon {
99b7d5e03cSMatthew Dillon u_int32_t val;
100b7d5e03cSMatthew Dillon
101b7d5e03cSMatthew Dillon /* Clear the counters */
102b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PCIE_CO_ERR_CTR_CTR0, 0);
103b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PCIE_CO_ERR_CTR_CTR1, 0);
104b7d5e03cSMatthew Dillon
105b7d5e03cSMatthew Dillon /* Read the previous value */
106b7d5e03cSMatthew Dillon val = OS_REG_READ(ah, PCIE_CO_ERR_CTR_CTRL);
107b7d5e03cSMatthew Dillon
108b7d5e03cSMatthew Dillon /* Set auto_stop */
109b7d5e03cSMatthew Dillon if (b_auto_stop) {
110b7d5e03cSMatthew Dillon val |=
111b7d5e03cSMatthew Dillon RCVD_ERR_CTR_AUTO_STOP | BAD_TLP_ERR_CTR_AUTO_STOP |
112b7d5e03cSMatthew Dillon BAD_DLLP_ERR_CTR_AUTO_STOP | RPLY_TO_ERR_CTR_AUTO_STOP |
113b7d5e03cSMatthew Dillon RPLY_NUM_RO_ERR_CTR_AUTO_STOP;
114b7d5e03cSMatthew Dillon } else {
115b7d5e03cSMatthew Dillon val &= ~(
116b7d5e03cSMatthew Dillon RCVD_ERR_CTR_AUTO_STOP | BAD_TLP_ERR_CTR_AUTO_STOP |
117b7d5e03cSMatthew Dillon BAD_DLLP_ERR_CTR_AUTO_STOP | RPLY_TO_ERR_CTR_AUTO_STOP |
118b7d5e03cSMatthew Dillon RPLY_NUM_RO_ERR_CTR_AUTO_STOP);
119b7d5e03cSMatthew Dillon }
120b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PCIE_CO_ERR_CTR_CTRL, val );
121b7d5e03cSMatthew Dillon
122b7d5e03cSMatthew Dillon /*
123b7d5e03cSMatthew Dillon * Start to run.
124b7d5e03cSMatthew Dillon * This has to be done separately from the above auto_stop flag setting,
125b7d5e03cSMatthew Dillon * to avoid a HW race condition.
126b7d5e03cSMatthew Dillon */
127b7d5e03cSMatthew Dillon val |=
128b7d5e03cSMatthew Dillon RCVD_ERR_CTR_RUN | BAD_TLP_ERR_CTR_RUN | BAD_DLLP_ERR_CTR_RUN |
129b7d5e03cSMatthew Dillon RPLY_TO_ERR_CTR_RUN | RPLY_NUM_RO_ERR_CTR_RUN;
130b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PCIE_CO_ERR_CTR_CTRL, val);
131b7d5e03cSMatthew Dillon
132b7d5e03cSMatthew Dillon return 0;
133b7d5e03cSMatthew Dillon }
134b7d5e03cSMatthew Dillon
ar9300_read_pcie_error_monitor(struct ath_hal * ah,void * p_read_counters)135b7d5e03cSMatthew Dillon int ar9300_read_pcie_error_monitor(struct ath_hal *ah, void* p_read_counters)
136b7d5e03cSMatthew Dillon {
137b7d5e03cSMatthew Dillon u_int32_t val;
138b7d5e03cSMatthew Dillon ar_pcie_error_moniter_counters *p_counters =
139b7d5e03cSMatthew Dillon (ar_pcie_error_moniter_counters*) p_read_counters;
140b7d5e03cSMatthew Dillon
141b7d5e03cSMatthew Dillon val = OS_REG_READ(ah, PCIE_CO_ERR_CTR_CTR0);
142b7d5e03cSMatthew Dillon
143b7d5e03cSMatthew Dillon p_counters->uc_receiver_errors = MS(val, RCVD_ERR_MASK);
144b7d5e03cSMatthew Dillon p_counters->uc_bad_tlp_errors = MS(val, BAD_TLP_ERR_MASK);
145b7d5e03cSMatthew Dillon p_counters->uc_bad_dllp_errors = MS(val, BAD_DLLP_ERR_MASK);
146b7d5e03cSMatthew Dillon
147b7d5e03cSMatthew Dillon val = OS_REG_READ(ah, PCIE_CO_ERR_CTR_CTR1);
148b7d5e03cSMatthew Dillon
149b7d5e03cSMatthew Dillon p_counters->uc_replay_timeout_errors = MS(val, RPLY_TO_ERR_MASK);
150b7d5e03cSMatthew Dillon p_counters->uc_replay_number_rollover_errors= MS(val, RPLY_NUM_RO_ERR_MASK);
151b7d5e03cSMatthew Dillon
152b7d5e03cSMatthew Dillon return 0;
153b7d5e03cSMatthew Dillon }
154b7d5e03cSMatthew Dillon
ar9300_stop_pcie_error_monitor(struct ath_hal * ah)155b7d5e03cSMatthew Dillon int ar9300_stop_pcie_error_monitor(struct ath_hal *ah)
156b7d5e03cSMatthew Dillon {
157b7d5e03cSMatthew Dillon u_int32_t val;
158b7d5e03cSMatthew Dillon
159b7d5e03cSMatthew Dillon /* Read the previous value */
160b7d5e03cSMatthew Dillon val = OS_REG_READ(ah, PCIE_CO_ERR_CTR_CTRL);
161b7d5e03cSMatthew Dillon
162b7d5e03cSMatthew Dillon val &= ~(
163b7d5e03cSMatthew Dillon RCVD_ERR_CTR_RUN |
164b7d5e03cSMatthew Dillon BAD_TLP_ERR_CTR_RUN |
165b7d5e03cSMatthew Dillon BAD_DLLP_ERR_CTR_RUN |
166b7d5e03cSMatthew Dillon RPLY_TO_ERR_CTR_RUN |
167b7d5e03cSMatthew Dillon RPLY_NUM_RO_ERR_CTR_RUN);
168b7d5e03cSMatthew Dillon
169b7d5e03cSMatthew Dillon /* Start to stop */
170b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PCIE_CO_ERR_CTR_CTRL, val );
171b7d5e03cSMatthew Dillon
172b7d5e03cSMatthew Dillon return 0;
173b7d5e03cSMatthew Dillon }
174b7d5e03cSMatthew Dillon
175b7d5e03cSMatthew Dillon #endif /* ATH_PCIE_ERROR_MONITOR */
176b7d5e03cSMatthew Dillon
177b7d5e03cSMatthew Dillon #if 0
178b7d5e03cSMatthew Dillon /* WIN32 does not support C99 */
179b7d5e03cSMatthew Dillon static const struct ath_hal_private ar9300hal = {
180b7d5e03cSMatthew Dillon {
181b7d5e03cSMatthew Dillon ar9300_get_rate_table, /* ah_get_rate_table */
182b7d5e03cSMatthew Dillon ar9300_detach, /* ah_detach */
183b7d5e03cSMatthew Dillon
184b7d5e03cSMatthew Dillon /* Reset Functions */
185b7d5e03cSMatthew Dillon ar9300_reset, /* ah_reset */
186b7d5e03cSMatthew Dillon ar9300_phy_disable, /* ah_phy_disable */
187b7d5e03cSMatthew Dillon ar9300_disable, /* ah_disable */
188b7d5e03cSMatthew Dillon ar9300_config_pci_power_save, /* ah_config_pci_power_save */
189b7d5e03cSMatthew Dillon ar9300_set_pcu_config, /* ah_set_pcu_config */
190b7d5e03cSMatthew Dillon ar9300_calibration, /* ah_per_calibration */
191b7d5e03cSMatthew Dillon ar9300_reset_cal_valid, /* ah_reset_cal_valid */
192b7d5e03cSMatthew Dillon ar9300_set_tx_power_limit, /* ah_set_tx_power_limit */
193b7d5e03cSMatthew Dillon
194b7d5e03cSMatthew Dillon #if ATH_ANT_DIV_COMB
195b7d5e03cSMatthew Dillon ar9300_ant_ctrl_set_lna_div_use_bt_ant, /* ah_ant_ctrl_set_lna_div_use_bt_ant */
196b7d5e03cSMatthew Dillon #endif /* ATH_ANT_DIV_COMB */
197b7d5e03cSMatthew Dillon #ifdef ATH_SUPPORT_DFS
198b7d5e03cSMatthew Dillon ar9300_radar_wait, /* ah_radar_wait */
199b7d5e03cSMatthew Dillon
200b7d5e03cSMatthew Dillon /* New DFS functions */
201b7d5e03cSMatthew Dillon ar9300_check_dfs, /* ah_ar_check_dfs */
202b7d5e03cSMatthew Dillon ar9300_dfs_found, /* ah_ar_dfs_found */
203b7d5e03cSMatthew Dillon ar9300_enable_dfs, /* ah_ar_enable_dfs */
204b7d5e03cSMatthew Dillon ar9300_get_dfs_thresh, /* ah_ar_get_dfs_thresh */
205b7d5e03cSMatthew Dillon ar9300_get_dfs_radars, /* ah_ar_get_dfs_radars */
206b7d5e03cSMatthew Dillon ar9300_adjust_difs, /* ah_adjust_difs */
207b7d5e03cSMatthew Dillon ar9300_dfs_config_fft, /* ah_dfs_config_fft */
208b7d5e03cSMatthew Dillon ar9300_dfs_cac_war, /* ah_dfs_cac_war */
209b7d5e03cSMatthew Dillon ar9300_cac_tx_quiet, /* ah_cac_tx_quiet */
210b7d5e03cSMatthew Dillon #endif
211b7d5e03cSMatthew Dillon ar9300_get_extension_channel, /* ah_get_extension_channel */
212b7d5e03cSMatthew Dillon ar9300_is_fast_clock_enabled, /* ah_is_fast_clock_enabled */
213b7d5e03cSMatthew Dillon
214b7d5e03cSMatthew Dillon /* Transmit functions */
215b7d5e03cSMatthew Dillon ar9300_update_tx_trig_level, /* ah_update_tx_trig_level */
216b7d5e03cSMatthew Dillon ar9300_get_tx_trig_level, /* ah_get_tx_trig_level */
217b7d5e03cSMatthew Dillon ar9300_setup_tx_queue, /* ah_setup_tx_queue */
218b7d5e03cSMatthew Dillon ar9300_set_tx_queue_props, /* ah_set_tx_queue_props */
219b7d5e03cSMatthew Dillon ar9300_get_tx_queue_props, /* ah_get_tx_queue_props */
220b7d5e03cSMatthew Dillon ar9300_release_tx_queue, /* ah_release_tx_queue */
221b7d5e03cSMatthew Dillon ar9300_reset_tx_queue, /* ah_reset_tx_queue */
222b7d5e03cSMatthew Dillon ar9300_get_tx_dp, /* ah_get_tx_dp */
223b7d5e03cSMatthew Dillon ar9300_set_tx_dp, /* ah_set_tx_dp */
224b7d5e03cSMatthew Dillon ar9300_num_tx_pending, /* ah_num_tx_pending */
225b7d5e03cSMatthew Dillon ar9300_start_tx_dma, /* ah_start_tx_dma */
226b7d5e03cSMatthew Dillon ar9300_stop_tx_dma, /* ah_stop_tx_dma */
227b7d5e03cSMatthew Dillon ar9300_stop_tx_dma_indv_que, /* ah_stop_tx_dma_indv_que */
228b7d5e03cSMatthew Dillon ar9300_abort_tx_dma, /* ah_abort_tx_dma */
229b7d5e03cSMatthew Dillon ar9300_fill_tx_desc, /* ah_fill_tx_desc */
230b7d5e03cSMatthew Dillon ar9300_set_desc_link, /* ah_set_desc_link */
231b7d5e03cSMatthew Dillon ar9300_get_desc_link_ptr, /* ah_get_desc_link_ptr */
232b7d5e03cSMatthew Dillon ar9300_clear_tx_desc_status, /* ah_clear_tx_desc_status */
233b7d5e03cSMatthew Dillon #ifdef ATH_SWRETRY
234b7d5e03cSMatthew Dillon ar9300_clear_dest_mask, /* ah_clear_dest_mask */
235b7d5e03cSMatthew Dillon #endif
236b7d5e03cSMatthew Dillon ar9300_proc_tx_desc, /* ah_proc_tx_desc */
237b7d5e03cSMatthew Dillon ar9300_get_raw_tx_desc, /* ah_get_raw_tx_desc */
238b7d5e03cSMatthew Dillon ar9300_get_tx_rate_code, /* ah_get_tx_rate_code */
239b7d5e03cSMatthew Dillon AH_NULL, /* ah_get_tx_intr_queue */
240b7d5e03cSMatthew Dillon ar9300_tx_req_intr_desc, /* ah_req_tx_intr_desc */
241b7d5e03cSMatthew Dillon ar9300_calc_tx_airtime, /* ah_calc_tx_airtime */
242b7d5e03cSMatthew Dillon ar9300_setup_tx_status_ring, /* ah_setup_tx_status_ring */
243b7d5e03cSMatthew Dillon
244b7d5e03cSMatthew Dillon /* RX Functions */
245b7d5e03cSMatthew Dillon ar9300_get_rx_dp, /* ah_get_rx_dp */
246b7d5e03cSMatthew Dillon ar9300_set_rx_dp, /* ah_set_rx_dp */
247b7d5e03cSMatthew Dillon ar9300_enable_receive, /* ah_enable_receive */
248b7d5e03cSMatthew Dillon ar9300_stop_dma_receive, /* ah_stop_dma_receive */
249b7d5e03cSMatthew Dillon ar9300_start_pcu_receive, /* ah_start_pcu_receive */
250b7d5e03cSMatthew Dillon ar9300_stop_pcu_receive, /* ah_stop_pcu_receive */
251b7d5e03cSMatthew Dillon ar9300_set_multicast_filter, /* ah_set_multicast_filter */
252b7d5e03cSMatthew Dillon ar9300_get_rx_filter, /* ah_get_rx_filter */
253b7d5e03cSMatthew Dillon ar9300_set_rx_filter, /* ah_set_rx_filter */
254b7d5e03cSMatthew Dillon ar9300_set_rx_sel_evm, /* ah_set_rx_sel_evm */
255b7d5e03cSMatthew Dillon ar9300_set_rx_abort, /* ah_set_rx_abort */
256b7d5e03cSMatthew Dillon AH_NULL, /* ah_setup_rx_desc */
257b7d5e03cSMatthew Dillon ar9300_proc_rx_desc, /* ah_proc_rx_desc */
258b7d5e03cSMatthew Dillon ar9300_get_rx_key_idx, /* ah_get_rx_key_idx */
259b7d5e03cSMatthew Dillon ar9300_proc_rx_desc_fast, /* ah_proc_rx_desc_fast */
260b7d5e03cSMatthew Dillon ar9300_ani_ar_poll, /* ah_rx_monitor */
261b7d5e03cSMatthew Dillon ar9300_process_mib_intr, /* ah_proc_mib_event */
262b7d5e03cSMatthew Dillon
263b7d5e03cSMatthew Dillon /* Misc Functions */
264b7d5e03cSMatthew Dillon ar9300_get_capability, /* ah_get_capability */
265b7d5e03cSMatthew Dillon ar9300_set_capability, /* ah_set_capability */
266b7d5e03cSMatthew Dillon ar9300_get_diag_state, /* ah_get_diag_state */
267b7d5e03cSMatthew Dillon ar9300_get_mac_address, /* ah_get_mac_address */
268b7d5e03cSMatthew Dillon ar9300_set_mac_address, /* ah_set_mac_address */
269b7d5e03cSMatthew Dillon ar9300_get_bss_id_mask, /* ah_get_bss_id_mask */
270b7d5e03cSMatthew Dillon ar9300_set_bss_id_mask, /* ah_set_bss_id_mask */
271b7d5e03cSMatthew Dillon ar9300_set_regulatory_domain, /* ah_set_regulatory_domain */
272b7d5e03cSMatthew Dillon ar9300_set_led_state, /* ah_set_led_state */
273b7d5e03cSMatthew Dillon ar9300_set_power_led_state, /* ah_setpowerledstate */
274b7d5e03cSMatthew Dillon ar9300_set_network_led_state, /* ah_setnetworkledstate */
275b7d5e03cSMatthew Dillon ar9300_write_associd, /* ah_write_associd */
276b7d5e03cSMatthew Dillon ar9300_force_tsf_sync, /* ah_force_tsf_sync */
277b7d5e03cSMatthew Dillon ar9300_gpio_cfg_input, /* ah_gpio_cfg_input */
278b7d5e03cSMatthew Dillon ar9300_gpio_cfg_output, /* ah_gpio_cfg_output */
279b7d5e03cSMatthew Dillon ar9300_gpio_cfg_output_led_off, /* ah_gpio_cfg_output_led_off */
280b7d5e03cSMatthew Dillon ar9300_gpio_get, /* ah_gpio_get */
281b7d5e03cSMatthew Dillon ar9300_gpio_set, /* ah_gpio_set */
282b7d5e03cSMatthew Dillon ar9300_gpio_get_intr, /* ah_gpio_get_intr */
283b7d5e03cSMatthew Dillon ar9300_gpio_set_intr, /* ah_gpio_set_intr */
284b7d5e03cSMatthew Dillon ar9300_gpio_get_polarity, /* ah_gpio_get_polarity */
285b7d5e03cSMatthew Dillon ar9300_gpio_set_polarity, /* ah_gpio_set_polarity */
286b7d5e03cSMatthew Dillon ar9300_gpio_get_mask, /* ah_gpio_get_mask */
287b7d5e03cSMatthew Dillon ar9300_gpio_set_mask, /* ah_gpio_set_mask */
288b7d5e03cSMatthew Dillon ar9300_get_tsf32, /* ah_get_tsf32 */
289b7d5e03cSMatthew Dillon ar9300_get_tsf64, /* ah_get_tsf64 */
290b7d5e03cSMatthew Dillon ar9300_get_tsf2_32, /* ah_get_tsf2_32 */
291b7d5e03cSMatthew Dillon ar9300_reset_tsf, /* ah_reset_tsf */
292b7d5e03cSMatthew Dillon ar9300_detect_card_present, /* ah_detect_card_present */
293b7d5e03cSMatthew Dillon ar9300_update_mib_mac_stats, /* ah_update_mib_mac_stats */
294b7d5e03cSMatthew Dillon ar9300_get_mib_mac_stats, /* ah_get_mib_mac_stats */
295b7d5e03cSMatthew Dillon ar9300_get_rfgain, /* ah_get_rf_gain */
296b7d5e03cSMatthew Dillon ar9300_get_def_antenna, /* ah_get_def_antenna */
297b7d5e03cSMatthew Dillon ar9300_set_def_antenna, /* ah_set_def_antenna */
298b7d5e03cSMatthew Dillon ar9300_set_slot_time, /* ah_set_slot_time */
299b7d5e03cSMatthew Dillon ar9300_set_ack_timeout, /* ah_set_ack_timeout */
300b7d5e03cSMatthew Dillon ar9300_get_ack_timeout, /* ah_get_ack_timeout */
301b7d5e03cSMatthew Dillon ar9300_set_coverage_class, /* ah_set_coverage_class */
302b7d5e03cSMatthew Dillon ar9300_set_quiet, /* ah_set_quiet */
303b7d5e03cSMatthew Dillon ar9300_set_antenna_switch, /* ah_set_antenna_switch */
304b7d5e03cSMatthew Dillon ar9300_get_desc_info, /* ah_get_desc_info */
305b7d5e03cSMatthew Dillon ar9300_select_ant_config, /* ah_select_ant_config */
306b7d5e03cSMatthew Dillon ar9300_ant_ctrl_common_get, /* ah_ant_ctrl_common_get */
307*a20e5e51SMatthew Dillon ar9300_ant_swcom_sel, /* ah_ant_swcom_sel */
308b7d5e03cSMatthew Dillon ar9300_enable_tpc, /* ah_enable_tpc */
309b7d5e03cSMatthew Dillon AH_NULL, /* ah_olpc_temp_compensation */
310b7d5e03cSMatthew Dillon #if ATH_SUPPORT_CRDC
311b7d5e03cSMatthew Dillon ar9300_chain_rssi_diff_compensation,/*ah_chain_rssi_diff_compensation*/
312b7d5e03cSMatthew Dillon #endif
313b7d5e03cSMatthew Dillon ar9300_disable_phy_restart, /* ah_disable_phy_restart */
314b7d5e03cSMatthew Dillon ar9300_enable_keysearch_always,
315b7d5e03cSMatthew Dillon ar9300_interference_is_present, /* ah_interference_is_present */
316b7d5e03cSMatthew Dillon ar9300_disp_tpc_tables, /* ah_disp_tpc_tables */
317b7d5e03cSMatthew Dillon ar9300_get_tpc_tables, /* ah_get_tpc_tables */
318b7d5e03cSMatthew Dillon /* Key Cache Functions */
319b7d5e03cSMatthew Dillon ar9300_get_key_cache_size, /* ah_get_key_cache_size */
320b7d5e03cSMatthew Dillon ar9300_reset_key_cache_entry, /* ah_reset_key_cache_entry */
321b7d5e03cSMatthew Dillon ar9300_is_key_cache_entry_valid, /* ah_is_key_cache_entry_valid */
322b7d5e03cSMatthew Dillon ar9300_set_key_cache_entry, /* ah_set_key_cache_entry */
323b7d5e03cSMatthew Dillon ar9300_set_key_cache_entry_mac, /* ah_set_key_cache_entry_mac */
324b7d5e03cSMatthew Dillon ar9300_print_keycache, /* ah_print_key_cache */
325*a20e5e51SMatthew Dillon #if ATH_SUPPORT_KEYPLUMB_WAR
326*a20e5e51SMatthew Dillon ar9300_check_key_cache_entry, /* ah_check_key_cache_entry */
327*a20e5e51SMatthew Dillon #endif
328b7d5e03cSMatthew Dillon /* Power Management Functions */
329b7d5e03cSMatthew Dillon ar9300_set_power_mode, /* ah_set_power_mode */
330b7d5e03cSMatthew Dillon ar9300_set_sm_power_mode, /* ah_set_sm_ps_mode */
331b7d5e03cSMatthew Dillon #if ATH_WOW
332b7d5e03cSMatthew Dillon ar9300_wow_apply_pattern, /* ah_wow_apply_pattern */
333b7d5e03cSMatthew Dillon ar9300_wow_enable, /* ah_wow_enable */
334b7d5e03cSMatthew Dillon ar9300_wow_wake_up, /* ah_wow_wake_up */
335b7d5e03cSMatthew Dillon #if ATH_WOW_OFFLOAD
336b7d5e03cSMatthew Dillon ar9300_wowoffload_prep, /* ah_wow_offload_prep */
337b7d5e03cSMatthew Dillon ar9300_wowoffload_post, /* ah_wow_offload_post */
338b7d5e03cSMatthew Dillon ar9300_wowoffload_download_rekey_data, /* ah_wow_offload_download_rekey_data */
339b7d5e03cSMatthew Dillon ar9300_wowoffload_retrieve_data, /* ah_wow_offload_retrieve_data */
340b7d5e03cSMatthew Dillon ar9300_wowoffload_download_acer_magic, /* ah_wow_offload_download_acer_magic */
341b7d5e03cSMatthew Dillon ar9300_wowoffload_download_acer_swka, /* ah_wow_offload_download_acer_swka */
342b7d5e03cSMatthew Dillon ar9300_wowoffload_download_arp_info, /* ah_wow_offload_download_arp_info */
343b7d5e03cSMatthew Dillon ar9300_wowoffload_download_ns_info, /* ah_wow_offload_download_ns_info */
344b7d5e03cSMatthew Dillon #endif /* ATH_WOW_OFFLOAD */
345b7d5e03cSMatthew Dillon #endif
346b7d5e03cSMatthew Dillon
347b7d5e03cSMatthew Dillon /* Get Channel Noise */
348b7d5e03cSMatthew Dillon ath_hal_get_chan_noise, /* ah_get_chan_noise */
349b7d5e03cSMatthew Dillon ar9300_chain_noise_floor, /* ah_get_chain_noise_floor */
350*a20e5e51SMatthew Dillon ar9300_get_nf_from_reg, /* ah_get_nf_from_reg */
351*a20e5e51SMatthew Dillon ar9300_get_rx_nf_offset, /* ah_get_rx_nf_offset */
352b7d5e03cSMatthew Dillon
353b7d5e03cSMatthew Dillon /* Beacon Functions */
354b7d5e03cSMatthew Dillon ar9300_beacon_init, /* ah_beacon_init */
355b7d5e03cSMatthew Dillon ar9300_set_sta_beacon_timers, /* ah_set_station_beacon_timers */
356b7d5e03cSMatthew Dillon
357b7d5e03cSMatthew Dillon /* Interrupt Functions */
358b7d5e03cSMatthew Dillon ar9300_is_interrupt_pending, /* ah_is_interrupt_pending */
359b7d5e03cSMatthew Dillon ar9300_get_pending_interrupts, /* ah_get_pending_interrupts */
360b7d5e03cSMatthew Dillon ar9300_get_interrupts, /* ah_get_interrupts */
361b7d5e03cSMatthew Dillon ar9300_set_interrupts, /* ah_set_interrupts */
362b7d5e03cSMatthew Dillon ar9300_set_intr_mitigation_timer, /* ah_set_intr_mitigation_timer */
363b7d5e03cSMatthew Dillon ar9300_get_intr_mitigation_timer, /* ah_get_intr_mitigation_timer */
364b7d5e03cSMatthew Dillon ar9300ForceVCS,
365b7d5e03cSMatthew Dillon ar9300SetDfs3StreamFix,
366b7d5e03cSMatthew Dillon ar9300Get3StreamSignature,
367b7d5e03cSMatthew Dillon
368b7d5e03cSMatthew Dillon /* 11n specific functions (NOT applicable to ar9300) */
369b7d5e03cSMatthew Dillon ar9300_set_11n_tx_desc, /* ah_set_11n_tx_desc */
370b7d5e03cSMatthew Dillon /* Update rxchain */
371b7d5e03cSMatthew Dillon ar9300_set_rx_chainmask, /*ah_set_rx_chainmask*/
372b7d5e03cSMatthew Dillon /*Updating locationing register */
373b7d5e03cSMatthew Dillon ar9300_update_loc_ctl_reg, /*ah_update_loc_ctl_reg*/
374b7d5e03cSMatthew Dillon /* Start PAPRD functions */
375b7d5e03cSMatthew Dillon ar9300_set_paprd_tx_desc, /* ah_set_paprd_tx_desc */
376b7d5e03cSMatthew Dillon ar9300_paprd_init_table, /* ah_paprd_init_table */
377b7d5e03cSMatthew Dillon ar9300_paprd_setup_gain_table, /* ah_paprd_setup_gain_table */
378b7d5e03cSMatthew Dillon ar9300_paprd_create_curve, /* ah_paprd_create_curve */
379b7d5e03cSMatthew Dillon ar9300_paprd_is_done, /* ah_paprd_is_done */
380b7d5e03cSMatthew Dillon ar9300_enable_paprd, /* ah_PAPRDEnable */
381b7d5e03cSMatthew Dillon ar9300_populate_paprd_single_table,/* ah_paprd_populate_table */
382b7d5e03cSMatthew Dillon ar9300_is_tx_done, /* ah_is_tx_done */
383b7d5e03cSMatthew Dillon ar9300_paprd_dec_tx_pwr, /* ah_paprd_dec_tx_pwr*/
384b7d5e03cSMatthew Dillon ar9300_paprd_thermal_send, /* ah_paprd_thermal_send */
385b7d5e03cSMatthew Dillon /* End PAPRD functions */
386b7d5e03cSMatthew Dillon ar9300_set_11n_rate_scenario, /* ah_set_11n_rate_scenario */
387b7d5e03cSMatthew Dillon ar9300_set_11n_aggr_first, /* ah_set_11n_aggr_first */
388b7d5e03cSMatthew Dillon ar9300_set_11n_aggr_middle, /* ah_set_11n_aggr_middle */
389b7d5e03cSMatthew Dillon ar9300_set_11n_aggr_last, /* ah_set_11n_aggr_last */
390b7d5e03cSMatthew Dillon ar9300_clr_11n_aggr, /* ah_clr_11n_aggr */
391b7d5e03cSMatthew Dillon ar9300_set_11n_rifs_burst_middle, /* ah_set_11n_rifs_burst_middle */
392b7d5e03cSMatthew Dillon ar9300_set_11n_rifs_burst_last, /* ah_set_11n_rifs_burst_last */
393b7d5e03cSMatthew Dillon ar9300_clr_11n_rifs_burst, /* ah_clr_11n_rifs_burst */
394b7d5e03cSMatthew Dillon ar9300_set_11n_aggr_rifs_burst, /* ah_set_11n_aggr_rifs_burst */
395b7d5e03cSMatthew Dillon ar9300_set_11n_rx_rifs, /* ah_set_11n_rx_rifs */
396b7d5e03cSMatthew Dillon ar9300_set_smart_antenna, /* ah_setSmartAntenna */
397b7d5e03cSMatthew Dillon ar9300_detect_bb_hang, /* ah_detect_bb_hang */
398b7d5e03cSMatthew Dillon ar9300_detect_mac_hang, /* ah_detect_mac_hang */
399b7d5e03cSMatthew Dillon ar9300_set_immunity, /* ah_immunity */
400b7d5e03cSMatthew Dillon ar9300_get_hw_hangs, /* ah_get_hang_types */
401b7d5e03cSMatthew Dillon ar9300_set_11n_burst_duration, /* ah_set_11n_burst_duration */
402b7d5e03cSMatthew Dillon ar9300_set_11n_virtual_more_frag, /* ah_set_11n_virtual_more_frag */
403b7d5e03cSMatthew Dillon ar9300_get_11n_ext_busy, /* ah_get_11n_ext_busy */
404b7d5e03cSMatthew Dillon ar9300_set_11n_mac2040, /* ah_set_11n_mac2040 */
405b7d5e03cSMatthew Dillon ar9300_get_11n_rx_clear, /* ah_get_11n_rx_clear */
406b7d5e03cSMatthew Dillon ar9300_set_11n_rx_clear, /* ah_set_11n_rx_clear */
407b7d5e03cSMatthew Dillon ar9300_get_mib_cycle_counts_pct, /* ah_get_mib_cycle_counts_pct */
408b7d5e03cSMatthew Dillon ar9300_dma_reg_dump, /* ah_dma_reg_dump */
409b7d5e03cSMatthew Dillon
410b7d5e03cSMatthew Dillon /* force_ppm specific functions */
411b7d5e03cSMatthew Dillon ar9300_ppm_get_rssi_dump, /* ah_ppm_get_rssi_dump */
412b7d5e03cSMatthew Dillon ar9300_ppm_arm_trigger, /* ah_ppm_arm_trigger */
413b7d5e03cSMatthew Dillon ar9300_ppm_get_trigger, /* ah_ppm_get_trigger */
414b7d5e03cSMatthew Dillon ar9300_ppm_force, /* ah_ppm_force */
415b7d5e03cSMatthew Dillon ar9300_ppm_un_force, /* ah_ppm_un_force */
416b7d5e03cSMatthew Dillon ar9300_ppm_get_force_state, /* ah_ppm_get_force_state */
417b7d5e03cSMatthew Dillon
418b7d5e03cSMatthew Dillon ar9300_get_spur_info, /* ah_get_spur_info */
419b7d5e03cSMatthew Dillon ar9300_set_spur_info, /* ah_get_spur_info */
420b7d5e03cSMatthew Dillon
421b7d5e03cSMatthew Dillon ar9300_get_min_cca_pwr, /* ah_ar_get_noise_floor_val */
422b7d5e03cSMatthew Dillon
423b7d5e03cSMatthew Dillon ar9300_green_ap_ps_on_off, /* ah_set_rx_green_ap_ps_on_off */
424b7d5e03cSMatthew Dillon ar9300_is_single_ant_power_save_possible, /* ah_is_single_ant_power_save_possible */
425b7d5e03cSMatthew Dillon
426b7d5e03cSMatthew Dillon /* radio measurement specific functions */
427b7d5e03cSMatthew Dillon ar9300_get_mib_cycle_counts, /* ah_get_mib_cycle_counts */
428b7d5e03cSMatthew Dillon ar9300_get_vow_stats, /* ah_get_vow_stats */
429b7d5e03cSMatthew Dillon ar9300_clear_mib_counters, /* ah_clear_mib_counters */
430b7d5e03cSMatthew Dillon #if ATH_GEN_RANDOMNESS
431b7d5e03cSMatthew Dillon ar9300_get_rssi_chain0, /* ah_get_rssi_chain0 */
432b7d5e03cSMatthew Dillon #endif
433b7d5e03cSMatthew Dillon #ifdef ATH_BT_COEX
434b7d5e03cSMatthew Dillon /* Bluetooth Coexistence functions */
435b7d5e03cSMatthew Dillon ar9300_set_bt_coex_info, /* ah_set_bt_coex_info */
436b7d5e03cSMatthew Dillon ar9300_bt_coex_config, /* ah_bt_coex_config */
437b7d5e03cSMatthew Dillon ar9300_bt_coex_set_qcu_thresh, /* ah_bt_coex_set_qcu_thresh */
438b7d5e03cSMatthew Dillon ar9300_bt_coex_set_weights, /* ah_bt_coex_set_weights */
439b7d5e03cSMatthew Dillon ar9300_bt_coex_setup_bmiss_thresh, /* ah_bt_coex_set_bmiss_thresh */
440b7d5e03cSMatthew Dillon ar9300_bt_coex_set_parameter, /* ah_bt_coex_set_parameter */
441b7d5e03cSMatthew Dillon ar9300_bt_coex_disable, /* ah_bt_coex_disable */
442b7d5e03cSMatthew Dillon ar9300_bt_coex_enable, /* ah_bt_coex_enable */
443b7d5e03cSMatthew Dillon ar9300_get_bt_active_gpio, /* ah_bt_coex_info*/
444b7d5e03cSMatthew Dillon ar9300_get_wlan_active_gpio, /* ah__coex_wlan_info*/
445b7d5e03cSMatthew Dillon #endif
446b7d5e03cSMatthew Dillon /* Generic Timer functions */
447b7d5e03cSMatthew Dillon ar9300_alloc_generic_timer, /* ah_gentimer_alloc */
448b7d5e03cSMatthew Dillon ar9300_free_generic_timer, /* ah_gentimer_free */
449b7d5e03cSMatthew Dillon ar9300_start_generic_timer, /* ah_gentimer_start */
450b7d5e03cSMatthew Dillon ar9300_stop_generic_timer, /* ah_gentimer_stop */
451b7d5e03cSMatthew Dillon ar9300_get_gen_timer_interrupts, /* ah_gentimer_get_intr */
452b7d5e03cSMatthew Dillon
453b7d5e03cSMatthew Dillon ar9300_set_dcs_mode, /* ah_set_dcs_mode */
454b7d5e03cSMatthew Dillon ar9300_get_dcs_mode, /* ah_get_dcs_mode */
455b7d5e03cSMatthew Dillon
456b7d5e03cSMatthew Dillon #if ATH_ANT_DIV_COMB
457b7d5e03cSMatthew Dillon ar9300_ant_div_comb_get_config, /* ah_get_ant_dvi_comb_conf */
458b7d5e03cSMatthew Dillon ar9300_ant_div_comb_set_config, /* ah_set_ant_dvi_comb_conf */
459b7d5e03cSMatthew Dillon #endif
460b7d5e03cSMatthew Dillon
461b7d5e03cSMatthew Dillon ar9300_get_bb_panic_info, /* ah_get_bb_panic_info */
462b7d5e03cSMatthew Dillon ar9300_handle_radar_bb_panic, /* ah_handle_radar_bb_panic */
463b7d5e03cSMatthew Dillon ar9300_set_hal_reset_reason, /* ah_set_hal_reset_reason */
464b7d5e03cSMatthew Dillon
465b7d5e03cSMatthew Dillon #if ATH_PCIE_ERROR_MONITOR
466b7d5e03cSMatthew Dillon ar9300_start_pcie_error_monitor, /* ah_start_pcie_error_monitor */
467b7d5e03cSMatthew Dillon ar9300_read_pcie_error_monitor, /* ah_read_pcie_error_monitor*/
468b7d5e03cSMatthew Dillon ar9300_stop_pcie_error_monitor, /* ah_stop_pcie_error_monitor*/
469b7d5e03cSMatthew Dillon #endif /* ATH_PCIE_ERROR_MONITOR */
470b7d5e03cSMatthew Dillon
471b7d5e03cSMatthew Dillon #if ATH_SUPPORT_SPECTRAL
472b7d5e03cSMatthew Dillon /* Spectral scan */
473b7d5e03cSMatthew Dillon ar9300_configure_spectral_scan, /* ah_ar_configure_spectral */
474b7d5e03cSMatthew Dillon ar9300_get_spectral_params, /* ah_ar_get_spectral_config */
475b7d5e03cSMatthew Dillon ar9300_start_spectral_scan, /* ah_ar_start_spectral_scan */
476b7d5e03cSMatthew Dillon ar9300_stop_spectral_scan, /* ah_ar_stop_spectral_scan */
477b7d5e03cSMatthew Dillon ar9300_is_spectral_enabled, /* ah_ar_is_spectral_enabled */
478b7d5e03cSMatthew Dillon ar9300_is_spectral_active, /* ah_ar_is_spectral_active */
479b7d5e03cSMatthew Dillon ar9300_get_ctl_chan_nf, /* ah_ar_get_ctl_nf */
480b7d5e03cSMatthew Dillon ar9300_get_ext_chan_nf, /* ah_ar_get_ext_nf */
481b7d5e03cSMatthew Dillon #endif /* ATH_SUPPORT_SPECTRAL */
482b7d5e03cSMatthew Dillon
483b7d5e03cSMatthew Dillon
484b7d5e03cSMatthew Dillon ar9300_promisc_mode, /* ah_promisc_mode */
485b7d5e03cSMatthew Dillon ar9300_read_pktlog_reg, /* ah_read_pktlog_reg */
486b7d5e03cSMatthew Dillon ar9300_write_pktlog_reg, /* ah_write_pktlog_reg */
487b7d5e03cSMatthew Dillon ar9300_set_proxy_sta, /* ah_set_proxy_sta */
488b7d5e03cSMatthew Dillon ar9300_get_cal_intervals, /* ah_get_cal_intervals */
489b7d5e03cSMatthew Dillon #if ATH_TRAFFIC_FAST_RECOVER
490b7d5e03cSMatthew Dillon ar9300_get_pll3_sqsum_dvc, /* ah_get_pll3_sqsum_dvc */
491b7d5e03cSMatthew Dillon #endif
492b7d5e03cSMatthew Dillon #ifdef ATH_SUPPORT_HTC
493b7d5e03cSMatthew Dillon AH_NULL,
494b7d5e03cSMatthew Dillon #endif
495b7d5e03cSMatthew Dillon
496b7d5e03cSMatthew Dillon #ifdef ATH_TX99_DIAG
497b7d5e03cSMatthew Dillon /* Tx99 functions */
498b7d5e03cSMatthew Dillon #ifdef ATH_SUPPORT_HTC
499b7d5e03cSMatthew Dillon AH_NULL,
500b7d5e03cSMatthew Dillon AH_NULL,
501b7d5e03cSMatthew Dillon AH_NULL,
502b7d5e03cSMatthew Dillon AH_NULL,
503b7d5e03cSMatthew Dillon AH_NULL,
504b7d5e03cSMatthew Dillon AH_NULL,
505b7d5e03cSMatthew Dillon AH_NULL,
506b7d5e03cSMatthew Dillon #else
507b7d5e03cSMatthew Dillon AH_NULL,
508b7d5e03cSMatthew Dillon AH_NULL,
509*a20e5e51SMatthew Dillon ar9300_tx99_channel_pwr_update, /* ah_tx99channelpwrupdate */
510*a20e5e51SMatthew Dillon ar9300_tx99_start, /* ah_tx99start */
511*a20e5e51SMatthew Dillon ar9300_tx99_stop, /* ah_tx99stop */
512*a20e5e51SMatthew Dillon ar9300_tx99_chainmsk_setup, /* ah_tx99_chainmsk_setup */
513*a20e5e51SMatthew Dillon ar9300_tx99_set_single_carrier, /* ah_tx99_set_single_carrier */
514b7d5e03cSMatthew Dillon #endif
515b7d5e03cSMatthew Dillon #endif
516b7d5e03cSMatthew Dillon ar9300_chk_rssi_update_tx_pwr,
517b7d5e03cSMatthew Dillon ar9300_is_skip_paprd_by_greentx, /* ah_is_skip_paprd_by_greentx */
518b7d5e03cSMatthew Dillon ar9300_hwgreentx_set_pal_spare, /* ah_hwgreentx_set_pal_spare */
519b7d5e03cSMatthew Dillon #if ATH_SUPPORT_MCI
520b7d5e03cSMatthew Dillon /* MCI Coexistence Functions */
521b7d5e03cSMatthew Dillon ar9300_mci_setup, /* ah_mci_setup */
522b7d5e03cSMatthew Dillon ar9300_mci_send_message, /* ah_mci_send_message */
523b7d5e03cSMatthew Dillon ar9300_mci_get_interrupt, /* ah_mci_get_interrupt */
524b7d5e03cSMatthew Dillon ar9300_mci_state, /* ah_mci_state */
525b7d5e03cSMatthew Dillon ar9300_mci_detach, /* ah_mci_detach */
526b7d5e03cSMatthew Dillon #endif
527b7d5e03cSMatthew Dillon ar9300_reset_hw_beacon_proc_crc, /* ah_reset_hw_beacon_proc_crc */
528b7d5e03cSMatthew Dillon ar9300_get_hw_beacon_rssi, /* ah_get_hw_beacon_rssi */
529b7d5e03cSMatthew Dillon ar9300_set_hw_beacon_rssi_threshold,/*ah_set_hw_beacon_rssi_threshold*/
530b7d5e03cSMatthew Dillon ar9300_reset_hw_beacon_rssi, /* ah_reset_hw_beacon_rssi */
531b7d5e03cSMatthew Dillon ar9300_mat_enable, /* ah_mat_enable */
532b7d5e03cSMatthew Dillon ar9300_dump_keycache, /* ah_dump_keycache */
533b7d5e03cSMatthew Dillon ar9300_is_ani_noise_spur, /* ah_is_ani_noise_spur */
534b7d5e03cSMatthew Dillon ar9300_set_hw_beacon_proc, /* ah_set_hw_beacon_proc */
535*a20e5e51SMatthew Dillon ar9300_set_ctl_pwr, /* ah_set_ctl_pwr */
536*a20e5e51SMatthew Dillon ar9300_set_txchainmaskopt, /* ah_set_txchainmaskopt */
537b7d5e03cSMatthew Dillon },
538b7d5e03cSMatthew Dillon
539b7d5e03cSMatthew Dillon ar9300_get_channel_edges, /* ah_get_channel_edges */
540b7d5e03cSMatthew Dillon ar9300_get_wireless_modes, /* ah_get_wireless_modes */
541b7d5e03cSMatthew Dillon ar9300_eeprom_read_word, /* ah_eeprom_read */
542b7d5e03cSMatthew Dillon AH_NULL,
543b7d5e03cSMatthew Dillon ar9300_eeprom_dump_support, /* ah_eeprom_dump */
544b7d5e03cSMatthew Dillon ar9300_get_chip_power_limits, /* ah_get_chip_power_limits */
545b7d5e03cSMatthew Dillon
546b7d5e03cSMatthew Dillon ar9300_get_nf_adjust, /* ah_get_nf_adjust */
547b7d5e03cSMatthew Dillon /* rest is zero'd by compiler */
548b7d5e03cSMatthew Dillon };
549b7d5e03cSMatthew Dillon #endif
550b7d5e03cSMatthew Dillon
551b7d5e03cSMatthew Dillon /*
552b7d5e03cSMatthew Dillon * Read MAC version/revision information from Chip registers and initialize
553b7d5e03cSMatthew Dillon * local data structures.
554b7d5e03cSMatthew Dillon */
555b7d5e03cSMatthew Dillon void
ar9300_read_revisions(struct ath_hal * ah)556b7d5e03cSMatthew Dillon ar9300_read_revisions(struct ath_hal *ah)
557b7d5e03cSMatthew Dillon {
558b7d5e03cSMatthew Dillon u_int32_t val;
559b7d5e03cSMatthew Dillon
560b7d5e03cSMatthew Dillon /* XXX verify if this is the correct way to read revision on Osprey */
561b7d5e03cSMatthew Dillon /* new SREV format for Sowl and later */
562b7d5e03cSMatthew Dillon val = OS_REG_READ(ah, AR_HOSTIF_REG(ah, AR_SREV));
563b7d5e03cSMatthew Dillon
564b7d5e03cSMatthew Dillon if (AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_AR9340) {
565b7d5e03cSMatthew Dillon /* XXX: AR_SREV register in Wasp reads 0 */
566b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macVersion = AR_SREV_VERSION_WASP;
567b7d5e03cSMatthew Dillon } else if(AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_QCA955X) {
568b7d5e03cSMatthew Dillon /* XXX: AR_SREV register in Scorpion reads 0 */
569b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macVersion = AR_SREV_VERSION_SCORPION;
570*a20e5e51SMatthew Dillon } else if(AH_PRIVATE(ah)->ah_devid == AR9300_DEVID_QCA953X) {
571*a20e5e51SMatthew Dillon /* XXX: AR_SREV register in HoneyBEE reads 0 */
572*a20e5e51SMatthew Dillon AH_PRIVATE(ah)->ah_macVersion = AR_SREV_VERSION_HONEYBEE;
573b7d5e03cSMatthew Dillon } else {
574b7d5e03cSMatthew Dillon /*
575b7d5e03cSMatthew Dillon * Include 6-bit Chip Type (masked to 0)
576b7d5e03cSMatthew Dillon * to differentiate from pre-Sowl versions
577b7d5e03cSMatthew Dillon */
578b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macVersion =
579b7d5e03cSMatthew Dillon (val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S;
580b7d5e03cSMatthew Dillon }
581b7d5e03cSMatthew Dillon
582b7d5e03cSMatthew Dillon
583b7d5e03cSMatthew Dillon
584b7d5e03cSMatthew Dillon
585b7d5e03cSMatthew Dillon
586b7d5e03cSMatthew Dillon #ifdef AH_SUPPORT_HORNET
587b7d5e03cSMatthew Dillon /*
588b7d5e03cSMatthew Dillon * EV74984, due to Hornet 1.1 didn't update WMAC revision,
589b7d5e03cSMatthew Dillon * so that have to read SoC's revision ID instead
590b7d5e03cSMatthew Dillon */
591b7d5e03cSMatthew Dillon if (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_HORNET) {
592b7d5e03cSMatthew Dillon #define AR_SOC_RST_REVISION_ID 0xB8060090
593b7d5e03cSMatthew Dillon #define REG_READ(_reg) *((volatile u_int32_t *)(_reg))
594b7d5e03cSMatthew Dillon if ((REG_READ(AR_SOC_RST_REVISION_ID) & AR_SREV_REVISION_HORNET_11_MASK)
595b7d5e03cSMatthew Dillon == AR_SREV_REVISION_HORNET_11)
596b7d5e03cSMatthew Dillon {
597b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macRev = AR_SREV_REVISION_HORNET_11;
598b7d5e03cSMatthew Dillon } else {
599b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macRev = MS(val, AR_SREV_REVISION2);
600b7d5e03cSMatthew Dillon }
601b7d5e03cSMatthew Dillon #undef REG_READ
602b7d5e03cSMatthew Dillon #undef AR_SOC_RST_REVISION_ID
603b7d5e03cSMatthew Dillon } else
604b7d5e03cSMatthew Dillon #endif
605b7d5e03cSMatthew Dillon if (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_WASP)
606b7d5e03cSMatthew Dillon {
607b7d5e03cSMatthew Dillon #define AR_SOC_RST_REVISION_ID 0xB8060090
608b7d5e03cSMatthew Dillon #define REG_READ(_reg) *((volatile u_int32_t *)(_reg))
609b7d5e03cSMatthew Dillon
610b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macRev =
611b7d5e03cSMatthew Dillon REG_READ(AR_SOC_RST_REVISION_ID) & AR_SREV_REVISION_WASP_MASK;
612b7d5e03cSMatthew Dillon #undef REG_READ
613b7d5e03cSMatthew Dillon #undef AR_SOC_RST_REVISION_ID
614b7d5e03cSMatthew Dillon }
615b7d5e03cSMatthew Dillon else
616b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_macRev = MS(val, AR_SREV_REVISION2);
617b7d5e03cSMatthew Dillon
618b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)) {
619b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_ispcie = AH_TRUE;
620b7d5e03cSMatthew Dillon }
621b7d5e03cSMatthew Dillon else {
622b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_ispcie =
623b7d5e03cSMatthew Dillon (val & AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
624b7d5e03cSMatthew Dillon }
625b7d5e03cSMatthew Dillon
626b7d5e03cSMatthew Dillon }
627b7d5e03cSMatthew Dillon
628b7d5e03cSMatthew Dillon /*
629b7d5e03cSMatthew Dillon * Attach for an AR9300 part.
630b7d5e03cSMatthew Dillon */
631b7d5e03cSMatthew Dillon struct ath_hal *
ar9300_attach(u_int16_t devid,HAL_SOFTC sc,HAL_BUS_TAG st,HAL_BUS_HANDLE sh,uint16_t * eepromdata,HAL_OPS_CONFIG * ah_config,HAL_STATUS * status)632b7d5e03cSMatthew Dillon ar9300_attach(u_int16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st,
633848b370cSMatthew Dillon HAL_BUS_HANDLE sh, uint16_t *eepromdata, HAL_OPS_CONFIG *ah_config,
634848b370cSMatthew Dillon HAL_STATUS *status)
635b7d5e03cSMatthew Dillon {
636b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp;
637b7d5e03cSMatthew Dillon struct ath_hal *ah;
638b7d5e03cSMatthew Dillon struct ath_hal_private *ahpriv;
639b7d5e03cSMatthew Dillon HAL_STATUS ecode;
640b7d5e03cSMatthew Dillon
641b7d5e03cSMatthew Dillon HAL_NO_INTERSPERSED_READS;
642b7d5e03cSMatthew Dillon
643b7d5e03cSMatthew Dillon /* NB: memory is returned zero'd */
644848b370cSMatthew Dillon ahp = ar9300_new_state(devid, sc, st, sh, eepromdata, ah_config, status);
645b7d5e03cSMatthew Dillon if (ahp == AH_NULL) {
646b7d5e03cSMatthew Dillon return AH_NULL;
647b7d5e03cSMatthew Dillon }
648b7d5e03cSMatthew Dillon ah = &ahp->ah_priv.h;
649b7d5e03cSMatthew Dillon ar9300_init_offsets(ah, devid);
650b7d5e03cSMatthew Dillon ahpriv = AH_PRIVATE(ah);
651b7d5e03cSMatthew Dillon // AH_PRIVATE(ah)->ah_bustype = bustype;
652b7d5e03cSMatthew Dillon
653b7d5e03cSMatthew Dillon /* FreeBSD: to make OTP work for now, provide this.. */
654b7d5e03cSMatthew Dillon AH9300(ah)->ah_cal_mem = ath_hal_malloc(HOST_CALDATA_SIZE);
655b7d5e03cSMatthew Dillon if (AH9300(ah)->ah_cal_mem == NULL) {
656b7d5e03cSMatthew Dillon ath_hal_printf(ah, "%s: caldata malloc failed!\n", __func__);
657b7d5e03cSMatthew Dillon ecode = HAL_EIO;
658b7d5e03cSMatthew Dillon goto bad;
659b7d5e03cSMatthew Dillon }
660b7d5e03cSMatthew Dillon
661b7d5e03cSMatthew Dillon /*
662b7d5e03cSMatthew Dillon * If eepromdata is not NULL, copy it it into ah_cal_mem.
663b7d5e03cSMatthew Dillon */
664b7d5e03cSMatthew Dillon if (eepromdata != NULL)
665b7d5e03cSMatthew Dillon OS_MEMCPY(AH9300(ah)->ah_cal_mem, eepromdata, HOST_CALDATA_SIZE);
666b7d5e03cSMatthew Dillon
667b7d5e03cSMatthew Dillon /* XXX FreeBSD: enable RX mitigation */
668b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_intr_mitigation_rx = 1;
669b7d5e03cSMatthew Dillon
670b7d5e03cSMatthew Dillon /* interrupt mitigation */
671b7d5e03cSMatthew Dillon #ifdef AR5416_INT_MITIGATION
672b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_intr_mitigation_rx != 0) {
673b7d5e03cSMatthew Dillon ahp->ah_intr_mitigation_rx = AH_TRUE;
674b7d5e03cSMatthew Dillon }
675b7d5e03cSMatthew Dillon #else
676b7d5e03cSMatthew Dillon /* Enable Rx mitigation (default) */
677b7d5e03cSMatthew Dillon ahp->ah_intr_mitigation_rx = AH_TRUE;
678b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_intr_mitigation_rx = 1;
679b7d5e03cSMatthew Dillon
680b7d5e03cSMatthew Dillon #endif
681b7d5e03cSMatthew Dillon #ifdef HOST_OFFLOAD
682b7d5e03cSMatthew Dillon /* Reset default Rx mitigation values for Hornet */
683b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah)) {
684b7d5e03cSMatthew Dillon ahp->ah_intr_mitigation_rx = AH_FALSE;
685b7d5e03cSMatthew Dillon #ifdef AR5416_INT_MITIGATION
686b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_intr_mitigation_rx = 0;
687b7d5e03cSMatthew Dillon #endif
688b7d5e03cSMatthew Dillon }
689b7d5e03cSMatthew Dillon #endif
690b7d5e03cSMatthew Dillon
691b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_intr_mitigation_tx != 0) {
692b7d5e03cSMatthew Dillon ahp->ah_intr_mitigation_tx = AH_TRUE;
693b7d5e03cSMatthew Dillon }
694b7d5e03cSMatthew Dillon
695b7d5e03cSMatthew Dillon /*
696b7d5e03cSMatthew Dillon * Read back AR_WA into a permanent copy and set bits 14 and 17.
697b7d5e03cSMatthew Dillon * We need to do this to avoid RMW of this register.
698b7d5e03cSMatthew Dillon * Do this before calling ar9300_set_reset_reg.
699b7d5e03cSMatthew Dillon * If not, the AR_WA register which was inited via EEPROM
700b7d5e03cSMatthew Dillon * will get wiped out.
701b7d5e03cSMatthew Dillon */
702b7d5e03cSMatthew Dillon ahp->ah_wa_reg_val = OS_REG_READ(ah, AR_HOSTIF_REG(ah, AR_WA));
703b7d5e03cSMatthew Dillon /* Set Bits 14 and 17 in the AR_WA register. */
704b7d5e03cSMatthew Dillon ahp->ah_wa_reg_val |=
705b7d5e03cSMatthew Dillon AR_WA_D3_TO_L1_DISABLE | AR_WA_ASPM_TIMER_BASED_DISABLE;
706b7d5e03cSMatthew Dillon
707b7d5e03cSMatthew Dillon if (!ar9300_set_reset_reg(ah, HAL_RESET_POWER_ON)) { /* reset chip */
708b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET, "%s: couldn't reset chip\n", __func__);
709b7d5e03cSMatthew Dillon ecode = HAL_EIO;
710b7d5e03cSMatthew Dillon goto bad;
711b7d5e03cSMatthew Dillon }
712b7d5e03cSMatthew Dillon
713b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah)
714b7d5e03cSMatthew Dillon #if ATH_WOW_OFFLOAD
715b7d5e03cSMatthew Dillon && !HAL_WOW_CTRL(ah, HAL_WOW_OFFLOAD_SET_4004_BIT14)
716b7d5e03cSMatthew Dillon #endif
717b7d5e03cSMatthew Dillon )
718b7d5e03cSMatthew Dillon {
719b7d5e03cSMatthew Dillon /* Jupiter doesn't need bit 14 to be set. */
720b7d5e03cSMatthew Dillon ahp->ah_wa_reg_val &= ~AR_WA_D3_TO_L1_DISABLE;
721b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, AR_HOSTIF_REG(ah, AR_WA), ahp->ah_wa_reg_val);
722b7d5e03cSMatthew Dillon }
723b7d5e03cSMatthew Dillon
724b7d5e03cSMatthew Dillon #if ATH_SUPPORT_MCI
725b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)) {
726b7d5e03cSMatthew Dillon #if 0
727b7d5e03cSMatthew Dillon ah->ah_bt_coex_set_weights = ar9300_mci_bt_coex_set_weights;
728b7d5e03cSMatthew Dillon ah->ah_bt_coex_disable = ar9300_mci_bt_coex_disable;
729b7d5e03cSMatthew Dillon ah->ah_bt_coex_enable = ar9300_mci_bt_coex_enable;
730b7d5e03cSMatthew Dillon #endif
731b7d5e03cSMatthew Dillon ahp->ah_mci_ready = AH_FALSE;
732b7d5e03cSMatthew Dillon ahp->ah_mci_bt_state = MCI_BT_SLEEP;
733b7d5e03cSMatthew Dillon ahp->ah_mci_coex_major_version_wlan = MCI_GPM_COEX_MAJOR_VERSION_WLAN;
734b7d5e03cSMatthew Dillon ahp->ah_mci_coex_minor_version_wlan = MCI_GPM_COEX_MINOR_VERSION_WLAN;
735b7d5e03cSMatthew Dillon ahp->ah_mci_coex_major_version_bt = MCI_GPM_COEX_MAJOR_VERSION_DEFAULT;
736b7d5e03cSMatthew Dillon ahp->ah_mci_coex_minor_version_bt = MCI_GPM_COEX_MINOR_VERSION_DEFAULT;
737b7d5e03cSMatthew Dillon ahp->ah_mci_coex_bt_version_known = AH_FALSE;
738b7d5e03cSMatthew Dillon ahp->ah_mci_coex_2g5g_update = AH_TRUE; /* track if 2g5g status sent */
739b7d5e03cSMatthew Dillon /* will be updated before boot up sequence */
740b7d5e03cSMatthew Dillon ahp->ah_mci_coex_is_2g = AH_TRUE;
741b7d5e03cSMatthew Dillon ahp->ah_mci_coex_wlan_channels_update = AH_FALSE;
742b7d5e03cSMatthew Dillon ahp->ah_mci_coex_wlan_channels[0] = 0x00000000;
743b7d5e03cSMatthew Dillon ahp->ah_mci_coex_wlan_channels[1] = 0xffffffff;
744b7d5e03cSMatthew Dillon ahp->ah_mci_coex_wlan_channels[2] = 0xffffffff;
745b7d5e03cSMatthew Dillon ahp->ah_mci_coex_wlan_channels[3] = 0x7fffffff;
746b7d5e03cSMatthew Dillon ahp->ah_mci_query_bt = AH_TRUE; /* In case WLAN start after BT */
747b7d5e03cSMatthew Dillon ahp->ah_mci_unhalt_bt_gpm = AH_TRUE; /* Send UNHALT at beginning */
748b7d5e03cSMatthew Dillon ahp->ah_mci_halted_bt_gpm = AH_FALSE; /* Allow first HALT */
749b7d5e03cSMatthew Dillon ahp->ah_mci_need_flush_btinfo = AH_FALSE;
750b7d5e03cSMatthew Dillon ahp->ah_mci_wlan_cal_seq = 0;
751b7d5e03cSMatthew Dillon ahp->ah_mci_wlan_cal_done = 0;
752b7d5e03cSMatthew Dillon }
753b7d5e03cSMatthew Dillon #endif /* ATH_SUPPORT_MCI */
754b7d5e03cSMatthew Dillon
755b7d5e03cSMatthew Dillon #if ATH_WOW_OFFLOAD
756b7d5e03cSMatthew Dillon ahp->ah_mcast_filter_l32_set = 0;
757b7d5e03cSMatthew Dillon ahp->ah_mcast_filter_u32_set = 0;
758b7d5e03cSMatthew Dillon #endif
759b7d5e03cSMatthew Dillon
760b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah)) {
761b7d5e03cSMatthew Dillon #ifdef AH_SUPPORT_HORNET
762b7d5e03cSMatthew Dillon if (!AR_SREV_HORNET_11(ah)) {
763b7d5e03cSMatthew Dillon /*
764b7d5e03cSMatthew Dillon * Do not check bootstrap register, which cannot be trusted
765b7d5e03cSMatthew Dillon * due to s26 switch issue on CUS164/AP121.
766b7d5e03cSMatthew Dillon */
767b7d5e03cSMatthew Dillon ahp->clk_25mhz = 1;
768b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE, "Bootstrap clock 25MHz\n");
769b7d5e03cSMatthew Dillon } else {
770b7d5e03cSMatthew Dillon /* check bootstrap clock setting */
771b7d5e03cSMatthew Dillon #define AR_SOC_SEL_25M_40M 0xB80600AC
772b7d5e03cSMatthew Dillon #define REG_WRITE(_reg, _val) *((volatile u_int32_t *)(_reg)) = (_val);
773b7d5e03cSMatthew Dillon #define REG_READ(_reg) (*((volatile u_int32_t *)(_reg)))
774b7d5e03cSMatthew Dillon if (REG_READ(AR_SOC_SEL_25M_40M) & 0x1) {
775b7d5e03cSMatthew Dillon ahp->clk_25mhz = 0;
776b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE,
777b7d5e03cSMatthew Dillon "Bootstrap clock 40MHz\n");
778b7d5e03cSMatthew Dillon } else {
779b7d5e03cSMatthew Dillon ahp->clk_25mhz = 1;
780b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE,
781b7d5e03cSMatthew Dillon "Bootstrap clock 25MHz\n");
782b7d5e03cSMatthew Dillon }
783b7d5e03cSMatthew Dillon #undef REG_READ
784b7d5e03cSMatthew Dillon #undef REG_WRITE
785b7d5e03cSMatthew Dillon #undef AR_SOC_SEL_25M_40M
786b7d5e03cSMatthew Dillon }
787b7d5e03cSMatthew Dillon #endif /* AH_SUPPORT_HORNET */
788b7d5e03cSMatthew Dillon }
789b7d5e03cSMatthew Dillon
790b7d5e03cSMatthew Dillon if (AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) {
791b7d5e03cSMatthew Dillon /* check bootstrap clock setting */
792b7d5e03cSMatthew Dillon #define AR9340_SOC_SEL_25M_40M 0xB80600B0
793b7d5e03cSMatthew Dillon #define AR9340_REF_CLK_40 (1 << 4) /* 0 - 25MHz 1 - 40 MHz */
794b7d5e03cSMatthew Dillon #define REG_READ(_reg) (*((volatile u_int32_t *)(_reg)))
795b7d5e03cSMatthew Dillon if (REG_READ(AR9340_SOC_SEL_25M_40M) & AR9340_REF_CLK_40) {
796b7d5e03cSMatthew Dillon ahp->clk_25mhz = 0;
797b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE, "Bootstrap clock 40MHz\n");
798b7d5e03cSMatthew Dillon } else {
799b7d5e03cSMatthew Dillon ahp->clk_25mhz = 1;
800b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE, "Bootstrap clock 25MHz\n");
801b7d5e03cSMatthew Dillon }
802b7d5e03cSMatthew Dillon #undef REG_READ
803b7d5e03cSMatthew Dillon #undef AR9340_SOC_SEL_25M_40M
804b7d5e03cSMatthew Dillon #undef AR9340_REF_CLK_40
805b7d5e03cSMatthew Dillon }
806*a20e5e51SMatthew Dillon
807*a20e5e51SMatthew Dillon if (AR_SREV_HONEYBEE(ah)) {
808*a20e5e51SMatthew Dillon ahp->clk_25mhz = 1;
809*a20e5e51SMatthew Dillon }
810*a20e5e51SMatthew Dillon
811b7d5e03cSMatthew Dillon ar9300_init_pll(ah, AH_NULL);
812b7d5e03cSMatthew Dillon
813b7d5e03cSMatthew Dillon if (!ar9300_set_power_mode(ah, HAL_PM_AWAKE, AH_TRUE)) {
814b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET, "%s: couldn't wakeup chip\n", __func__);
815b7d5e03cSMatthew Dillon ecode = HAL_EIO;
816b7d5e03cSMatthew Dillon goto bad;
817b7d5e03cSMatthew Dillon }
818b7d5e03cSMatthew Dillon
819b7d5e03cSMatthew Dillon /* No serialization of Register Accesses needed. */
820b7d5e03cSMatthew Dillon ah->ah_config.ah_serialise_reg_war = SER_REG_MODE_OFF;
821b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET, "%s: ah_serialise_reg_war is %d\n",
822b7d5e03cSMatthew Dillon __func__, ah->ah_config.ah_serialise_reg_war);
823b7d5e03cSMatthew Dillon
824b7d5e03cSMatthew Dillon /*
825b7d5e03cSMatthew Dillon * Add mac revision check when needed.
826b7d5e03cSMatthew Dillon * - Osprey 1.0 and 2.0 no longer supported.
827b7d5e03cSMatthew Dillon */
828b7d5e03cSMatthew Dillon if (((ahpriv->ah_macVersion == AR_SREV_VERSION_OSPREY) &&
829b7d5e03cSMatthew Dillon (ahpriv->ah_macRev <= AR_SREV_REVISION_OSPREY_20)) ||
830b7d5e03cSMatthew Dillon (ahpriv->ah_macVersion != AR_SREV_VERSION_OSPREY &&
831b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_WASP &&
832b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_HORNET &&
833b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_POSEIDON &&
834b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_SCORPION &&
835*a20e5e51SMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_HONEYBEE &&
836b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_JUPITER &&
837b7d5e03cSMatthew Dillon ahpriv->ah_macVersion != AR_SREV_VERSION_APHRODITE) ) {
838b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET,
839b7d5e03cSMatthew Dillon "%s: Mac Chip Rev 0x%02x.%x is not supported by this driver\n",
840b7d5e03cSMatthew Dillon __func__,
841b7d5e03cSMatthew Dillon ahpriv->ah_macVersion,
842b7d5e03cSMatthew Dillon ahpriv->ah_macRev);
843b7d5e03cSMatthew Dillon ecode = HAL_ENOTSUPP;
844b7d5e03cSMatthew Dillon goto bad;
845b7d5e03cSMatthew Dillon }
846b7d5e03cSMatthew Dillon
847b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_phyRev = OS_REG_READ(ah, AR_PHY_CHIP_ID);
848b7d5e03cSMatthew Dillon
849b7d5e03cSMatthew Dillon /* Setup supported calibrations */
850b7d5e03cSMatthew Dillon ahp->ah_iq_cal_data.cal_data = &iq_cal_single_sample;
851b7d5e03cSMatthew Dillon ahp->ah_supp_cals = IQ_MISMATCH_CAL;
852b7d5e03cSMatthew Dillon
853b7d5e03cSMatthew Dillon /* Enable ANI */
854b7d5e03cSMatthew Dillon ahp->ah_ani_function = HAL_ANI_ALL;
855b7d5e03cSMatthew Dillon
856b7d5e03cSMatthew Dillon /* Enable RIFS */
857b7d5e03cSMatthew Dillon ahp->ah_rifs_enabled = AH_TRUE;
858b7d5e03cSMatthew Dillon
859*a20e5e51SMatthew Dillon /* by default, stop RX also in abort txdma, due to
860*a20e5e51SMatthew Dillon "Unable to stop TxDMA" msg observed */
861*a20e5e51SMatthew Dillon ahp->ah_abort_txdma_norx = AH_TRUE;
862*a20e5e51SMatthew Dillon
863*a20e5e51SMatthew Dillon /* do not use optional tx chainmask by default */
864*a20e5e51SMatthew Dillon ahp->ah_tx_chainmaskopt = 0;
865*a20e5e51SMatthew Dillon
866*a20e5e51SMatthew Dillon ahp->ah_skip_rx_iq_cal = AH_FALSE;
867*a20e5e51SMatthew Dillon ahp->ah_rx_cal_complete = AH_FALSE;
868*a20e5e51SMatthew Dillon ahp->ah_rx_cal_chan = 0;
869*a20e5e51SMatthew Dillon ahp->ah_rx_cal_chan_flag = 0;
870*a20e5e51SMatthew Dillon
871b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET,
872b7d5e03cSMatthew Dillon "%s: This Mac Chip Rev 0x%02x.%x is \n", __func__,
873b7d5e03cSMatthew Dillon ahpriv->ah_macVersion,
874b7d5e03cSMatthew Dillon ahpriv->ah_macRev);
875b7d5e03cSMatthew Dillon
876b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
877b7d5e03cSMatthew Dillon /* mac */
878b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
879b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
880b7d5e03cSMatthew Dillon ar9331_hornet1_2_mac_core,
881b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_mac_core), 2);
882b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
883b7d5e03cSMatthew Dillon ar9331_hornet1_2_mac_postamble,
884b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_mac_postamble), 5);
885b7d5e03cSMatthew Dillon
886b7d5e03cSMatthew Dillon /* bb */
887b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
888b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
889b7d5e03cSMatthew Dillon ar9331_hornet1_2_baseband_core,
890b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_baseband_core), 2);
891b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
892b7d5e03cSMatthew Dillon ar9331_hornet1_2_baseband_postamble,
893b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_baseband_postamble), 5);
894b7d5e03cSMatthew Dillon
895b7d5e03cSMatthew Dillon /* radio */
896b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
897b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
898b7d5e03cSMatthew Dillon ar9331_hornet1_2_radio_core,
899b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_radio_core), 2);
900b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST], NULL, 0, 0);
901b7d5e03cSMatthew Dillon
902b7d5e03cSMatthew Dillon /* soc */
903b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
904b7d5e03cSMatthew Dillon ar9331_hornet1_2_soc_preamble,
905b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_soc_preamble), 2);
906b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
907b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
908b7d5e03cSMatthew Dillon ar9331_hornet1_2_soc_postamble,
909b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_soc_postamble), 2);
910b7d5e03cSMatthew Dillon
911b7d5e03cSMatthew Dillon /* rx/tx gain */
912b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
913b7d5e03cSMatthew Dillon ar9331_common_rx_gain_hornet1_2,
914b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_rx_gain_hornet1_2), 2);
915b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
916b7d5e03cSMatthew Dillon ar9331_modes_lowest_ob_db_tx_gain_hornet1_2,
917b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_lowest_ob_db_tx_gain_hornet1_2), 5);
918b7d5e03cSMatthew Dillon
919b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
920b7d5e03cSMatthew Dillon
921b7d5e03cSMatthew Dillon /* Japan 2484Mhz CCK settings */
922b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
923b7d5e03cSMatthew Dillon ar9331_hornet1_2_baseband_core_txfir_coeff_japan_2484,
924b7d5e03cSMatthew Dillon ARRAY_LENGTH(
925b7d5e03cSMatthew Dillon ar9331_hornet1_2_baseband_core_txfir_coeff_japan_2484), 2);
926b7d5e03cSMatthew Dillon
927b7d5e03cSMatthew Dillon #if 0 /* ATH_WOW */
928b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
929b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_awow,
930b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_awow), 2);
931b7d5e03cSMatthew Dillon #endif
932b7d5e03cSMatthew Dillon
933b7d5e03cSMatthew Dillon /* additional clock settings */
934b7d5e03cSMatthew Dillon if (AH9300(ah)->clk_25mhz) {
935b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
936b7d5e03cSMatthew Dillon ar9331_hornet1_2_xtal_25M,
937b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_xtal_25M), 2);
938b7d5e03cSMatthew Dillon } else {
939b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
940b7d5e03cSMatthew Dillon ar9331_hornet1_2_xtal_40M,
941b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_2_xtal_40M), 2);
942b7d5e03cSMatthew Dillon }
943b7d5e03cSMatthew Dillon
944b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
945b7d5e03cSMatthew Dillon /* mac */
946b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
947b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
948b7d5e03cSMatthew Dillon ar9331_hornet1_1_mac_core,
949b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_mac_core), 2);
950b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
951b7d5e03cSMatthew Dillon ar9331_hornet1_1_mac_postamble,
952b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_mac_postamble), 5);
953b7d5e03cSMatthew Dillon
954b7d5e03cSMatthew Dillon /* bb */
955b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
956b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
957b7d5e03cSMatthew Dillon ar9331_hornet1_1_baseband_core,
958b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_baseband_core), 2);
959b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
960b7d5e03cSMatthew Dillon ar9331_hornet1_1_baseband_postamble,
961b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_baseband_postamble), 5);
962b7d5e03cSMatthew Dillon
963b7d5e03cSMatthew Dillon /* radio */
964b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
965b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
966b7d5e03cSMatthew Dillon ar9331_hornet1_1_radio_core,
967b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_radio_core), 2);
968b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST], NULL, 0, 0);
969b7d5e03cSMatthew Dillon
970b7d5e03cSMatthew Dillon /* soc */
971b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
972b7d5e03cSMatthew Dillon ar9331_hornet1_1_soc_preamble,
973b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_soc_preamble), 2);
974b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
975b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
976b7d5e03cSMatthew Dillon ar9331_hornet1_1_soc_postamble,
977b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_soc_postamble), 2);
978b7d5e03cSMatthew Dillon
979b7d5e03cSMatthew Dillon /* rx/tx gain */
980b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
981b7d5e03cSMatthew Dillon ar9331_common_rx_gain_hornet1_1,
982b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_rx_gain_hornet1_1), 2);
983b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
984b7d5e03cSMatthew Dillon ar9331_modes_lowest_ob_db_tx_gain_hornet1_1,
985b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_lowest_ob_db_tx_gain_hornet1_1), 5);
986b7d5e03cSMatthew Dillon
987b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
988b7d5e03cSMatthew Dillon
989b7d5e03cSMatthew Dillon /* Japan 2484Mhz CCK settings */
990b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
991b7d5e03cSMatthew Dillon ar9331_hornet1_1_baseband_core_txfir_coeff_japan_2484,
992b7d5e03cSMatthew Dillon ARRAY_LENGTH(
993b7d5e03cSMatthew Dillon ar9331_hornet1_1_baseband_core_txfir_coeff_japan_2484), 2);
994b7d5e03cSMatthew Dillon
995b7d5e03cSMatthew Dillon #if 0 /* ATH_WOW */
996b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
997b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_awow,
998b7d5e03cSMatthew Dillon N(ar9300_pcie_phy_awow), 2);
999b7d5e03cSMatthew Dillon #endif
1000b7d5e03cSMatthew Dillon
1001b7d5e03cSMatthew Dillon /* additional clock settings */
1002b7d5e03cSMatthew Dillon if (AH9300(ah)->clk_25mhz) {
1003b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1004b7d5e03cSMatthew Dillon ar9331_hornet1_1_xtal_25M,
1005b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_xtal_25M), 2);
1006b7d5e03cSMatthew Dillon } else {
1007b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1008b7d5e03cSMatthew Dillon ar9331_hornet1_1_xtal_40M,
1009b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_hornet1_1_xtal_40M), 2);
1010b7d5e03cSMatthew Dillon }
1011b7d5e03cSMatthew Dillon
1012b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
1013b7d5e03cSMatthew Dillon /* mac */
1014b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1015b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1016b7d5e03cSMatthew Dillon ar9485_poseidon1_1_mac_core,
1017b7d5e03cSMatthew Dillon ARRAY_LENGTH( ar9485_poseidon1_1_mac_core), 2);
1018b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1019b7d5e03cSMatthew Dillon ar9485_poseidon1_1_mac_postamble,
1020b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_mac_postamble), 5);
1021b7d5e03cSMatthew Dillon
1022b7d5e03cSMatthew Dillon /* bb */
1023b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE],
1024b7d5e03cSMatthew Dillon ar9485_poseidon1_1, ARRAY_LENGTH(ar9485_poseidon1_1), 2);
1025b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1026b7d5e03cSMatthew Dillon ar9485_poseidon1_1_baseband_core,
1027b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_baseband_core), 2);
1028b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1029b7d5e03cSMatthew Dillon ar9485_poseidon1_1_baseband_postamble,
1030b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_baseband_postamble), 5);
1031b7d5e03cSMatthew Dillon
1032b7d5e03cSMatthew Dillon /* radio */
1033b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1034b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1035b7d5e03cSMatthew Dillon ar9485_poseidon1_1_radio_core,
1036b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_radio_core), 2);
1037b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1038b7d5e03cSMatthew Dillon ar9485_poseidon1_1_radio_postamble,
1039b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_radio_postamble), 2);
1040b7d5e03cSMatthew Dillon
1041b7d5e03cSMatthew Dillon /* soc */
1042b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1043b7d5e03cSMatthew Dillon ar9485_poseidon1_1_soc_preamble,
1044b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_soc_preamble), 2);
1045b7d5e03cSMatthew Dillon
1046b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1047b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST], NULL, 0, 0);
1048b7d5e03cSMatthew Dillon
1049b7d5e03cSMatthew Dillon /* rx/tx gain */
1050b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1051b7d5e03cSMatthew Dillon ar9485_common_wo_xlna_rx_gain_poseidon1_1,
1052b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_common_wo_xlna_rx_gain_poseidon1_1), 2);
1053b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1054b7d5e03cSMatthew Dillon ar9485_modes_lowest_ob_db_tx_gain_poseidon1_1,
1055b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_modes_lowest_ob_db_tx_gain_poseidon1_1), 5);
1056b7d5e03cSMatthew Dillon
1057b7d5e03cSMatthew Dillon /* Japan 2484Mhz CCK settings */
1058b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
1059b7d5e03cSMatthew Dillon ar9485_poseidon1_1_baseband_core_txfir_coeff_japan_2484,
1060b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1061b7d5e03cSMatthew Dillon ar9485_poseidon1_1_baseband_core_txfir_coeff_japan_2484), 2);
1062b7d5e03cSMatthew Dillon
1063b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
1064b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
1065b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 1 */
1066b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save
1067b7d5e03cSMatthew Dillon & AR_PCIE_PLL_PWRSAVE_CONTROL)
1068b7d5e03cSMatthew Dillon {
1069b7d5e03cSMatthew Dillon /* Sleep Setting */
1070b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1071b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1072b7d5e03cSMatthew Dillon {
1073b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1074b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1,
1075b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1076b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1),
1077b7d5e03cSMatthew Dillon 2);
1078b7d5e03cSMatthew Dillon } else {
1079b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1080b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_enable_L1,
1081b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1082b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_enable_L1),
1083b7d5e03cSMatthew Dillon 2);
1084b7d5e03cSMatthew Dillon }
1085b7d5e03cSMatthew Dillon /* Awake Setting */
1086b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1087b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1088b7d5e03cSMatthew Dillon {
1089b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1090b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1,
1091b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1092b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1),
1093b7d5e03cSMatthew Dillon 2);
1094b7d5e03cSMatthew Dillon } else {
1095b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1096b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_enable_L1,
1097b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1098b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_enable_L1),
1099b7d5e03cSMatthew Dillon 2);
1100b7d5e03cSMatthew Dillon }
1101b7d5e03cSMatthew Dillon
1102b7d5e03cSMatthew Dillon } else {
1103b7d5e03cSMatthew Dillon /*Use driver default setting*/
1104b7d5e03cSMatthew Dillon /* Sleep Setting */
1105b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1106b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1,
1107b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1),
1108b7d5e03cSMatthew Dillon 2);
1109b7d5e03cSMatthew Dillon /* Awake Setting */
1110b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1111b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1,
1112b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_pcie_phy_clkreq_enable_L1),
1113b7d5e03cSMatthew Dillon 2);
1114b7d5e03cSMatthew Dillon }
1115b7d5e03cSMatthew Dillon } else {
1116b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 0 */
1117b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save
1118b7d5e03cSMatthew Dillon & AR_PCIE_PLL_PWRSAVE_CONTROL)
1119b7d5e03cSMatthew Dillon {
1120b7d5e03cSMatthew Dillon /* Sleep Setting */
1121b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1122b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1123b7d5e03cSMatthew Dillon {
1124b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1125b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1,
1126b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1127b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1),
1128b7d5e03cSMatthew Dillon 2);
1129b7d5e03cSMatthew Dillon } else {
1130b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1131b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_disable_L1,
1132b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1133b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_disable_L1),
1134b7d5e03cSMatthew Dillon 2);
1135b7d5e03cSMatthew Dillon }
1136b7d5e03cSMatthew Dillon /* Awake Setting */
1137b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1138b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1139b7d5e03cSMatthew Dillon {
1140b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1141b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1,
1142b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1143b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1),
1144b7d5e03cSMatthew Dillon 2);
1145b7d5e03cSMatthew Dillon } else {
1146b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1147b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_disable_L1,
1148b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1149b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_pll_on_clkreq_disable_L1),
1150b7d5e03cSMatthew Dillon 2);
1151b7d5e03cSMatthew Dillon }
1152b7d5e03cSMatthew Dillon
1153b7d5e03cSMatthew Dillon } else {
1154b7d5e03cSMatthew Dillon /*Use driver default setting*/
1155b7d5e03cSMatthew Dillon /* Sleep Setting */
1156b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1157b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1,
1158b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1),
1159b7d5e03cSMatthew Dillon 2);
1160b7d5e03cSMatthew Dillon /* Awake Setting */
1161b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1162b7d5e03cSMatthew Dillon ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1,
1163b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_1_pcie_phy_clkreq_disable_L1),
1164b7d5e03cSMatthew Dillon 2);
1165b7d5e03cSMatthew Dillon }
1166b7d5e03cSMatthew Dillon }
1167b7d5e03cSMatthew Dillon /* pcie ps setting will honor registry setting, default is 0 */
1168b7d5e03cSMatthew Dillon //ah->ah_config.ath_hal_pciePowerSaveEnable = 0;
1169b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
1170b7d5e03cSMatthew Dillon /* mac */
1171b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1172b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1173b7d5e03cSMatthew Dillon ar9485_poseidon1_0_mac_core,
1174b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_mac_core), 2);
1175b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1176b7d5e03cSMatthew Dillon ar9485_poseidon1_0_mac_postamble,
1177b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_mac_postamble), 5);
1178b7d5e03cSMatthew Dillon
1179b7d5e03cSMatthew Dillon /* bb */
1180b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE],
1181b7d5e03cSMatthew Dillon ar9485_poseidon1_0,
1182b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0), 2);
1183b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1184b7d5e03cSMatthew Dillon ar9485_poseidon1_0_baseband_core,
1185b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_baseband_core), 2);
1186b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1187b7d5e03cSMatthew Dillon ar9485_poseidon1_0_baseband_postamble,
1188b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_baseband_postamble), 5);
1189b7d5e03cSMatthew Dillon
1190b7d5e03cSMatthew Dillon /* radio */
1191b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1192b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1193b7d5e03cSMatthew Dillon ar9485_poseidon1_0_radio_core,
1194b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_radio_core), 2);
1195b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1196b7d5e03cSMatthew Dillon ar9485_poseidon1_0_radio_postamble,
1197b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_radio_postamble), 2);
1198b7d5e03cSMatthew Dillon
1199b7d5e03cSMatthew Dillon /* soc */
1200b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1201b7d5e03cSMatthew Dillon ar9485_poseidon1_0_soc_preamble,
1202b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_poseidon1_0_soc_preamble), 2);
1203b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1204b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST], NULL, 0, 0);
1205b7d5e03cSMatthew Dillon
1206b7d5e03cSMatthew Dillon /* rx/tx gain */
1207b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1208b7d5e03cSMatthew Dillon ar9485Common_wo_xlna_rx_gain_poseidon1_0,
1209b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Common_wo_xlna_rx_gain_poseidon1_0), 2);
1210b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1211b7d5e03cSMatthew Dillon ar9485Modes_lowest_ob_db_tx_gain_poseidon1_0,
1212b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Modes_lowest_ob_db_tx_gain_poseidon1_0), 5);
1213b7d5e03cSMatthew Dillon
1214b7d5e03cSMatthew Dillon /* Japan 2484Mhz CCK settings */
1215b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
1216b7d5e03cSMatthew Dillon ar9485_poseidon1_0_baseband_core_txfir_coeff_japan_2484,
1217b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1218b7d5e03cSMatthew Dillon ar9485_poseidon1_0_baseband_core_txfir_coeff_japan_2484), 2);
1219b7d5e03cSMatthew Dillon
1220b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
1221b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
1222b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 1 */
1223b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save
1224b7d5e03cSMatthew Dillon & AR_PCIE_PLL_PWRSAVE_CONTROL)
1225b7d5e03cSMatthew Dillon {
1226b7d5e03cSMatthew Dillon /* Sleep Setting */
1227b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1228b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1229b7d5e03cSMatthew Dillon {
1230b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1231b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_enable_L1,
1232b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1233b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_enable_L1),
1234b7d5e03cSMatthew Dillon 2);
1235b7d5e03cSMatthew Dillon } else {
1236b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1237b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1,
1238b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1239b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1),
1240b7d5e03cSMatthew Dillon 2);
1241b7d5e03cSMatthew Dillon }
1242b7d5e03cSMatthew Dillon /* Awake Setting */
1243b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1244b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1245b7d5e03cSMatthew Dillon {
1246b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1247b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_enable_L1,
1248b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1249b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_enable_L1),
1250b7d5e03cSMatthew Dillon 2);
1251b7d5e03cSMatthew Dillon } else {
1252b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1253b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1,
1254b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1255b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1),
1256b7d5e03cSMatthew Dillon 2);
1257b7d5e03cSMatthew Dillon }
1258b7d5e03cSMatthew Dillon
1259b7d5e03cSMatthew Dillon } else {
1260b7d5e03cSMatthew Dillon /*Use driver default setting*/
1261b7d5e03cSMatthew Dillon /* Sleep Setting */
1262b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1263b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1,
1264b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1265b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1),
1266b7d5e03cSMatthew Dillon 2);
1267b7d5e03cSMatthew Dillon /* Awake Setting */
1268b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1269b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1,
1270b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1271b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_enable_L1),
1272b7d5e03cSMatthew Dillon 2);
1273b7d5e03cSMatthew Dillon }
1274b7d5e03cSMatthew Dillon } else {
1275b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 0 */
1276b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save
1277b7d5e03cSMatthew Dillon & AR_PCIE_PLL_PWRSAVE_CONTROL)
1278b7d5e03cSMatthew Dillon {
1279b7d5e03cSMatthew Dillon /* Sleep Setting */
1280b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1281b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1282b7d5e03cSMatthew Dillon {
1283b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1284b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_disable_L1,
1285b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1286b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_disable_L1),
1287b7d5e03cSMatthew Dillon 2);
1288b7d5e03cSMatthew Dillon } else {
1289b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1290b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1,
1291b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1292b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1),
1293b7d5e03cSMatthew Dillon 2);
1294b7d5e03cSMatthew Dillon }
1295b7d5e03cSMatthew Dillon /* Awake Setting */
1296b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1297b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1298b7d5e03cSMatthew Dillon {
1299b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1300b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_disable_L1,
1301b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1302b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_clkreq_disable_L1),
1303b7d5e03cSMatthew Dillon 2);
1304b7d5e03cSMatthew Dillon } else {
1305b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1306b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1,
1307b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1308b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1),
1309b7d5e03cSMatthew Dillon 2);
1310b7d5e03cSMatthew Dillon }
1311b7d5e03cSMatthew Dillon
1312b7d5e03cSMatthew Dillon } else {
1313b7d5e03cSMatthew Dillon /*Use driver default setting*/
1314b7d5e03cSMatthew Dillon /* Sleep Setting */
1315b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1316b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1,
1317b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1318b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1),
1319b7d5e03cSMatthew Dillon 2);
1320b7d5e03cSMatthew Dillon /* Awake Setting */
1321b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1322b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1,
1323b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1324b7d5e03cSMatthew Dillon ar9485_poseidon1_0_pcie_phy_pll_on_clkreq_disable_L1),
1325b7d5e03cSMatthew Dillon 2);
1326b7d5e03cSMatthew Dillon }
1327b7d5e03cSMatthew Dillon }
1328b7d5e03cSMatthew Dillon /* pcie ps setting will honor registry setting, default is 0 */
1329b7d5e03cSMatthew Dillon /*ah->ah_config.ath_hal_pcie_power_save_enable = 0;*/
1330b7d5e03cSMatthew Dillon
1331b7d5e03cSMatthew Dillon #if 0 /* ATH_WOW */
1332b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
1333b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_awow,
1334b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_awow), 2);
1335b7d5e03cSMatthew Dillon #endif
1336b7d5e03cSMatthew Dillon
1337b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
1338b7d5e03cSMatthew Dillon /* mac */
1339b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1340b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1341b7d5e03cSMatthew Dillon ar9340_wasp_1p0_mac_core,
1342b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_mac_core), 2);
1343b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1344b7d5e03cSMatthew Dillon ar9340_wasp_1p0_mac_postamble,
1345b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_mac_postamble), 5);
1346b7d5e03cSMatthew Dillon
1347b7d5e03cSMatthew Dillon /* bb */
1348b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1349b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1350b7d5e03cSMatthew Dillon ar9340_wasp_1p0_baseband_core,
1351b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_baseband_core), 2);
1352b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1353b7d5e03cSMatthew Dillon ar9340_wasp_1p0_baseband_postamble,
1354b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_baseband_postamble), 5);
1355b7d5e03cSMatthew Dillon
1356b7d5e03cSMatthew Dillon /* radio */
1357b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1358b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1359b7d5e03cSMatthew Dillon ar9340_wasp_1p0_radio_core,
1360b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_radio_core), 2);
1361b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1362b7d5e03cSMatthew Dillon ar9340_wasp_1p0_radio_postamble,
1363b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_radio_postamble), 5);
1364b7d5e03cSMatthew Dillon
1365b7d5e03cSMatthew Dillon /* soc */
1366b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1367b7d5e03cSMatthew Dillon ar9340_wasp_1p0_soc_preamble,
1368b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_soc_preamble), 2);
1369b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1370b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1371b7d5e03cSMatthew Dillon ar9340_wasp_1p0_soc_postamble,
1372b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_soc_postamble), 5);
1373b7d5e03cSMatthew Dillon
1374b7d5e03cSMatthew Dillon /* rx/tx gain */
1375b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1376b7d5e03cSMatthew Dillon ar9340Common_wo_xlna_rx_gain_table_wasp_1p0,
1377b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Common_wo_xlna_rx_gain_table_wasp_1p0), 2);
1378b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1379b7d5e03cSMatthew Dillon ar9340Modes_high_ob_db_tx_gain_table_wasp_1p0,
1380b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_high_ob_db_tx_gain_table_wasp_1p0), 5);
1381b7d5e03cSMatthew Dillon
1382b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1383b7d5e03cSMatthew Dillon
1384b7d5e03cSMatthew Dillon /* Fast clock modal settings */
1385b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1386b7d5e03cSMatthew Dillon ar9340Modes_fast_clock_wasp_1p0,
1387b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_fast_clock_wasp_1p0), 3);
1388b7d5e03cSMatthew Dillon
1389*a20e5e51SMatthew Dillon /* XXX TODO: need to add this for freebsd; it's missing from the current .ini files */
1390*a20e5e51SMatthew Dillon #if 0
1391*a20e5e51SMatthew Dillon /* Japan 2484Mhz CCK settings */
1392*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
1393*a20e5e51SMatthew Dillon ar9340_wasp_1p0_baseband_core_txfir_coeff_japan_2484,
1394*a20e5e51SMatthew Dillon ARRAY_LENGTH(
1395*a20e5e51SMatthew Dillon ar9340_wasp_1p0_baseband_core_txfir_coeff_japan_2484), 2);
1396*a20e5e51SMatthew Dillon #endif
1397*a20e5e51SMatthew Dillon
1398b7d5e03cSMatthew Dillon /* Additional setttings for 40Mhz */
1399b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional_40mhz,
1400b7d5e03cSMatthew Dillon ar9340_wasp_1p0_radio_core_40M,
1401b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_radio_core_40M), 2);
1402b7d5e03cSMatthew Dillon
1403b7d5e03cSMatthew Dillon /* DFS */
1404b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_dfs,
1405b7d5e03cSMatthew Dillon ar9340_wasp_1p0_baseband_postamble_dfs_channel,
1406b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340_wasp_1p0_baseband_postamble_dfs_channel), 3);
1407b7d5e03cSMatthew Dillon } else if (AR_SREV_SCORPION(ah)) {
1408b7d5e03cSMatthew Dillon /* mac */
1409b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1410b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1411b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_mac_core,
1412b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_mac_core), 2);
1413b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1414b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_mac_postamble,
1415b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_mac_postamble), 5);
1416b7d5e03cSMatthew Dillon
1417b7d5e03cSMatthew Dillon /* bb */
1418b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1419b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1420b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_baseband_core,
1421b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_baseband_core), 2);
1422b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1423b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_baseband_postamble,
1424b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_baseband_postamble), 5);
1425b7d5e03cSMatthew Dillon
1426b7d5e03cSMatthew Dillon /* radio */
1427b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1428b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1429b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_radio_core,
1430b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_radio_core), 2);
1431b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1432b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_radio_postamble,
1433b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_radio_postamble), 5);
1434b7d5e03cSMatthew Dillon
1435b7d5e03cSMatthew Dillon /* soc */
1436b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1437b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_soc_preamble,
1438b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_soc_preamble), 2);
1439b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1440b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1441b7d5e03cSMatthew Dillon ar955x_scorpion_1p0_soc_postamble,
1442b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955x_scorpion_1p0_soc_postamble), 5);
1443b7d5e03cSMatthew Dillon
1444b7d5e03cSMatthew Dillon /* rx/tx gain */
1445b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1446b7d5e03cSMatthew Dillon ar955xCommon_wo_xlna_rx_gain_table_scorpion_1p0,
1447b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_wo_xlna_rx_gain_table_scorpion_1p0), 2);
1448b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
1449b7d5e03cSMatthew Dillon ar955xCommon_wo_xlna_rx_gain_bounds_scorpion_1p0,
1450b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_wo_xlna_rx_gain_bounds_scorpion_1p0), 5);
1451b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1452b7d5e03cSMatthew Dillon ar955xModes_no_xpa_tx_gain_table_scorpion_1p0,
1453b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xModes_no_xpa_tx_gain_table_scorpion_1p0), 5);
1454b7d5e03cSMatthew Dillon
1455b7d5e03cSMatthew Dillon /*ath_hal_pciePowerSaveEnable should be 2 for OWL/Condor and 0 for merlin */
1456b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1457b7d5e03cSMatthew Dillon
1458b7d5e03cSMatthew Dillon /* Fast clock modal settings */
1459b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1460b7d5e03cSMatthew Dillon ar955xModes_fast_clock_scorpion_1p0,
1461b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xModes_fast_clock_scorpion_1p0), 3);
1462b7d5e03cSMatthew Dillon
1463b7d5e03cSMatthew Dillon /* Additional setttings for 40Mhz */
1464b7d5e03cSMatthew Dillon //INIT_INI_ARRAY(&ahp->ah_ini_modes_additional_40M,
1465b7d5e03cSMatthew Dillon // ar955x_scorpion_1p0_radio_core_40M,
1466b7d5e03cSMatthew Dillon // ARRAY_LENGTH(ar955x_scorpion_1p0_radio_core_40M), 2);
1467*a20e5e51SMatthew Dillon } else if (AR_SREV_HONEYBEE(ah)) {
1468*a20e5e51SMatthew Dillon /* mac */
1469*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1470*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1471*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_mac_core,
1472*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_mac_core), 2);
1473*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1474*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_mac_postamble,
1475*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_mac_postamble), 5);
1476*a20e5e51SMatthew Dillon
1477*a20e5e51SMatthew Dillon /* bb */
1478*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1479*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1480*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_baseband_core,
1481*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_baseband_core), 2);
1482*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1483*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_baseband_postamble,
1484*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_baseband_postamble), 5);
1485*a20e5e51SMatthew Dillon
1486*a20e5e51SMatthew Dillon /* radio */
1487*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1488*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1489*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_radio_core,
1490*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_radio_core), 2);
1491*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1492*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_radio_postamble,
1493*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_radio_postamble), 5);
1494*a20e5e51SMatthew Dillon
1495*a20e5e51SMatthew Dillon /* soc */
1496*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1497*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_soc_preamble,
1498*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_soc_preamble), 2);
1499*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1500*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1501*a20e5e51SMatthew Dillon qca953x_honeybee_1p0_soc_postamble,
1502*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953x_honeybee_1p0_soc_postamble), 5);
1503*a20e5e51SMatthew Dillon
1504*a20e5e51SMatthew Dillon /* rx/tx gain */
1505*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1506*a20e5e51SMatthew Dillon qca953xCommon_wo_xlna_rx_gain_table_honeybee_1p0,
1507*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_wo_xlna_rx_gain_table_honeybee_1p0), 2);
1508*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
1509*a20e5e51SMatthew Dillon qca953xCommon_wo_xlna_rx_gain_bounds_honeybee_1p0,
1510*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_wo_xlna_rx_gain_bounds_honeybee_1p0), 5);
1511*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1512*a20e5e51SMatthew Dillon qca953xModes_no_xpa_tx_gain_table_honeybee_1p0,
1513*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xModes_no_xpa_tx_gain_table_honeybee_1p0), 2);
1514*a20e5e51SMatthew Dillon
1515*a20e5e51SMatthew Dillon /*ath_hal_pciePowerSaveEnable should be 2 for OWL/Condor and 0 for merlin */
1516*a20e5e51SMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1517*a20e5e51SMatthew Dillon
1518*a20e5e51SMatthew Dillon /* Fast clock modal settings */
1519*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1520*a20e5e51SMatthew Dillon qca953xModes_fast_clock_honeybee_1p0,
1521*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xModes_fast_clock_honeybee_1p0), 3);
1522*a20e5e51SMatthew Dillon
1523*a20e5e51SMatthew Dillon /* Additional setttings for 40Mhz */
1524*a20e5e51SMatthew Dillon //INIT_INI_ARRAY(&ahp->ah_ini_modes_additional_40M,
1525*a20e5e51SMatthew Dillon // qca953x_honeybee_1p0_radio_core_40M,
1526*a20e5e51SMatthew Dillon // ARRAY_LENGTH(qca953x_honeybee_1p0_radio_core_40M), 2);
1527*a20e5e51SMatthew Dillon
1528b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_10(ah)) {
1529b7d5e03cSMatthew Dillon /* Jupiter: new INI format (pre, core, post arrays per subsystem) */
1530b7d5e03cSMatthew Dillon
1531b7d5e03cSMatthew Dillon /* mac */
1532b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1533b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1534b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_mac_core,
1535b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_mac_core), 2);
1536b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1537b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_mac_postamble,
1538b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_mac_postamble), 5);
1539b7d5e03cSMatthew Dillon
1540b7d5e03cSMatthew Dillon /* bb */
1541b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1542b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1543b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_baseband_core,
1544b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_baseband_core), 2);
1545b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1546b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_baseband_postamble,
1547b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_baseband_postamble), 5);
1548b7d5e03cSMatthew Dillon
1549b7d5e03cSMatthew Dillon /* radio */
1550b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1551b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1552b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_radio_core,
1553b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_radio_core), 2);
1554b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1555b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_radio_postamble,
1556b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_radio_postamble), 5);
1557b7d5e03cSMatthew Dillon
1558b7d5e03cSMatthew Dillon /* soc */
1559b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1560b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_soc_preamble,
1561b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_soc_preamble), 2);
1562b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1563b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1564b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_soc_postamble,
1565b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_1p0_soc_postamble), 5);
1566b7d5e03cSMatthew Dillon
1567b7d5e03cSMatthew Dillon /* rx/tx gain */
1568b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1569b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_jupiter_1p0,
1570b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_jupiter_1p0), 2);
1571b7d5e03cSMatthew Dillon
1572b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
1573b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
1574b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 1 */
1575b7d5e03cSMatthew Dillon /*
1576b7d5e03cSMatthew Dillon * PLL ON + clkreq enable is not a valid combination,
1577b7d5e03cSMatthew Dillon * thus to ignore ath_hal_pll_pwr_save, use PLL OFF.
1578b7d5e03cSMatthew Dillon */
1579b7d5e03cSMatthew Dillon {
1580b7d5e03cSMatthew Dillon /*Use driver default setting*/
1581b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1582b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1583b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_enable_L1_jupiter_1p0,
1584b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_clkreq_enable_L1_jupiter_1p0),
1585b7d5e03cSMatthew Dillon 2);
1586b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1587b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1588b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_enable_L1_jupiter_1p0,
1589b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_clkreq_enable_L1_jupiter_1p0),
1590b7d5e03cSMatthew Dillon 2);
1591b7d5e03cSMatthew Dillon }
1592b7d5e03cSMatthew Dillon }
1593b7d5e03cSMatthew Dillon else {
1594b7d5e03cSMatthew Dillon /*
1595b7d5e03cSMatthew Dillon * Since Jupiter 1.0 and 2.0 share the same device id and will be
1596b7d5e03cSMatthew Dillon * installed with same INF, but Jupiter 1.0 has issue with PLL OFF.
1597b7d5e03cSMatthew Dillon *
1598b7d5e03cSMatthew Dillon * Force Jupiter 1.0 to use ON/ON setting.
1599b7d5e03cSMatthew Dillon */
1600b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pll_pwr_save = 0;
1601b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 0 */
1602b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1603b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
1604b7d5e03cSMatthew Dillon {
1605b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1606b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1607b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1608b7d5e03cSMatthew Dillon {
1609b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1610b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_disable_L1_jupiter_1p0,
1611b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1612b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_disable_L1_jupiter_1p0),
1613b7d5e03cSMatthew Dillon 2);
1614b7d5e03cSMatthew Dillon }
1615b7d5e03cSMatthew Dillon else {
1616b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1617b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0,
1618b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1619b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0),
1620b7d5e03cSMatthew Dillon 2);
1621b7d5e03cSMatthew Dillon }
1622b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1623b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1624b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1625b7d5e03cSMatthew Dillon {
1626b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1627b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_disable_L1_jupiter_1p0,
1628b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1629b7d5e03cSMatthew Dillon ar9300_pcie_phy_clkreq_disable_L1_jupiter_1p0),
1630b7d5e03cSMatthew Dillon 2);
1631b7d5e03cSMatthew Dillon }
1632b7d5e03cSMatthew Dillon else {
1633b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1634b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0,
1635b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1636b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0),
1637b7d5e03cSMatthew Dillon 2);
1638b7d5e03cSMatthew Dillon }
1639b7d5e03cSMatthew Dillon
1640b7d5e03cSMatthew Dillon }
1641b7d5e03cSMatthew Dillon else {
1642b7d5e03cSMatthew Dillon /*Use driver default setting*/
1643b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1644b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1645b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0,
1646b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1647b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0),
1648b7d5e03cSMatthew Dillon 2);
1649b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1650b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1651b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0,
1652b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1653b7d5e03cSMatthew Dillon ar9300_pcie_phy_pll_on_clkreq_disable_L1_jupiter_1p0),
1654b7d5e03cSMatthew Dillon 2);
1655b7d5e03cSMatthew Dillon }
1656b7d5e03cSMatthew Dillon }
1657b7d5e03cSMatthew Dillon /*
1658b7d5e03cSMatthew Dillon * ath_hal_pcie_power_save_enable should be 2 for OWL/Condor and
1659b7d5e03cSMatthew Dillon * 0 for merlin
1660b7d5e03cSMatthew Dillon */
1661b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1662b7d5e03cSMatthew Dillon
1663b7d5e03cSMatthew Dillon #if 0 // ATH_WOW
1664b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
1665b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_AWOW,
1666b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_AWOW), 2);
1667b7d5e03cSMatthew Dillon #endif
1668b7d5e03cSMatthew Dillon
1669b7d5e03cSMatthew Dillon /* Fast clock modal settings */
1670b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1671b7d5e03cSMatthew Dillon ar9300_modes_fast_clock_jupiter_1p0,
1672b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_modes_fast_clock_jupiter_1p0), 3);
1673b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
1674b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_baseband_core_txfir_coeff_japan_2484,
1675b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1676b7d5e03cSMatthew Dillon ar9300_jupiter_1p0_baseband_core_txfir_coeff_japan_2484), 2);
1677b7d5e03cSMatthew Dillon
1678b7d5e03cSMatthew Dillon }
1679b7d5e03cSMatthew Dillon else if (AR_SREV_JUPITER_20(ah)) {
1680b7d5e03cSMatthew Dillon /* Jupiter: new INI format (pre, core, post arrays per subsystem) */
1681b7d5e03cSMatthew Dillon
1682*a20e5e51SMatthew Dillon /* FreeBSD: just override the registers for jupiter 2.1 */
1683*a20e5e51SMatthew Dillon
1684b7d5e03cSMatthew Dillon /* mac */
1685b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1686*a20e5e51SMatthew Dillon
1687*a20e5e51SMatthew Dillon if (AR_SREV_JUPITER_21(ah)) {
1688*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1689*a20e5e51SMatthew Dillon ar9462_2p1_mac_core,
1690*a20e5e51SMatthew Dillon ARRAY_LENGTH(ar9462_2p1_mac_core), 2);
1691*a20e5e51SMatthew Dillon } else {
1692b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1693b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_mac_core,
1694b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_mac_core), 2);
1695*a20e5e51SMatthew Dillon }
1696*a20e5e51SMatthew Dillon
1697b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1698b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_mac_postamble,
1699b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_mac_postamble), 5);
1700b7d5e03cSMatthew Dillon
1701b7d5e03cSMatthew Dillon /* bb */
1702b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1703b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1704b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_baseband_core,
1705b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_baseband_core), 2);
1706*a20e5e51SMatthew Dillon
1707*a20e5e51SMatthew Dillon if (AR_SREV_JUPITER_21(ah)) {
1708*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1709*a20e5e51SMatthew Dillon ar9462_2p1_baseband_postamble,
1710*a20e5e51SMatthew Dillon ARRAY_LENGTH(ar9462_2p1_baseband_postamble), 5);
1711*a20e5e51SMatthew Dillon } else {
1712b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1713b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_baseband_postamble,
1714b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_baseband_postamble), 5);
1715*a20e5e51SMatthew Dillon }
1716b7d5e03cSMatthew Dillon
1717b7d5e03cSMatthew Dillon /* radio */
1718b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1719b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1720b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_radio_core,
1721b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_radio_core), 2);
1722b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1723b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_radio_postamble,
1724b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_radio_postamble), 5);
1725b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio_post_sys2ant,
1726b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_radio_postamble_sys2ant,
1727b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_radio_postamble_sys2ant), 5);
1728b7d5e03cSMatthew Dillon
1729b7d5e03cSMatthew Dillon /* soc */
1730*a20e5e51SMatthew Dillon if (AR_SREV_JUPITER_21(ah)) {
1731*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1732*a20e5e51SMatthew Dillon ar9462_2p1_soc_preamble,
1733*a20e5e51SMatthew Dillon ARRAY_LENGTH(ar9462_2p1_soc_preamble), 2);
1734*a20e5e51SMatthew Dillon } else {
1735b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1736b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_soc_preamble,
1737b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_soc_preamble), 2);
1738*a20e5e51SMatthew Dillon }
1739b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1740b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1741b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_soc_postamble,
1742b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_soc_postamble), 5);
1743b7d5e03cSMatthew Dillon
1744b7d5e03cSMatthew Dillon /* rx/tx gain */
1745b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1746b7d5e03cSMatthew Dillon ar9300Common_rx_gain_table_jupiter_2p0,
1747b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Common_rx_gain_table_jupiter_2p0), 2);
1748b7d5e03cSMatthew Dillon
1749b7d5e03cSMatthew Dillon /* BTCOEX */
1750b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_BTCOEX_MAX_TXPWR,
1751b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_BTCOEX_MAX_TXPWR_table,
1752b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_jupiter_2p0_BTCOEX_MAX_TXPWR_table), 2);
1753b7d5e03cSMatthew Dillon
1754b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
1755b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
1756b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 1 */
1757b7d5e03cSMatthew Dillon /*
1758b7d5e03cSMatthew Dillon * PLL ON + clkreq enable is not a valid combination,
1759b7d5e03cSMatthew Dillon * thus to ignore ath_hal_pll_pwr_save, use PLL OFF.
1760b7d5e03cSMatthew Dillon */
1761b7d5e03cSMatthew Dillon {
1762b7d5e03cSMatthew Dillon /*Use driver default setting*/
1763b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1764b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1765b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_enable_L1_jupiter_2p0,
1766b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_PciePhy_clkreq_enable_L1_jupiter_2p0),
1767b7d5e03cSMatthew Dillon 2);
1768b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1769b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1770b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_enable_L1_jupiter_2p0,
1771b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_PciePhy_clkreq_enable_L1_jupiter_2p0),
1772b7d5e03cSMatthew Dillon 2);
1773b7d5e03cSMatthew Dillon }
1774b7d5e03cSMatthew Dillon }
1775b7d5e03cSMatthew Dillon else {
1776b7d5e03cSMatthew Dillon /* Pci-e Clock Request = 0 */
1777b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1778b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
1779b7d5e03cSMatthew Dillon {
1780b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1781b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1782b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1783b7d5e03cSMatthew Dillon {
1784b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1785b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_disable_L1_jupiter_2p0,
1786b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1787b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_disable_L1_jupiter_2p0),
1788b7d5e03cSMatthew Dillon 2);
1789b7d5e03cSMatthew Dillon }
1790b7d5e03cSMatthew Dillon else {
1791b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1792b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0,
1793b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1794b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0),
1795b7d5e03cSMatthew Dillon 2);
1796b7d5e03cSMatthew Dillon }
1797b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1798b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1799b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
1800b7d5e03cSMatthew Dillon {
1801b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1802b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_disable_L1_jupiter_2p0,
1803b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1804b7d5e03cSMatthew Dillon ar9300_PciePhy_clkreq_disable_L1_jupiter_2p0),
1805b7d5e03cSMatthew Dillon 2);
1806b7d5e03cSMatthew Dillon }
1807b7d5e03cSMatthew Dillon else {
1808b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1809b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0,
1810b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1811b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0),
1812b7d5e03cSMatthew Dillon 2);
1813b7d5e03cSMatthew Dillon }
1814b7d5e03cSMatthew Dillon
1815b7d5e03cSMatthew Dillon }
1816b7d5e03cSMatthew Dillon else {
1817b7d5e03cSMatthew Dillon /*Use driver default setting*/
1818b7d5e03cSMatthew Dillon /* Awake -> Sleep Setting */
1819b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1820b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0,
1821b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1822b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0),
1823b7d5e03cSMatthew Dillon 2);
1824b7d5e03cSMatthew Dillon /* Sleep -> Awake Setting */
1825b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
1826b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0,
1827b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1828b7d5e03cSMatthew Dillon ar9300_PciePhy_pll_on_clkreq_disable_L1_jupiter_2p0),
1829b7d5e03cSMatthew Dillon 2);
1830b7d5e03cSMatthew Dillon }
1831b7d5e03cSMatthew Dillon }
1832b7d5e03cSMatthew Dillon
1833b7d5e03cSMatthew Dillon /*
1834b7d5e03cSMatthew Dillon * ath_hal_pcie_power_save_enable should be 2 for OWL/Condor and
1835b7d5e03cSMatthew Dillon * 0 for merlin
1836b7d5e03cSMatthew Dillon */
1837b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1838b7d5e03cSMatthew Dillon
1839b7d5e03cSMatthew Dillon #if 0 // ATH_WOW
1840b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
1841b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_AWOW,
1842b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_AWOW), 2);
1843b7d5e03cSMatthew Dillon #endif
1844b7d5e03cSMatthew Dillon
1845b7d5e03cSMatthew Dillon /* Fast clock modal settings */
1846b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1847b7d5e03cSMatthew Dillon ar9300Modes_fast_clock_jupiter_2p0,
1848b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_fast_clock_jupiter_2p0), 3);
1849b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
1850b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_baseband_core_txfir_coeff_japan_2484,
1851b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1852b7d5e03cSMatthew Dillon ar9300_jupiter_2p0_baseband_core_txfir_coeff_japan_2484), 2);
1853b7d5e03cSMatthew Dillon
1854b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
1855b7d5e03cSMatthew Dillon /* Aphrodite: new INI format (pre, core, post arrays per subsystem) */
1856b7d5e03cSMatthew Dillon
1857b7d5e03cSMatthew Dillon /* mac */
1858b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1859b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1860b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_mac_core,
1861b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_mac_core), 2);
1862b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1863b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_mac_postamble,
1864b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_mac_postamble), 5);
1865b7d5e03cSMatthew Dillon
1866b7d5e03cSMatthew Dillon /* bb */
1867b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1868b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1869b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_baseband_core,
1870b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_baseband_core), 2);
1871b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1872b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_baseband_postamble,
1873b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_baseband_postamble), 5);
1874b7d5e03cSMatthew Dillon
1875b7d5e03cSMatthew Dillon //mark jupiter have but aphrodite don't have
1876b7d5e03cSMatthew Dillon // /* radio */
1877b7d5e03cSMatthew Dillon // INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1878b7d5e03cSMatthew Dillon // INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1879b7d5e03cSMatthew Dillon // ar9300_aphrodite_1p0_radio_core,
1880b7d5e03cSMatthew Dillon // ARRAY_LENGTH(ar9300_aphrodite_1p0_radio_core), 2);
1881b7d5e03cSMatthew Dillon // INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1882b7d5e03cSMatthew Dillon // ar9300_aphrodite_1p0_radio_postamble,
1883b7d5e03cSMatthew Dillon // ARRAY_LENGTH(ar9300_aphrodite_1p0_radio_postamble), 5);
1884b7d5e03cSMatthew Dillon
1885b7d5e03cSMatthew Dillon /* soc */
1886b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1887b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_soc_preamble,
1888b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_soc_preamble), 2);
1889b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1890b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1891b7d5e03cSMatthew Dillon ar956X_aphrodite_1p0_soc_postamble,
1892b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956X_aphrodite_1p0_soc_postamble), 5);
1893b7d5e03cSMatthew Dillon
1894b7d5e03cSMatthew Dillon /* rx/tx gain */
1895b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1896b7d5e03cSMatthew Dillon ar956XCommon_rx_gain_table_aphrodite_1p0,
1897b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XCommon_rx_gain_table_aphrodite_1p0), 2);
1898b7d5e03cSMatthew Dillon //INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1899b7d5e03cSMatthew Dillon // ar956XModes_lowest_ob_db_tx_gain_table_aphrodite_1p0,
1900b7d5e03cSMatthew Dillon // ARRAY_LENGTH(ar956XModes_lowest_ob_db_tx_gain_table_aphrodite_1p0),
1901b7d5e03cSMatthew Dillon // 5);
1902b7d5e03cSMatthew Dillon
1903b7d5e03cSMatthew Dillon
1904b7d5e03cSMatthew Dillon /*
1905b7d5e03cSMatthew Dillon * ath_hal_pcie_power_save_enable should be 2 for OWL/Condor and
1906b7d5e03cSMatthew Dillon * 0 for merlin
1907b7d5e03cSMatthew Dillon */
1908b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
1909b7d5e03cSMatthew Dillon
1910b7d5e03cSMatthew Dillon #if 0 // ATH_WOW
1911b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
1912b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_AWOW,
1913b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_AWOW), 2);
1914b7d5e03cSMatthew Dillon #endif
1915b7d5e03cSMatthew Dillon /* Fast clock modal settings */
1916b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
1917b7d5e03cSMatthew Dillon ar956XModes_fast_clock_aphrodite_1p0,
1918b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XModes_fast_clock_aphrodite_1p0), 3);
1919b7d5e03cSMatthew Dillon
1920b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
1921b7d5e03cSMatthew Dillon /*
1922b7d5e03cSMatthew Dillon * AR9580/Peacock -
1923b7d5e03cSMatthew Dillon * new INI format (pre, core, post arrays per subsystem)
1924b7d5e03cSMatthew Dillon */
1925b7d5e03cSMatthew Dillon
1926b7d5e03cSMatthew Dillon /* mac */
1927b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
1928b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
1929b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_mac_core,
1930b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_mac_core), 2);
1931b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
1932b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_mac_postamble,
1933b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_mac_postamble), 5);
1934b7d5e03cSMatthew Dillon
1935b7d5e03cSMatthew Dillon /* bb */
1936b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
1937b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
1938b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_baseband_core,
1939b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_baseband_core), 2);
1940b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
1941b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_baseband_postamble,
1942b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_baseband_postamble), 5);
1943b7d5e03cSMatthew Dillon
1944b7d5e03cSMatthew Dillon /* radio */
1945b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
1946b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
1947b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_radio_core,
1948b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_radio_core), 2);
1949b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
1950b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_radio_postamble,
1951b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_radio_postamble), 5);
1952b7d5e03cSMatthew Dillon
1953b7d5e03cSMatthew Dillon /* soc */
1954b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
1955b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_soc_preamble,
1956b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_soc_preamble), 2);
1957b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
1958b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
1959b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_soc_postamble,
1960b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_soc_postamble), 5);
1961b7d5e03cSMatthew Dillon
1962b7d5e03cSMatthew Dillon /* rx/tx gain */
1963b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
1964b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_ar9580_1p0,
1965b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_ar9580_1p0), 2);
1966b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
1967b7d5e03cSMatthew Dillon ar9300Modes_lowest_ob_db_tx_gain_table_ar9580_1p0,
1968b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_lowest_ob_db_tx_gain_table_ar9580_1p0), 5);
1969b7d5e03cSMatthew Dillon
1970b7d5e03cSMatthew Dillon /* DFS */
1971b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_dfs,
1972b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_baseband_postamble_dfs_channel,
1973b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_ar9580_1p0_baseband_postamble_dfs_channel), 3);
1974b7d5e03cSMatthew Dillon
1975b7d5e03cSMatthew Dillon
1976b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
1977b7d5e03cSMatthew Dillon
1978b7d5e03cSMatthew Dillon /*D3 Setting */
1979b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
1980b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1981b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
1982b7d5e03cSMatthew Dillon { //registry control
1983b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
1984b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
1985b7d5e03cSMatthew Dillon { //bit1, in to D3
1986b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1987b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_enable_L1_ar9580_1p0,
1988b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_enable_L1_ar9580_1p0),
1989b7d5e03cSMatthew Dillon 2);
1990b7d5e03cSMatthew Dillon } else {
1991b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
1992b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
1993b7d5e03cSMatthew Dillon ARRAY_LENGTH(
1994b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
1995b7d5e03cSMatthew Dillon 2);
1996b7d5e03cSMatthew Dillon }
1997b7d5e03cSMatthew Dillon } else {//no registry control, default is pll on
1998b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
1999b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes,
2000b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2001b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2002b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2003b7d5e03cSMatthew Dillon 2);
2004b7d5e03cSMatthew Dillon }
2005b7d5e03cSMatthew Dillon } else {
2006b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2007b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2008b7d5e03cSMatthew Dillon { //registry control
2009b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2010b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
2011b7d5e03cSMatthew Dillon { //bit1, in to D3
2012b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2013b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_ar9580_1p0,
2014b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2015b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_ar9580_1p0),
2016b7d5e03cSMatthew Dillon 2);
2017b7d5e03cSMatthew Dillon } else {
2018b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2019b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2020b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2021b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2022b7d5e03cSMatthew Dillon 2);
2023b7d5e03cSMatthew Dillon }
2024b7d5e03cSMatthew Dillon } else {//no registry control, default is pll on
2025b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2026b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes,
2027b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2028b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2029b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2030b7d5e03cSMatthew Dillon 2);
2031b7d5e03cSMatthew Dillon }
2032b7d5e03cSMatthew Dillon }
2033b7d5e03cSMatthew Dillon
2034b7d5e03cSMatthew Dillon /*D0 Setting */
2035b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
2036b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2037b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2038b7d5e03cSMatthew Dillon { //registry control
2039b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2040b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
2041b7d5e03cSMatthew Dillon { //bit2, out of D3
2042b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2043b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_enable_L1_ar9580_1p0,
2044b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_enable_L1_ar9580_1p0),
2045b7d5e03cSMatthew Dillon 2);
2046b7d5e03cSMatthew Dillon
2047b7d5e03cSMatthew Dillon } else {
2048b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2049b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2050b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2051b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2052b7d5e03cSMatthew Dillon 2);
2053b7d5e03cSMatthew Dillon }
2054b7d5e03cSMatthew Dillon } else { //no registry control, default is pll on
2055b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2056b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes_low_power,
2057b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2058b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2059b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2060b7d5e03cSMatthew Dillon 2);
2061b7d5e03cSMatthew Dillon }
2062b7d5e03cSMatthew Dillon } else {
2063b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2064b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2065b7d5e03cSMatthew Dillon {//registry control
2066b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2067b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
2068b7d5e03cSMatthew Dillon {//bit2, out of D3
2069b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2070b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_ar9580_1p0,
2071b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_disable_L1_ar9580_1p0),
2072b7d5e03cSMatthew Dillon 2);
2073b7d5e03cSMatthew Dillon } else {
2074b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2075b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2076b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2077b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2078b7d5e03cSMatthew Dillon 2);
2079b7d5e03cSMatthew Dillon }
2080b7d5e03cSMatthew Dillon } else { //no registry control, default is pll on
2081b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2082b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes_low_power,
2083b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0,
2084b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2085b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_ar9580_1p0),
2086b7d5e03cSMatthew Dillon 2);
2087b7d5e03cSMatthew Dillon }
2088b7d5e03cSMatthew Dillon }
2089b7d5e03cSMatthew Dillon
2090b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
2091b7d5e03cSMatthew Dillon
2092b7d5e03cSMatthew Dillon #if 0 /* ATH_WOW */
2093b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
2094b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_awow,
2095b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_awow), 2);
2096b7d5e03cSMatthew Dillon #endif
2097b7d5e03cSMatthew Dillon
2098b7d5e03cSMatthew Dillon /* Fast clock modal settings */
2099b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
2100b7d5e03cSMatthew Dillon ar9300Modes_fast_clock_ar9580_1p0,
2101b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_fast_clock_ar9580_1p0), 3);
2102b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
2103b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_baseband_core_txfir_coeff_japan_2484,
2104b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2105b7d5e03cSMatthew Dillon ar9300_ar9580_1p0_baseband_core_txfir_coeff_japan_2484), 2);
2106b7d5e03cSMatthew Dillon
2107b7d5e03cSMatthew Dillon } else {
2108b7d5e03cSMatthew Dillon /*
2109b7d5e03cSMatthew Dillon * Osprey 2.2 - new INI format (pre, core, post arrays per subsystem)
2110b7d5e03cSMatthew Dillon */
2111b7d5e03cSMatthew Dillon
2112b7d5e03cSMatthew Dillon /* mac */
2113b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_PRE], NULL, 0, 0);
2114b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_CORE],
2115b7d5e03cSMatthew Dillon ar9300_osprey_2p2_mac_core,
2116b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_mac_core), 2);
2117b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_mac[ATH_INI_POST],
2118b7d5e03cSMatthew Dillon ar9300_osprey_2p2_mac_postamble,
2119b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_mac_postamble), 5);
2120b7d5e03cSMatthew Dillon
2121b7d5e03cSMatthew Dillon /* bb */
2122b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_PRE], NULL, 0, 0);
2123b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_CORE],
2124b7d5e03cSMatthew Dillon ar9300_osprey_2p2_baseband_core,
2125b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_baseband_core), 2);
2126b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_bb[ATH_INI_POST],
2127b7d5e03cSMatthew Dillon ar9300_osprey_2p2_baseband_postamble,
2128b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_baseband_postamble), 5);
2129b7d5e03cSMatthew Dillon
2130b7d5e03cSMatthew Dillon /* radio */
2131b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_PRE], NULL, 0, 0);
2132b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_CORE],
2133b7d5e03cSMatthew Dillon ar9300_osprey_2p2_radio_core,
2134b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_radio_core), 2);
2135b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_radio[ATH_INI_POST],
2136b7d5e03cSMatthew Dillon ar9300_osprey_2p2_radio_postamble,
2137b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_radio_postamble), 5);
2138b7d5e03cSMatthew Dillon
2139b7d5e03cSMatthew Dillon /* soc */
2140b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_PRE],
2141b7d5e03cSMatthew Dillon ar9300_osprey_2p2_soc_preamble,
2142b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_soc_preamble), 2);
2143b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_CORE], NULL, 0, 0);
2144b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_soc[ATH_INI_POST],
2145b7d5e03cSMatthew Dillon ar9300_osprey_2p2_soc_postamble,
2146b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_soc_postamble), 5);
2147b7d5e03cSMatthew Dillon
2148b7d5e03cSMatthew Dillon /* rx/tx gain */
2149b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
2150b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_osprey_2p2,
2151b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_osprey_2p2), 2);
2152b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
2153b7d5e03cSMatthew Dillon ar9300_modes_lowest_ob_db_tx_gain_table_osprey_2p2,
2154b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_modes_lowest_ob_db_tx_gain_table_osprey_2p2), 5);
2155b7d5e03cSMatthew Dillon
2156b7d5e03cSMatthew Dillon /* DFS */
2157b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_dfs,
2158b7d5e03cSMatthew Dillon ar9300_osprey_2p2_baseband_postamble_dfs_channel,
2159b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_osprey_2p2_baseband_postamble_dfs_channel), 3);
2160b7d5e03cSMatthew Dillon
2161b7d5e03cSMatthew Dillon /* Load PCIE SERDES settings from INI */
2162b7d5e03cSMatthew Dillon
2163b7d5e03cSMatthew Dillon /*D3 Setting */
2164b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
2165b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2166b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2167b7d5e03cSMatthew Dillon { //registry control
2168b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2169b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
2170b7d5e03cSMatthew Dillon { //bit1, in to D3
2171b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2172b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_enable_L1_osprey_2p2,
2173b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_enable_L1_osprey_2p2),
2174b7d5e03cSMatthew Dillon 2);
2175b7d5e03cSMatthew Dillon } else {
2176b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2177b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2178b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2179b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2180b7d5e03cSMatthew Dillon 2);
2181b7d5e03cSMatthew Dillon }
2182b7d5e03cSMatthew Dillon } else {//no registry control, default is pll on
2183b7d5e03cSMatthew Dillon #ifndef ATH_BUS_PM
2184b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2185b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes,
2186b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2187b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2188b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2189b7d5e03cSMatthew Dillon 2);
2190b7d5e03cSMatthew Dillon #else
2191b7d5e03cSMatthew Dillon //no registry control, default is pll off
2192b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2193b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes,
2194b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_osprey_2p2,
2195b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2196b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_osprey_2p2),
2197b7d5e03cSMatthew Dillon 2);
2198b7d5e03cSMatthew Dillon #endif
2199b7d5e03cSMatthew Dillon
2200b7d5e03cSMatthew Dillon }
2201b7d5e03cSMatthew Dillon } else {
2202b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2203b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2204b7d5e03cSMatthew Dillon { //registry control
2205b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2206b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D3)
2207b7d5e03cSMatthew Dillon { //bit1, in to D3
2208b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2209b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_osprey_2p2,
2210b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2211b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_osprey_2p2),
2212b7d5e03cSMatthew Dillon 2);
2213b7d5e03cSMatthew Dillon } else {
2214b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes,
2215b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2216b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2217b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2218b7d5e03cSMatthew Dillon 2);
2219b7d5e03cSMatthew Dillon }
2220b7d5e03cSMatthew Dillon } else {
2221b7d5e03cSMatthew Dillon #ifndef ATH_BUS_PM
2222b7d5e03cSMatthew Dillon //no registry control, default is pll on
2223b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2224b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes,
2225b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2226b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2227b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2228b7d5e03cSMatthew Dillon 2);
2229b7d5e03cSMatthew Dillon #else
2230b7d5e03cSMatthew Dillon //no registry control, default is pll off
2231b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes, ar9300PciePhy_clkreq_disable_L1_osprey_2p2,
2232b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_disable_L1_osprey_2p2), 2);
2233b7d5e03cSMatthew Dillon #endif
2234b7d5e03cSMatthew Dillon }
2235b7d5e03cSMatthew Dillon }
2236b7d5e03cSMatthew Dillon
2237b7d5e03cSMatthew Dillon /*D0 Setting */
2238b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_clock_req) {
2239b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2240b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2241b7d5e03cSMatthew Dillon { //registry control
2242b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2243b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
2244b7d5e03cSMatthew Dillon { //bit2, out of D3
2245b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2246b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_enable_L1_osprey_2p2,
2247b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_enable_L1_osprey_2p2),
2248b7d5e03cSMatthew Dillon 2);
2249b7d5e03cSMatthew Dillon
2250b7d5e03cSMatthew Dillon } else {
2251b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2252b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2253b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2254b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2255b7d5e03cSMatthew Dillon 2);
2256b7d5e03cSMatthew Dillon }
2257b7d5e03cSMatthew Dillon } else { //no registry control, default is pll on
2258b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2259b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes_low_power,
2260b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2261b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2262b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2263b7d5e03cSMatthew Dillon 2);
2264b7d5e03cSMatthew Dillon }
2265b7d5e03cSMatthew Dillon } else {
2266b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2267b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_CONTROL)
2268b7d5e03cSMatthew Dillon {//registry control
2269b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pll_pwr_save &
2270b7d5e03cSMatthew Dillon AR_PCIE_PLL_PWRSAVE_ON_D0)
2271b7d5e03cSMatthew Dillon {//bit2, out of D3
2272b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2273b7d5e03cSMatthew Dillon ar9300PciePhy_clkreq_disable_L1_osprey_2p2,
2274b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300PciePhy_clkreq_disable_L1_osprey_2p2),
2275b7d5e03cSMatthew Dillon 2);
2276b7d5e03cSMatthew Dillon } else {
2277b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_low_power,
2278b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2279b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2280b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2281b7d5e03cSMatthew Dillon 2);
2282b7d5e03cSMatthew Dillon }
2283b7d5e03cSMatthew Dillon } else { //no registry control, default is pll on
2284b7d5e03cSMatthew Dillon INIT_INI_ARRAY(
2285b7d5e03cSMatthew Dillon &ahp->ah_ini_pcie_serdes_low_power,
2286b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2,
2287b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2288b7d5e03cSMatthew Dillon ar9300PciePhy_pll_on_clkreq_disable_L1_osprey_2p2),
2289b7d5e03cSMatthew Dillon 2);
2290b7d5e03cSMatthew Dillon }
2291b7d5e03cSMatthew Dillon }
2292b7d5e03cSMatthew Dillon
2293b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_power_save_enable = 0;
2294b7d5e03cSMatthew Dillon
2295b7d5e03cSMatthew Dillon #ifdef ATH_BUS_PM
2296b7d5e03cSMatthew Dillon /*Use HAL to config PCI powersave by writing into the SerDes Registers */
2297b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_ser_des_write = 1;
2298b7d5e03cSMatthew Dillon #endif
2299b7d5e03cSMatthew Dillon
2300b7d5e03cSMatthew Dillon #if 0 /* ATH_WOW */
2301b7d5e03cSMatthew Dillon /* SerDes values during WOW sleep */
2302b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_pcie_serdes_wow, ar9300_pcie_phy_awow,
2303b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_pcie_phy_awow), 2);
2304b7d5e03cSMatthew Dillon #endif
2305b7d5e03cSMatthew Dillon
2306b7d5e03cSMatthew Dillon /* Fast clock modal settings */
2307b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_additional,
2308b7d5e03cSMatthew Dillon ar9300Modes_fast_clock_osprey_2p2,
2309b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_fast_clock_osprey_2p2), 3);
2310b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_japan2484,
2311b7d5e03cSMatthew Dillon ar9300_osprey_2p2_baseband_core_txfir_coeff_japan_2484,
2312b7d5e03cSMatthew Dillon ARRAY_LENGTH(
2313b7d5e03cSMatthew Dillon ar9300_osprey_2p2_baseband_core_txfir_coeff_japan_2484), 2);
2314b7d5e03cSMatthew Dillon
2315b7d5e03cSMatthew Dillon }
2316b7d5e03cSMatthew Dillon
2317b7d5e03cSMatthew Dillon if(AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah))
2318b7d5e03cSMatthew Dillon {
2319b7d5e03cSMatthew Dillon #define AR_SOC_RST_OTP_INTF 0xB80600B4
2320b7d5e03cSMatthew Dillon #define REG_READ(_reg) *((volatile u_int32_t *)(_reg))
2321b7d5e03cSMatthew Dillon
2322b7d5e03cSMatthew Dillon ahp->ah_enterprise_mode = REG_READ(AR_SOC_RST_OTP_INTF);
2323b7d5e03cSMatthew Dillon if (AR_SREV_SCORPION(ah)) {
2324b7d5e03cSMatthew Dillon ahp->ah_enterprise_mode = ahp->ah_enterprise_mode << 12;
2325b7d5e03cSMatthew Dillon }
2326b7d5e03cSMatthew Dillon ath_hal_printf (ah, "Enterprise mode: 0x%08x\n", ahp->ah_enterprise_mode);
2327b7d5e03cSMatthew Dillon #undef REG_READ
2328b7d5e03cSMatthew Dillon #undef AR_SOC_RST_OTP_INTF
2329b7d5e03cSMatthew Dillon } else {
2330b7d5e03cSMatthew Dillon ahp->ah_enterprise_mode = OS_REG_READ(ah, AR_ENT_OTP);
2331b7d5e03cSMatthew Dillon }
2332b7d5e03cSMatthew Dillon
2333b7d5e03cSMatthew Dillon
2334b7d5e03cSMatthew Dillon if (ahpriv->ah_ispcie) {
2335b7d5e03cSMatthew Dillon ar9300_config_pci_power_save(ah, 0, 0);
2336b7d5e03cSMatthew Dillon } else {
2337b7d5e03cSMatthew Dillon ar9300_disable_pcie_phy(ah);
2338b7d5e03cSMatthew Dillon }
2339b7d5e03cSMatthew Dillon ath_hal_printf(ah, "%s: calling ar9300_hw_attach\n", __func__);
2340b7d5e03cSMatthew Dillon ecode = ar9300_hw_attach(ah);
2341b7d5e03cSMatthew Dillon if (ecode != HAL_OK) {
2342b7d5e03cSMatthew Dillon goto bad;
2343b7d5e03cSMatthew Dillon }
2344b7d5e03cSMatthew Dillon
2345b7d5e03cSMatthew Dillon /* set gain table pointers according to values read from the eeprom */
2346b7d5e03cSMatthew Dillon ar9300_tx_gain_table_apply(ah);
2347b7d5e03cSMatthew Dillon ar9300_rx_gain_table_apply(ah);
2348b7d5e03cSMatthew Dillon
2349b7d5e03cSMatthew Dillon /*
2350b7d5e03cSMatthew Dillon **
2351b7d5e03cSMatthew Dillon ** Got everything we need now to setup the capabilities.
2352b7d5e03cSMatthew Dillon */
2353b7d5e03cSMatthew Dillon
2354b7d5e03cSMatthew Dillon if (!ar9300_fill_capability_info(ah)) {
2355b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET,
2356b7d5e03cSMatthew Dillon "%s:failed ar9300_fill_capability_info\n", __func__);
2357b7d5e03cSMatthew Dillon ecode = HAL_EEREAD;
2358b7d5e03cSMatthew Dillon goto bad;
2359b7d5e03cSMatthew Dillon }
2360b7d5e03cSMatthew Dillon ecode = ar9300_init_mac_addr(ah);
2361b7d5e03cSMatthew Dillon if (ecode != HAL_OK) {
2362b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET,
2363b7d5e03cSMatthew Dillon "%s: failed initializing mac address\n", __func__);
2364b7d5e03cSMatthew Dillon goto bad;
2365b7d5e03cSMatthew Dillon }
2366b7d5e03cSMatthew Dillon
2367b7d5e03cSMatthew Dillon /*
2368b7d5e03cSMatthew Dillon * Initialize receive buffer size to MAC default
2369b7d5e03cSMatthew Dillon */
2370b7d5e03cSMatthew Dillon ahp->rx_buf_size = HAL_RXBUFSIZE_DEFAULT;
2371b7d5e03cSMatthew Dillon
2372b7d5e03cSMatthew Dillon #if ATH_WOW
2373b7d5e03cSMatthew Dillon #if 0
2374b7d5e03cSMatthew Dillon /*
2375b7d5e03cSMatthew Dillon * Needs to be removed once we stop using XB92 XXX
2376b7d5e03cSMatthew Dillon * FIXME: Check with latest boards too - SriniK
2377b7d5e03cSMatthew Dillon */
2378b7d5e03cSMatthew Dillon ar9300_wow_set_gpio_reset_low(ah);
2379b7d5e03cSMatthew Dillon #endif
2380b7d5e03cSMatthew Dillon
2381b7d5e03cSMatthew Dillon /*
2382b7d5e03cSMatthew Dillon * Clear the Wow Status.
2383b7d5e03cSMatthew Dillon */
2384b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, AR_HOSTIF_REG(ah, AR_PCIE_PM_CTRL),
2385b7d5e03cSMatthew Dillon OS_REG_READ(ah, AR_HOSTIF_REG(ah, AR_PCIE_PM_CTRL)) |
2386b7d5e03cSMatthew Dillon AR_PMCTRL_WOW_PME_CLR);
2387b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, AR_WOW_PATTERN_REG,
2388b7d5e03cSMatthew Dillon AR_WOW_CLEAR_EVENTS(OS_REG_READ(ah, AR_WOW_PATTERN_REG)));
2389b7d5e03cSMatthew Dillon #endif
2390b7d5e03cSMatthew Dillon
2391b7d5e03cSMatthew Dillon /*
2392b7d5e03cSMatthew Dillon * Set the cur_trig_level to a value that works all modes - 11a/b/g or 11n
2393b7d5e03cSMatthew Dillon * with aggregation enabled or disabled.
2394b7d5e03cSMatthew Dillon */
2395b7d5e03cSMatthew Dillon ahp->ah_tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S);
2396b7d5e03cSMatthew Dillon
2397b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah)) {
2398b7d5e03cSMatthew Dillon ahp->nf_2GHz.nominal = AR_PHY_CCA_NOM_VAL_HORNET_2GHZ;
2399b7d5e03cSMatthew Dillon ahp->nf_2GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_2GHZ;
2400b7d5e03cSMatthew Dillon ahp->nf_2GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_OSPREY_2GHZ;
2401b7d5e03cSMatthew Dillon ahp->nf_5GHz.nominal = AR_PHY_CCA_NOM_VAL_OSPREY_5GHZ;
2402b7d5e03cSMatthew Dillon ahp->nf_5GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_5GHZ;
2403b7d5e03cSMatthew Dillon ahp->nf_5GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_OSPREY_5GHZ;
2404b7d5e03cSMatthew Dillon ahp->nf_cw_int_delta = AR_PHY_CCA_CW_INT_DELTA;
2405b7d5e03cSMatthew Dillon } else if(AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)){
2406b7d5e03cSMatthew Dillon ahp->nf_2GHz.nominal = AR_PHY_CCA_NOM_VAL_JUPITER_2GHZ;
2407b7d5e03cSMatthew Dillon ahp->nf_2GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_2GHZ;
2408b7d5e03cSMatthew Dillon ahp->nf_2GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_JUPITER_2GHZ;
2409b7d5e03cSMatthew Dillon ahp->nf_5GHz.nominal = AR_PHY_CCA_NOM_VAL_JUPITER_5GHZ;
2410b7d5e03cSMatthew Dillon ahp->nf_5GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_5GHZ;
2411b7d5e03cSMatthew Dillon ahp->nf_5GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_JUPITER_5GHZ;
2412b7d5e03cSMatthew Dillon ahp->nf_cw_int_delta = AR_PHY_CCA_CW_INT_DELTA;
2413b7d5e03cSMatthew Dillon } else {
2414b7d5e03cSMatthew Dillon ahp->nf_2GHz.nominal = AR_PHY_CCA_NOM_VAL_OSPREY_2GHZ;
2415b7d5e03cSMatthew Dillon ahp->nf_2GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_2GHZ;
2416b7d5e03cSMatthew Dillon ahp->nf_2GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_OSPREY_2GHZ;
2417b7d5e03cSMatthew Dillon if (AR_SREV_AR9580(ah) || AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) {
2418b7d5e03cSMatthew Dillon ahp->nf_5GHz.nominal = AR_PHY_CCA_NOM_VAL_PEACOCK_5GHZ;
2419b7d5e03cSMatthew Dillon } else {
2420b7d5e03cSMatthew Dillon ahp->nf_5GHz.nominal = AR_PHY_CCA_NOM_VAL_OSPREY_5GHZ;
2421b7d5e03cSMatthew Dillon }
2422b7d5e03cSMatthew Dillon ahp->nf_5GHz.max = AR_PHY_CCA_MAX_GOOD_VAL_OSPREY_5GHZ;
2423b7d5e03cSMatthew Dillon ahp->nf_5GHz.min = AR_PHY_CCA_MIN_GOOD_VAL_OSPREY_5GHZ;
2424b7d5e03cSMatthew Dillon ahp->nf_cw_int_delta = AR_PHY_CCA_CW_INT_DELTA;
2425b7d5e03cSMatthew Dillon }
2426b7d5e03cSMatthew Dillon
2427b7d5e03cSMatthew Dillon
2428b7d5e03cSMatthew Dillon
2429b7d5e03cSMatthew Dillon
2430b7d5e03cSMatthew Dillon /* init BB Panic Watchdog timeout */
2431b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah)) {
2432b7d5e03cSMatthew Dillon ahp->ah_bb_panic_timeout_ms = HAL_BB_PANIC_WD_TMO_HORNET;
2433b7d5e03cSMatthew Dillon } else {
2434b7d5e03cSMatthew Dillon ahp->ah_bb_panic_timeout_ms = HAL_BB_PANIC_WD_TMO;
2435b7d5e03cSMatthew Dillon }
2436b7d5e03cSMatthew Dillon
2437b7d5e03cSMatthew Dillon
2438b7d5e03cSMatthew Dillon /*
2439b7d5e03cSMatthew Dillon * Determine whether tx IQ calibration HW should be enabled,
2440b7d5e03cSMatthew Dillon * and whether tx IQ calibration should be performed during
2441b7d5e03cSMatthew Dillon * AGC calibration, or separately.
2442b7d5e03cSMatthew Dillon */
2443b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)) {
2444b7d5e03cSMatthew Dillon /*
2445b7d5e03cSMatthew Dillon * Register not initialized yet. This flag will be re-initialized
2446b7d5e03cSMatthew Dillon * after INI loading following each reset.
2447b7d5e03cSMatthew Dillon */
2448b7d5e03cSMatthew Dillon ahp->tx_iq_cal_enable = 1;
2449b7d5e03cSMatthew Dillon /* if tx IQ cal is enabled, do it together with AGC cal */
2450b7d5e03cSMatthew Dillon ahp->tx_iq_cal_during_agc_cal = 1;
2451b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_OR_LATER(ah) && !AR_SREV_WASP(ah)) {
2452b7d5e03cSMatthew Dillon ahp->tx_iq_cal_enable = 1;
2453b7d5e03cSMatthew Dillon ahp->tx_iq_cal_during_agc_cal = 1;
2454b7d5e03cSMatthew Dillon } else {
2455b7d5e03cSMatthew Dillon /* osprey, hornet, wasp */
2456b7d5e03cSMatthew Dillon ahp->tx_iq_cal_enable = 1;
2457b7d5e03cSMatthew Dillon ahp->tx_iq_cal_during_agc_cal = 0;
2458b7d5e03cSMatthew Dillon }
2459b7d5e03cSMatthew Dillon return ah;
2460b7d5e03cSMatthew Dillon
2461b7d5e03cSMatthew Dillon bad:
2462b7d5e03cSMatthew Dillon if (ahp) {
2463b7d5e03cSMatthew Dillon ar9300_detach((struct ath_hal *) ahp);
2464b7d5e03cSMatthew Dillon }
2465b7d5e03cSMatthew Dillon if (status) {
2466b7d5e03cSMatthew Dillon *status = ecode;
2467b7d5e03cSMatthew Dillon }
2468b7d5e03cSMatthew Dillon return AH_NULL;
2469b7d5e03cSMatthew Dillon }
2470b7d5e03cSMatthew Dillon
2471b7d5e03cSMatthew Dillon void
ar9300_detach(struct ath_hal * ah)2472b7d5e03cSMatthew Dillon ar9300_detach(struct ath_hal *ah)
2473b7d5e03cSMatthew Dillon {
2474b7d5e03cSMatthew Dillon HALASSERT(ah != AH_NULL);
2475b7d5e03cSMatthew Dillon HALASSERT(ah->ah_magic == AR9300_MAGIC);
2476b7d5e03cSMatthew Dillon
2477b7d5e03cSMatthew Dillon /* Make sure that chip is awake before writing to it */
2478b7d5e03cSMatthew Dillon if (!ar9300_set_power_mode(ah, HAL_PM_AWAKE, AH_TRUE)) {
2479b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_UNMASKABLE,
2480b7d5e03cSMatthew Dillon "%s: failed to wake up chip\n",
2481b7d5e03cSMatthew Dillon __func__);
2482b7d5e03cSMatthew Dillon }
2483b7d5e03cSMatthew Dillon
2484b7d5e03cSMatthew Dillon ar9300_hw_detach(ah);
2485b7d5e03cSMatthew Dillon ar9300_set_power_mode(ah, HAL_PM_FULL_SLEEP, AH_TRUE);
2486b7d5e03cSMatthew Dillon
2487b7d5e03cSMatthew Dillon // ath_hal_hdprintf_deregister(ah);
2488b7d5e03cSMatthew Dillon
2489b7d5e03cSMatthew Dillon if (AH9300(ah)->ah_cal_mem)
2490b7d5e03cSMatthew Dillon ath_hal_free(AH9300(ah)->ah_cal_mem);
2491b7d5e03cSMatthew Dillon AH9300(ah)->ah_cal_mem = AH_NULL;
2492b7d5e03cSMatthew Dillon
2493b7d5e03cSMatthew Dillon ath_hal_free(ah);
2494b7d5e03cSMatthew Dillon }
2495b7d5e03cSMatthew Dillon
2496b7d5e03cSMatthew Dillon struct ath_hal_9300 *
ar9300_new_state(u_int16_t devid,HAL_SOFTC sc,HAL_BUS_TAG st,HAL_BUS_HANDLE sh,uint16_t * eepromdata,HAL_OPS_CONFIG * ah_config,HAL_STATUS * status)2497b7d5e03cSMatthew Dillon ar9300_new_state(u_int16_t devid, HAL_SOFTC sc,
2498b7d5e03cSMatthew Dillon HAL_BUS_TAG st, HAL_BUS_HANDLE sh,
2499848b370cSMatthew Dillon uint16_t *eepromdata,
2500848b370cSMatthew Dillon HAL_OPS_CONFIG *ah_config,
2501848b370cSMatthew Dillon HAL_STATUS *status)
2502b7d5e03cSMatthew Dillon {
2503b7d5e03cSMatthew Dillon static const u_int8_t defbssidmask[IEEE80211_ADDR_LEN] =
2504b7d5e03cSMatthew Dillon { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
2505b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp;
2506b7d5e03cSMatthew Dillon struct ath_hal *ah;
2507b7d5e03cSMatthew Dillon
2508b7d5e03cSMatthew Dillon /* NB: memory is returned zero'd */
2509b7d5e03cSMatthew Dillon ahp = ath_hal_malloc(sizeof(struct ath_hal_9300));
2510b7d5e03cSMatthew Dillon if (ahp == AH_NULL) {
2511b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE,
2512b7d5e03cSMatthew Dillon "%s: cannot allocate memory for state block\n",
2513b7d5e03cSMatthew Dillon __func__);
2514b7d5e03cSMatthew Dillon *status = HAL_ENOMEM;
2515b7d5e03cSMatthew Dillon return AH_NULL;
2516b7d5e03cSMatthew Dillon }
2517b7d5e03cSMatthew Dillon
2518b7d5e03cSMatthew Dillon ah = &ahp->ah_priv.h;
2519b7d5e03cSMatthew Dillon /* set initial values */
2520b7d5e03cSMatthew Dillon
2521b7d5e03cSMatthew Dillon /* stub everything first */
2522b7d5e03cSMatthew Dillon ar9300_set_stub_functions(ah);
2523b7d5e03cSMatthew Dillon
2524b7d5e03cSMatthew Dillon /* setup the FreeBSD HAL methods */
2525b7d5e03cSMatthew Dillon ar9300_attach_freebsd_ops(ah);
2526b7d5e03cSMatthew Dillon
2527b7d5e03cSMatthew Dillon /* These are private to this particular file, so .. */
2528b7d5e03cSMatthew Dillon ah->ah_disablePCIE = ar9300_disable_pcie_phy;
2529b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_getNfAdjust = ar9300_get_nf_adjust;
2530b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_getChipPowerLimits = ar9300_get_chip_power_limits;
2531b7d5e03cSMatthew Dillon
2532b7d5e03cSMatthew Dillon #if 0
2533b7d5e03cSMatthew Dillon /* Attach Osprey structure as default hal structure */
2534b7d5e03cSMatthew Dillon OS_MEMCPY(&ahp->ah_priv.priv, &ar9300hal, sizeof(ahp->ah_priv.priv));
2535b7d5e03cSMatthew Dillon #endif
2536b7d5e03cSMatthew Dillon
2537b7d5e03cSMatthew Dillon #if 0
2538b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->amem_handle = amem_handle;
2539b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_osdev = osdev;
2540b7d5e03cSMatthew Dillon #endif
2541b7d5e03cSMatthew Dillon ah->ah_sc = sc;
2542b7d5e03cSMatthew Dillon ah->ah_st = st;
2543b7d5e03cSMatthew Dillon ah->ah_sh = sh;
2544b7d5e03cSMatthew Dillon ah->ah_magic = AR9300_MAGIC;
2545b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_devid = devid;
2546b7d5e03cSMatthew Dillon
2547b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_flags = 0;
2548b7d5e03cSMatthew Dillon
2549b7d5e03cSMatthew Dillon /*
2550b7d5e03cSMatthew Dillon ** Initialize factory defaults in the private space
2551b7d5e03cSMatthew Dillon */
2552b7d5e03cSMatthew Dillon // ath_hal_factory_defaults(AH_PRIVATE(ah), hal_conf_parm);
2553848b370cSMatthew Dillon ar9300_config_defaults_freebsd(ah, ah_config);
2554b7d5e03cSMatthew Dillon
2555b7d5e03cSMatthew Dillon /* XXX FreeBSD: cal is always in EEPROM */
2556b7d5e03cSMatthew Dillon #if 0
2557b7d5e03cSMatthew Dillon if (!hal_conf_parm->calInFlash) {
2558b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_flags |= AH_USE_EEPROM;
2559b7d5e03cSMatthew Dillon }
2560b7d5e03cSMatthew Dillon #endif
2561b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_flags |= AH_USE_EEPROM;
2562b7d5e03cSMatthew Dillon
2563b7d5e03cSMatthew Dillon #if 0
2564b7d5e03cSMatthew Dillon if (ar9300_eep_data_in_flash(ah)) {
2565b7d5e03cSMatthew Dillon ahp->ah_priv.priv.ah_eeprom_read = ar9300_flash_read;
2566b7d5e03cSMatthew Dillon ahp->ah_priv.priv.ah_eeprom_dump = AH_NULL;
2567b7d5e03cSMatthew Dillon } else {
2568b7d5e03cSMatthew Dillon ahp->ah_priv.priv.ah_eeprom_read = ar9300_eeprom_read_word;
2569b7d5e03cSMatthew Dillon }
2570b7d5e03cSMatthew Dillon #endif
2571b7d5e03cSMatthew Dillon
2572b7d5e03cSMatthew Dillon /* XXX FreeBSD - for now, just supports EEPROM reading */
2573b7d5e03cSMatthew Dillon ahp->ah_priv.ah_eepromRead = ar9300_eeprom_read_word;
2574b7d5e03cSMatthew Dillon
2575b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_powerLimit = MAX_RATE_POWER;
2576b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_tpScale = HAL_TP_SCALE_MAX; /* no scaling */
2577b7d5e03cSMatthew Dillon
2578b7d5e03cSMatthew Dillon ahp->ah_atim_window = 0; /* [0..1000] */
2579848b370cSMatthew Dillon
2580b7d5e03cSMatthew Dillon ahp->ah_diversity_control =
2581b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_diversity_control;
2582b7d5e03cSMatthew Dillon ahp->ah_antenna_switch_swap =
2583b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_antenna_switch_swap;
2584b7d5e03cSMatthew Dillon
2585b7d5e03cSMatthew Dillon /*
2586b7d5e03cSMatthew Dillon * Enable MIC handling.
2587b7d5e03cSMatthew Dillon */
2588b7d5e03cSMatthew Dillon ahp->ah_sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE;
2589b7d5e03cSMatthew Dillon ahp->ah_enable32k_hz_clock = DONT_USE_32KHZ;/* XXX */
2590b7d5e03cSMatthew Dillon ahp->ah_slot_time = (u_int) -1;
2591b7d5e03cSMatthew Dillon ahp->ah_ack_timeout = (u_int) -1;
2592b7d5e03cSMatthew Dillon OS_MEMCPY(&ahp->ah_bssid_mask, defbssidmask, IEEE80211_ADDR_LEN);
2593b7d5e03cSMatthew Dillon
2594b7d5e03cSMatthew Dillon /*
2595b7d5e03cSMatthew Dillon * 11g-specific stuff
2596b7d5e03cSMatthew Dillon */
2597b7d5e03cSMatthew Dillon ahp->ah_g_beacon_rate = 0; /* adhoc beacon fixed rate */
2598b7d5e03cSMatthew Dillon
2599b7d5e03cSMatthew Dillon /* SM power mode: Attach time, disable any setting */
2600b7d5e03cSMatthew Dillon ahp->ah_sm_power_mode = HAL_SMPS_DEFAULT;
2601b7d5e03cSMatthew Dillon
2602b7d5e03cSMatthew Dillon return ahp;
2603b7d5e03cSMatthew Dillon }
2604b7d5e03cSMatthew Dillon
2605b7d5e03cSMatthew Dillon HAL_BOOL
ar9300_chip_test(struct ath_hal * ah)2606b7d5e03cSMatthew Dillon ar9300_chip_test(struct ath_hal *ah)
2607b7d5e03cSMatthew Dillon {
2608b7d5e03cSMatthew Dillon /*u_int32_t reg_addr[2] = { AR_STA_ID0, AR_PHY_BASE+(8 << 2) };*/
2609b7d5e03cSMatthew Dillon u_int32_t reg_addr[2] = { AR_STA_ID0 };
2610b7d5e03cSMatthew Dillon u_int32_t reg_hold[2];
2611b7d5e03cSMatthew Dillon u_int32_t pattern_data[4] =
2612b7d5e03cSMatthew Dillon { 0x55555555, 0xaaaaaaaa, 0x66666666, 0x99999999 };
2613b7d5e03cSMatthew Dillon int i, j;
2614b7d5e03cSMatthew Dillon
2615b7d5e03cSMatthew Dillon /* Test PHY & MAC registers */
2616b7d5e03cSMatthew Dillon for (i = 0; i < 1; i++) {
2617b7d5e03cSMatthew Dillon u_int32_t addr = reg_addr[i];
2618b7d5e03cSMatthew Dillon u_int32_t wr_data, rd_data;
2619b7d5e03cSMatthew Dillon
2620b7d5e03cSMatthew Dillon reg_hold[i] = OS_REG_READ(ah, addr);
2621b7d5e03cSMatthew Dillon for (j = 0; j < 0x100; j++) {
2622b7d5e03cSMatthew Dillon wr_data = (j << 16) | j;
2623b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, addr, wr_data);
2624b7d5e03cSMatthew Dillon rd_data = OS_REG_READ(ah, addr);
2625b7d5e03cSMatthew Dillon if (rd_data != wr_data) {
2626b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_REGIO,
2627b7d5e03cSMatthew Dillon "%s: address test failed addr: "
2628b7d5e03cSMatthew Dillon "0x%08x - wr:0x%08x != rd:0x%08x\n",
2629b7d5e03cSMatthew Dillon __func__, addr, wr_data, rd_data);
2630b7d5e03cSMatthew Dillon return AH_FALSE;
2631b7d5e03cSMatthew Dillon }
2632b7d5e03cSMatthew Dillon }
2633b7d5e03cSMatthew Dillon for (j = 0; j < 4; j++) {
2634b7d5e03cSMatthew Dillon wr_data = pattern_data[j];
2635b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, addr, wr_data);
2636b7d5e03cSMatthew Dillon rd_data = OS_REG_READ(ah, addr);
2637b7d5e03cSMatthew Dillon if (wr_data != rd_data) {
2638b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_REGIO,
2639b7d5e03cSMatthew Dillon "%s: address test failed addr: "
2640b7d5e03cSMatthew Dillon "0x%08x - wr:0x%08x != rd:0x%08x\n",
2641b7d5e03cSMatthew Dillon __func__, addr, wr_data, rd_data);
2642b7d5e03cSMatthew Dillon return AH_FALSE;
2643b7d5e03cSMatthew Dillon }
2644b7d5e03cSMatthew Dillon }
2645b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, reg_addr[i], reg_hold[i]);
2646b7d5e03cSMatthew Dillon }
2647b7d5e03cSMatthew Dillon OS_DELAY(100);
2648b7d5e03cSMatthew Dillon return AH_TRUE;
2649b7d5e03cSMatthew Dillon }
2650b7d5e03cSMatthew Dillon
2651b7d5e03cSMatthew Dillon /*
2652b7d5e03cSMatthew Dillon * Store the channel edges for the requested operational mode
2653b7d5e03cSMatthew Dillon */
2654b7d5e03cSMatthew Dillon HAL_BOOL
ar9300_get_channel_edges(struct ath_hal * ah,u_int16_t flags,u_int16_t * low,u_int16_t * high)2655b7d5e03cSMatthew Dillon ar9300_get_channel_edges(struct ath_hal *ah,
2656b7d5e03cSMatthew Dillon u_int16_t flags, u_int16_t *low, u_int16_t *high)
2657b7d5e03cSMatthew Dillon {
2658b7d5e03cSMatthew Dillon struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
2659b7d5e03cSMatthew Dillon HAL_CAPABILITIES *p_cap = &ahpriv->ah_caps;
2660b7d5e03cSMatthew Dillon
2661b7d5e03cSMatthew Dillon if (flags & IEEE80211_CHAN_5GHZ) {
2662b7d5e03cSMatthew Dillon *low = p_cap->halLow5GhzChan;
2663b7d5e03cSMatthew Dillon *high = p_cap->halHigh5GhzChan;
2664b7d5e03cSMatthew Dillon return AH_TRUE;
2665b7d5e03cSMatthew Dillon }
2666b7d5e03cSMatthew Dillon if ((flags & IEEE80211_CHAN_2GHZ)) {
2667b7d5e03cSMatthew Dillon *low = p_cap->halLow2GhzChan;
2668b7d5e03cSMatthew Dillon *high = p_cap->halHigh2GhzChan;
2669b7d5e03cSMatthew Dillon
2670b7d5e03cSMatthew Dillon return AH_TRUE;
2671b7d5e03cSMatthew Dillon }
2672b7d5e03cSMatthew Dillon return AH_FALSE;
2673b7d5e03cSMatthew Dillon }
2674b7d5e03cSMatthew Dillon
2675b7d5e03cSMatthew Dillon HAL_BOOL
ar9300_regulatory_domain_override(struct ath_hal * ah,u_int16_t regdmn)2676b7d5e03cSMatthew Dillon ar9300_regulatory_domain_override(struct ath_hal *ah, u_int16_t regdmn)
2677b7d5e03cSMatthew Dillon {
2678b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_currentRD = regdmn;
2679b7d5e03cSMatthew Dillon return AH_TRUE;
2680b7d5e03cSMatthew Dillon }
2681b7d5e03cSMatthew Dillon
2682b7d5e03cSMatthew Dillon /*
2683b7d5e03cSMatthew Dillon * Fill all software cached or static hardware state information.
2684b7d5e03cSMatthew Dillon * Return failure if capabilities are to come from EEPROM and
2685b7d5e03cSMatthew Dillon * cannot be read.
2686b7d5e03cSMatthew Dillon */
2687b7d5e03cSMatthew Dillon HAL_BOOL
ar9300_fill_capability_info(struct ath_hal * ah)2688b7d5e03cSMatthew Dillon ar9300_fill_capability_info(struct ath_hal *ah)
2689b7d5e03cSMatthew Dillon {
2690b7d5e03cSMatthew Dillon #define AR_KEYTABLE_SIZE 128
2691b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
2692b7d5e03cSMatthew Dillon struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
2693b7d5e03cSMatthew Dillon HAL_CAPABILITIES *p_cap = &ahpriv->ah_caps;
2694b7d5e03cSMatthew Dillon u_int16_t cap_field = 0, eeval;
2695b7d5e03cSMatthew Dillon
2696b7d5e03cSMatthew Dillon ahpriv->ah_devType = (u_int16_t)ar9300_eeprom_get(ahp, EEP_DEV_TYPE);
2697b7d5e03cSMatthew Dillon eeval = ar9300_eeprom_get(ahp, EEP_REG_0);
2698b7d5e03cSMatthew Dillon
2699b7d5e03cSMatthew Dillon /* XXX record serial number */
2700b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_currentRD = eeval;
2701b7d5e03cSMatthew Dillon
2702b7d5e03cSMatthew Dillon /* Always enable fast clock; leave it up to EEPROM and channel */
2703b7d5e03cSMatthew Dillon p_cap->halSupportsFastClock5GHz = AH_TRUE;
2704b7d5e03cSMatthew Dillon
2705b7d5e03cSMatthew Dillon p_cap->halIntrMitigation = AH_TRUE;
2706b7d5e03cSMatthew Dillon eeval = ar9300_eeprom_get(ahp, EEP_REG_1);
2707b7d5e03cSMatthew Dillon AH_PRIVATE(ah)->ah_currentRDext = eeval | AR9300_RDEXT_DEFAULT;
2708b7d5e03cSMatthew Dillon
2709b7d5e03cSMatthew Dillon /* Read the capability EEPROM location */
2710b7d5e03cSMatthew Dillon cap_field = ar9300_eeprom_get(ahp, EEP_OP_CAP);
2711b7d5e03cSMatthew Dillon
2712b7d5e03cSMatthew Dillon /* Construct wireless mode from EEPROM */
2713b7d5e03cSMatthew Dillon p_cap->halWirelessModes = 0;
2714b7d5e03cSMatthew Dillon eeval = ar9300_eeprom_get(ahp, EEP_OP_MODE);
2715b7d5e03cSMatthew Dillon
2716b7d5e03cSMatthew Dillon /*
2717b7d5e03cSMatthew Dillon * XXX FreeBSD specific: for now, set ath_hal_ht_enable to 1,
2718b7d5e03cSMatthew Dillon * or we won't have 11n support.
2719b7d5e03cSMatthew Dillon */
2720b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_ht_enable = 1;
2721b7d5e03cSMatthew Dillon
2722b7d5e03cSMatthew Dillon if (eeval & AR9300_OPFLAGS_11A) {
2723b7d5e03cSMatthew Dillon p_cap->halWirelessModes |= HAL_MODE_11A |
2724b7d5e03cSMatthew Dillon ((!ah->ah_config.ath_hal_ht_enable ||
2725b7d5e03cSMatthew Dillon (eeval & AR9300_OPFLAGS_N_5G_HT20)) ? 0 :
2726b7d5e03cSMatthew Dillon (HAL_MODE_11NA_HT20 | ((eeval & AR9300_OPFLAGS_N_5G_HT40) ? 0 :
2727b7d5e03cSMatthew Dillon (HAL_MODE_11NA_HT40PLUS | HAL_MODE_11NA_HT40MINUS))));
2728b7d5e03cSMatthew Dillon }
2729b7d5e03cSMatthew Dillon if (eeval & AR9300_OPFLAGS_11G) {
2730b7d5e03cSMatthew Dillon p_cap->halWirelessModes |= HAL_MODE_11B | HAL_MODE_11G |
2731b7d5e03cSMatthew Dillon ((!ah->ah_config.ath_hal_ht_enable ||
2732b7d5e03cSMatthew Dillon (eeval & AR9300_OPFLAGS_N_2G_HT20)) ? 0 :
2733b7d5e03cSMatthew Dillon (HAL_MODE_11NG_HT20 | ((eeval & AR9300_OPFLAGS_N_2G_HT40) ? 0 :
2734b7d5e03cSMatthew Dillon (HAL_MODE_11NG_HT40PLUS | HAL_MODE_11NG_HT40MINUS))));
2735b7d5e03cSMatthew Dillon }
2736b7d5e03cSMatthew Dillon
2737b7d5e03cSMatthew Dillon /* Get chainamsks from eeprom */
2738b7d5e03cSMatthew Dillon p_cap->halTxChainMask = ar9300_eeprom_get(ahp, EEP_TX_MASK);
2739b7d5e03cSMatthew Dillon p_cap->halRxChainMask = ar9300_eeprom_get(ahp, EEP_RX_MASK);
2740b7d5e03cSMatthew Dillon
2741b7d5e03cSMatthew Dillon
2742b7d5e03cSMatthew Dillon
2743b7d5e03cSMatthew Dillon #define owl_get_ntxchains(_txchainmask) \
2744b7d5e03cSMatthew Dillon (((_txchainmask >> 2) & 1) + ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
2745b7d5e03cSMatthew Dillon
2746b7d5e03cSMatthew Dillon /* FreeBSD: Update number of TX/RX streams */
2747b7d5e03cSMatthew Dillon p_cap->halTxStreams = owl_get_ntxchains(p_cap->halTxChainMask);
2748b7d5e03cSMatthew Dillon p_cap->halRxStreams = owl_get_ntxchains(p_cap->halRxChainMask);
2749b7d5e03cSMatthew Dillon
2750b7d5e03cSMatthew Dillon
2751b7d5e03cSMatthew Dillon /*
2752b7d5e03cSMatthew Dillon * This being a newer chip supports TKIP non-splitmic mode.
2753b7d5e03cSMatthew Dillon *
2754b7d5e03cSMatthew Dillon */
2755b7d5e03cSMatthew Dillon ahp->ah_misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
2756b7d5e03cSMatthew Dillon p_cap->halTkipMicTxRxKeySupport = AH_TRUE;
2757b7d5e03cSMatthew Dillon
2758b7d5e03cSMatthew Dillon p_cap->halLow2GhzChan = 2312;
2759b7d5e03cSMatthew Dillon p_cap->halHigh2GhzChan = 2732;
2760b7d5e03cSMatthew Dillon
2761b7d5e03cSMatthew Dillon p_cap->halLow5GhzChan = 4920;
2762b7d5e03cSMatthew Dillon p_cap->halHigh5GhzChan = 6100;
2763b7d5e03cSMatthew Dillon
2764b7d5e03cSMatthew Dillon p_cap->halCipherCkipSupport = AH_FALSE;
2765b7d5e03cSMatthew Dillon p_cap->halCipherTkipSupport = AH_TRUE;
2766b7d5e03cSMatthew Dillon p_cap->halCipherAesCcmSupport = AH_TRUE;
2767b7d5e03cSMatthew Dillon
2768b7d5e03cSMatthew Dillon p_cap->halMicCkipSupport = AH_FALSE;
2769b7d5e03cSMatthew Dillon p_cap->halMicTkipSupport = AH_TRUE;
2770b7d5e03cSMatthew Dillon p_cap->halMicAesCcmSupport = AH_TRUE;
2771b7d5e03cSMatthew Dillon
2772b7d5e03cSMatthew Dillon p_cap->halChanSpreadSupport = AH_TRUE;
2773b7d5e03cSMatthew Dillon p_cap->halSleepAfterBeaconBroken = AH_TRUE;
2774b7d5e03cSMatthew Dillon
2775b7d5e03cSMatthew Dillon p_cap->halBurstSupport = AH_TRUE;
2776b7d5e03cSMatthew Dillon p_cap->halChapTuningSupport = AH_TRUE;
2777b7d5e03cSMatthew Dillon p_cap->halTurboPrimeSupport = AH_TRUE;
2778*a20e5e51SMatthew Dillon p_cap->halFastFramesSupport = AH_TRUE;
2779b7d5e03cSMatthew Dillon
2780b7d5e03cSMatthew Dillon p_cap->halTurboGSupport = p_cap->halWirelessModes & HAL_MODE_108G;
2781b7d5e03cSMatthew Dillon
2782b7d5e03cSMatthew Dillon // p_cap->hal_xr_support = AH_FALSE;
2783b7d5e03cSMatthew Dillon
2784b7d5e03cSMatthew Dillon p_cap->halHTSupport =
2785b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_ht_enable ? AH_TRUE : AH_FALSE;
2786b7d5e03cSMatthew Dillon
2787b7d5e03cSMatthew Dillon p_cap->halGTTSupport = AH_TRUE;
2788b7d5e03cSMatthew Dillon p_cap->halPSPollBroken = AH_TRUE; /* XXX fixed in later revs? */
2789b7d5e03cSMatthew Dillon p_cap->halNumMRRetries = 4; /* Hardware supports 4 MRR */
2790b7d5e03cSMatthew Dillon p_cap->halHTSGI20Support = AH_TRUE;
2791b7d5e03cSMatthew Dillon p_cap->halVEOLSupport = AH_TRUE;
2792b7d5e03cSMatthew Dillon p_cap->halBssIdMaskSupport = AH_TRUE;
2793b7d5e03cSMatthew Dillon /* Bug 26802, fixed in later revs? */
2794b7d5e03cSMatthew Dillon p_cap->halMcastKeySrchSupport = AH_TRUE;
2795b7d5e03cSMatthew Dillon p_cap->halTsfAddSupport = AH_TRUE;
2796b7d5e03cSMatthew Dillon
2797b7d5e03cSMatthew Dillon if (cap_field & AR_EEPROM_EEPCAP_MAXQCU) {
2798b7d5e03cSMatthew Dillon p_cap->halTotalQueues = MS(cap_field, AR_EEPROM_EEPCAP_MAXQCU);
2799b7d5e03cSMatthew Dillon } else {
2800b7d5e03cSMatthew Dillon p_cap->halTotalQueues = HAL_NUM_TX_QUEUES;
2801b7d5e03cSMatthew Dillon }
2802b7d5e03cSMatthew Dillon
2803b7d5e03cSMatthew Dillon if (cap_field & AR_EEPROM_EEPCAP_KC_ENTRIES) {
2804b7d5e03cSMatthew Dillon p_cap->halKeyCacheSize =
2805b7d5e03cSMatthew Dillon 1 << MS(cap_field, AR_EEPROM_EEPCAP_KC_ENTRIES);
2806b7d5e03cSMatthew Dillon } else {
2807b7d5e03cSMatthew Dillon p_cap->halKeyCacheSize = AR_KEYTABLE_SIZE;
2808b7d5e03cSMatthew Dillon }
2809b7d5e03cSMatthew Dillon p_cap->halFastCCSupport = AH_TRUE;
2810b7d5e03cSMatthew Dillon // p_cap->hal_num_mr_retries = 4;
2811b7d5e03cSMatthew Dillon // ahp->hal_tx_trig_level_max = MAX_TX_FIFO_THRESHOLD;
2812b7d5e03cSMatthew Dillon
2813b7d5e03cSMatthew Dillon p_cap->halNumGpioPins = AR9382_MAX_GPIO_PIN_NUM;
2814b7d5e03cSMatthew Dillon
2815b7d5e03cSMatthew Dillon #if 0
2816b7d5e03cSMatthew Dillon /* XXX Verify support in Osprey */
2817b7d5e03cSMatthew Dillon if (AR_SREV_MERLIN_10_OR_LATER(ah)) {
2818b7d5e03cSMatthew Dillon p_cap->halWowSupport = AH_TRUE;
2819b7d5e03cSMatthew Dillon p_cap->hal_wow_match_pattern_exact = AH_TRUE;
2820b7d5e03cSMatthew Dillon if (AR_SREV_MERLIN(ah)) {
2821b7d5e03cSMatthew Dillon p_cap->hal_wow_pattern_match_dword = AH_TRUE;
2822b7d5e03cSMatthew Dillon }
2823b7d5e03cSMatthew Dillon } else {
2824b7d5e03cSMatthew Dillon p_cap->halWowSupport = AH_FALSE;
2825b7d5e03cSMatthew Dillon p_cap->hal_wow_match_pattern_exact = AH_FALSE;
2826b7d5e03cSMatthew Dillon }
2827b7d5e03cSMatthew Dillon #endif
2828b7d5e03cSMatthew Dillon p_cap->halWowSupport = AH_TRUE;
2829b7d5e03cSMatthew Dillon p_cap->halWowMatchPatternExact = AH_TRUE;
2830b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah)) {
2831b7d5e03cSMatthew Dillon p_cap->halWowMatchPatternExact = AH_TRUE;
2832b7d5e03cSMatthew Dillon }
2833b7d5e03cSMatthew Dillon
2834b7d5e03cSMatthew Dillon p_cap->halCSTSupport = AH_TRUE;
2835b7d5e03cSMatthew Dillon
2836b7d5e03cSMatthew Dillon p_cap->halRifsRxSupport = AH_TRUE;
2837b7d5e03cSMatthew Dillon p_cap->halRifsTxSupport = AH_TRUE;
2838b7d5e03cSMatthew Dillon
2839b7d5e03cSMatthew Dillon #define IEEE80211_AMPDU_LIMIT_MAX (65536)
2840b7d5e03cSMatthew Dillon p_cap->halRtsAggrLimit = IEEE80211_AMPDU_LIMIT_MAX;
2841b7d5e03cSMatthew Dillon #undef IEEE80211_AMPDU_LIMIT_MAX
2842b7d5e03cSMatthew Dillon
2843b7d5e03cSMatthew Dillon p_cap->halMfpSupport = ah->ah_config.ath_hal_mfp_support;
2844b7d5e03cSMatthew Dillon
2845b7d5e03cSMatthew Dillon p_cap->halForcePpmSupport = AH_TRUE;
2846b7d5e03cSMatthew Dillon p_cap->halHwBeaconProcSupport = AH_TRUE;
2847b7d5e03cSMatthew Dillon
2848b7d5e03cSMatthew Dillon /* ar9300 - has the HW UAPSD trigger support,
2849b7d5e03cSMatthew Dillon * but it has the following limitations
2850b7d5e03cSMatthew Dillon * The power state change from the following
2851b7d5e03cSMatthew Dillon * frames are not put in High priority queue.
2852b7d5e03cSMatthew Dillon * i) Mgmt frames
2853b7d5e03cSMatthew Dillon * ii) NoN QoS frames
2854b7d5e03cSMatthew Dillon * iii) QoS frames form the access categories for which
2855b7d5e03cSMatthew Dillon * UAPSD is not enabled.
2856b7d5e03cSMatthew Dillon * so we can not enable this feature currently.
2857b7d5e03cSMatthew Dillon * could be enabled, if these limitations are fixed
2858b7d5e03cSMatthew Dillon * in later versions of ar9300 chips
2859b7d5e03cSMatthew Dillon */
2860b7d5e03cSMatthew Dillon p_cap->halHasUapsdSupport = AH_FALSE;
2861b7d5e03cSMatthew Dillon
2862b7d5e03cSMatthew Dillon /* Number of buffers that can be help in a single TxD */
2863b7d5e03cSMatthew Dillon p_cap->halNumTxMaps = 4;
2864b7d5e03cSMatthew Dillon
2865b7d5e03cSMatthew Dillon p_cap->halTxDescLen = sizeof(struct ar9300_txc);
2866b7d5e03cSMatthew Dillon p_cap->halTxStatusLen = sizeof(struct ar9300_txs);
2867b7d5e03cSMatthew Dillon p_cap->halRxStatusLen = sizeof(struct ar9300_rxs);
2868b7d5e03cSMatthew Dillon
2869b7d5e03cSMatthew Dillon p_cap->halRxHpFifoDepth = HAL_HP_RXFIFO_DEPTH;
2870b7d5e03cSMatthew Dillon p_cap->halRxLpFifoDepth = HAL_LP_RXFIFO_DEPTH;
2871b7d5e03cSMatthew Dillon
2872b7d5e03cSMatthew Dillon /* Enable extension channel DFS support */
2873b7d5e03cSMatthew Dillon p_cap->halUseCombinedRadarRssi = AH_TRUE;
2874b7d5e03cSMatthew Dillon p_cap->halExtChanDfsSupport = AH_TRUE;
2875b7d5e03cSMatthew Dillon #if ATH_SUPPORT_SPECTRAL
2876b7d5e03cSMatthew Dillon p_cap->halSpectralScanSupport = AH_TRUE;
2877b7d5e03cSMatthew Dillon #endif
2878b7d5e03cSMatthew Dillon
2879b7d5e03cSMatthew Dillon ahpriv->ah_rfsilent = ar9300_eeprom_get(ahp, EEP_RF_SILENT);
2880b7d5e03cSMatthew Dillon if (ahpriv->ah_rfsilent & EEP_RFSILENT_ENABLED) {
2881b7d5e03cSMatthew Dillon ahp->ah_gpio_select = MS(ahpriv->ah_rfsilent, EEP_RFSILENT_GPIO_SEL);
2882b7d5e03cSMatthew Dillon ahp->ah_polarity = MS(ahpriv->ah_rfsilent, EEP_RFSILENT_POLARITY);
2883b7d5e03cSMatthew Dillon
2884b7d5e03cSMatthew Dillon ath_hal_enable_rfkill(ah, AH_TRUE);
2885b7d5e03cSMatthew Dillon p_cap->halRfSilentSupport = AH_TRUE;
2886b7d5e03cSMatthew Dillon }
2887b7d5e03cSMatthew Dillon
2888b7d5e03cSMatthew Dillon /* XXX */
2889b7d5e03cSMatthew Dillon p_cap->halWpsPushButtonSupport = AH_FALSE;
2890b7d5e03cSMatthew Dillon
2891b7d5e03cSMatthew Dillon #ifdef ATH_BT_COEX
2892b7d5e03cSMatthew Dillon p_cap->halBtCoexSupport = AH_TRUE;
2893b7d5e03cSMatthew Dillon p_cap->halBtCoexApsmWar = AH_FALSE;
2894b7d5e03cSMatthew Dillon #endif
2895b7d5e03cSMatthew Dillon
2896b7d5e03cSMatthew Dillon p_cap->halGenTimerSupport = AH_TRUE;
2897b7d5e03cSMatthew Dillon ahp->ah_avail_gen_timers = ~((1 << AR_FIRST_NDP_TIMER) - 1);
2898b7d5e03cSMatthew Dillon ahp->ah_avail_gen_timers &= (1 << AR_NUM_GEN_TIMERS) - 1;
2899b7d5e03cSMatthew Dillon /*
2900b7d5e03cSMatthew Dillon * According to Kyungwan, generic timer 0 and 8 are special
2901b7d5e03cSMatthew Dillon * timers. Remove timer 8 from the available gen timer list.
2902b7d5e03cSMatthew Dillon * Jupiter testing shows timer won't trigger with timer 8.
2903b7d5e03cSMatthew Dillon */
2904b7d5e03cSMatthew Dillon ahp->ah_avail_gen_timers &= ~(1 << AR_GEN_TIMER_RESERVED);
2905b7d5e03cSMatthew Dillon
2906b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)) {
2907b7d5e03cSMatthew Dillon #if ATH_SUPPORT_MCI
2908b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_mci_config & ATH_MCI_CONFIG_DISABLE_MCI)
2909b7d5e03cSMatthew Dillon {
2910b7d5e03cSMatthew Dillon p_cap->halMciSupport = AH_FALSE;
2911b7d5e03cSMatthew Dillon }
2912b7d5e03cSMatthew Dillon else
2913b7d5e03cSMatthew Dillon #endif
2914b7d5e03cSMatthew Dillon {
2915b7d5e03cSMatthew Dillon p_cap->halMciSupport = (ahp->ah_enterprise_mode &
2916b7d5e03cSMatthew Dillon AR_ENT_OTP_49GHZ_DISABLE) ? AH_FALSE: AH_TRUE;
2917b7d5e03cSMatthew Dillon }
2918b7d5e03cSMatthew Dillon HALDEBUG(AH_NULL, HAL_DEBUG_UNMASKABLE,
2919b7d5e03cSMatthew Dillon "%s: (MCI) MCI support = %d\n",
2920b7d5e03cSMatthew Dillon __func__, p_cap->halMciSupport);
2921b7d5e03cSMatthew Dillon }
2922b7d5e03cSMatthew Dillon else {
2923b7d5e03cSMatthew Dillon p_cap->halMciSupport = AH_FALSE;
2924b7d5e03cSMatthew Dillon }
2925b7d5e03cSMatthew Dillon
2926b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER_20(ah)) {
2927b7d5e03cSMatthew Dillon p_cap->halRadioRetentionSupport = AH_TRUE;
2928b7d5e03cSMatthew Dillon } else {
2929b7d5e03cSMatthew Dillon p_cap->halRadioRetentionSupport = AH_FALSE;
2930b7d5e03cSMatthew Dillon }
2931b7d5e03cSMatthew Dillon
2932b7d5e03cSMatthew Dillon p_cap->halAutoSleepSupport = AH_TRUE;
2933b7d5e03cSMatthew Dillon
2934b7d5e03cSMatthew Dillon p_cap->halMbssidAggrSupport = AH_TRUE;
2935b7d5e03cSMatthew Dillon // p_cap->hal_proxy_sta_support = AH_TRUE;
2936b7d5e03cSMatthew Dillon
2937b7d5e03cSMatthew Dillon /* XXX Mark it true after it is verfied as fixed */
2938b7d5e03cSMatthew Dillon p_cap->hal4kbSplitTransSupport = AH_FALSE;
2939b7d5e03cSMatthew Dillon
2940b7d5e03cSMatthew Dillon /* Read regulatory domain flag */
2941b7d5e03cSMatthew Dillon if (AH_PRIVATE(ah)->ah_currentRDext & (1 << REG_EXT_JAPAN_MIDBAND)) {
2942b7d5e03cSMatthew Dillon /*
2943b7d5e03cSMatthew Dillon * If REG_EXT_JAPAN_MIDBAND is set, turn on U1 EVEN, U2, and MIDBAND.
2944b7d5e03cSMatthew Dillon */
2945b7d5e03cSMatthew Dillon p_cap->halRegCap =
2946b7d5e03cSMatthew Dillon AR_EEPROM_EEREGCAP_EN_KK_NEW_11A |
2947b7d5e03cSMatthew Dillon AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN |
2948b7d5e03cSMatthew Dillon AR_EEPROM_EEREGCAP_EN_KK_U2 |
2949b7d5e03cSMatthew Dillon AR_EEPROM_EEREGCAP_EN_KK_MIDBAND;
2950b7d5e03cSMatthew Dillon } else {
2951b7d5e03cSMatthew Dillon p_cap->halRegCap =
2952b7d5e03cSMatthew Dillon AR_EEPROM_EEREGCAP_EN_KK_NEW_11A | AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN;
2953b7d5e03cSMatthew Dillon }
2954b7d5e03cSMatthew Dillon
2955b7d5e03cSMatthew Dillon /* For AR9300 and above, midband channels are always supported */
2956b7d5e03cSMatthew Dillon p_cap->halRegCap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND;
2957b7d5e03cSMatthew Dillon
2958b7d5e03cSMatthew Dillon p_cap->halNumAntCfg5GHz =
2959b7d5e03cSMatthew Dillon ar9300_eeprom_get_num_ant_config(ahp, HAL_FREQ_BAND_5GHZ);
2960b7d5e03cSMatthew Dillon p_cap->halNumAntCfg2GHz =
2961b7d5e03cSMatthew Dillon ar9300_eeprom_get_num_ant_config(ahp, HAL_FREQ_BAND_2GHZ);
2962b7d5e03cSMatthew Dillon
2963b7d5e03cSMatthew Dillon /* STBC supported */
2964b7d5e03cSMatthew Dillon p_cap->halRxStbcSupport = 1; /* number of streams for STBC recieve. */
2965b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON(ah) || AR_SREV_APHRODITE(ah)) {
2966b7d5e03cSMatthew Dillon p_cap->halTxStbcSupport = 0;
2967b7d5e03cSMatthew Dillon } else {
2968b7d5e03cSMatthew Dillon p_cap->halTxStbcSupport = 1;
2969b7d5e03cSMatthew Dillon }
2970b7d5e03cSMatthew Dillon
2971b7d5e03cSMatthew Dillon p_cap->halEnhancedDmaSupport = AH_TRUE;
2972b7d5e03cSMatthew Dillon p_cap->halEnhancedDfsSupport = AH_TRUE;
2973b7d5e03cSMatthew Dillon
2974b7d5e03cSMatthew Dillon /*
2975b7d5e03cSMatthew Dillon * EV61133 (missing interrupts due to AR_ISR_RAC).
2976b7d5e03cSMatthew Dillon * Fixed in Osprey 2.0.
2977b7d5e03cSMatthew Dillon */
2978b7d5e03cSMatthew Dillon p_cap->halIsrRacSupport = AH_TRUE;
2979b7d5e03cSMatthew Dillon
2980b7d5e03cSMatthew Dillon /* XXX FreeBSD won't support TKIP and WEP aggregation */
2981b7d5e03cSMatthew Dillon #if 0
2982b7d5e03cSMatthew Dillon p_cap->hal_wep_tkip_aggr_support = AH_TRUE;
2983b7d5e03cSMatthew Dillon p_cap->hal_wep_tkip_aggr_num_tx_delim = 10; /* TBD */
2984b7d5e03cSMatthew Dillon p_cap->hal_wep_tkip_aggr_num_rx_delim = 10; /* TBD */
2985b7d5e03cSMatthew Dillon p_cap->hal_wep_tkip_max_ht_rate = 15; /* TBD */
2986b7d5e03cSMatthew Dillon #endif
2987b7d5e03cSMatthew Dillon
2988b7d5e03cSMatthew Dillon /*
2989b7d5e03cSMatthew Dillon * XXX FreeBSD won't need these; but eventually add them
2990b7d5e03cSMatthew Dillon * and add the WARs - AGGR extra delim WAR is useful to know
2991b7d5e03cSMatthew Dillon * about.
2992b7d5e03cSMatthew Dillon */
2993b7d5e03cSMatthew Dillon #if 0
2994b7d5e03cSMatthew Dillon p_cap->hal_cfend_fix_support = AH_FALSE;
2995b7d5e03cSMatthew Dillon p_cap->hal_aggr_extra_delim_war = AH_FALSE;
2996b7d5e03cSMatthew Dillon #endif
2997b7d5e03cSMatthew Dillon p_cap->halHasLongRxDescTsf = AH_TRUE;
2998b7d5e03cSMatthew Dillon // p_cap->hal_rx_desc_timestamp_bits = 32;
2999b7d5e03cSMatthew Dillon p_cap->halRxTxAbortSupport = AH_TRUE;
3000b7d5e03cSMatthew Dillon p_cap->hal_ani_poll_interval = AR9300_ANI_POLLINTERVAL;
3001b7d5e03cSMatthew Dillon p_cap->hal_channel_switch_time_usec = AR9300_CHANNEL_SWITCH_TIME_USEC;
3002b7d5e03cSMatthew Dillon
3003b7d5e03cSMatthew Dillon /* Transmit Beamforming supported, fill capabilities */
3004b7d5e03cSMatthew Dillon p_cap->halPaprdEnabled = ar9300_eeprom_get(ahp, EEP_PAPRD_ENABLED);
3005b7d5e03cSMatthew Dillon p_cap->halChanHalfRate =
3006b7d5e03cSMatthew Dillon !(ahp->ah_enterprise_mode & AR_ENT_OTP_10MHZ_DISABLE);
3007b7d5e03cSMatthew Dillon p_cap->halChanQuarterRate =
3008b7d5e03cSMatthew Dillon !(ahp->ah_enterprise_mode & AR_ENT_OTP_5MHZ_DISABLE);
3009b7d5e03cSMatthew Dillon
3010b7d5e03cSMatthew Dillon if(AR_SREV_JUPITER(ah) || AR_SREV_APHRODITE(ah)){
3011b7d5e03cSMatthew Dillon /* There is no AR_ENT_OTP_49GHZ_DISABLE feature in Jupiter, now the bit is used to disable BT. */
3012b7d5e03cSMatthew Dillon p_cap->hal49GhzSupport = 1;
3013b7d5e03cSMatthew Dillon } else {
3014b7d5e03cSMatthew Dillon p_cap->hal49GhzSupport = !(ahp->ah_enterprise_mode & AR_ENT_OTP_49GHZ_DISABLE);
3015b7d5e03cSMatthew Dillon }
3016b7d5e03cSMatthew Dillon
3017b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah) || AR_SREV_HORNET(ah) || AR_SREV_APHRODITE(ah)) {
3018b7d5e03cSMatthew Dillon /* LDPC supported */
3019b7d5e03cSMatthew Dillon /* Poseidon doesn't support LDPC, or it will cause receiver CRC Error */
3020b7d5e03cSMatthew Dillon p_cap->halLDPCSupport = AH_FALSE;
3021b7d5e03cSMatthew Dillon /* PCI_E LCR offset */
3022b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah)) {
3023b7d5e03cSMatthew Dillon p_cap->hal_pcie_lcr_offset = 0x80; /*for Poseidon*/
3024b7d5e03cSMatthew Dillon }
3025b7d5e03cSMatthew Dillon /*WAR method for APSM L0s with Poseidon 1.0*/
3026b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON_10(ah)) {
3027b7d5e03cSMatthew Dillon p_cap->hal_pcie_lcr_extsync_en = AH_TRUE;
3028b7d5e03cSMatthew Dillon }
3029b7d5e03cSMatthew Dillon } else {
3030b7d5e03cSMatthew Dillon p_cap->halLDPCSupport = AH_TRUE;
3031b7d5e03cSMatthew Dillon }
3032b7d5e03cSMatthew Dillon
3033b7d5e03cSMatthew Dillon /* XXX is this a flag, or a chainmask number? */
3034b7d5e03cSMatthew Dillon p_cap->halApmEnable = !! ar9300_eeprom_get(ahp, EEP_CHAIN_MASK_REDUCE);
3035b7d5e03cSMatthew Dillon #if ATH_ANT_DIV_COMB
3036b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3037b7d5e03cSMatthew Dillon if (ahp->ah_diversity_control == HAL_ANT_VARIABLE) {
3038b7d5e03cSMatthew Dillon u_int8_t ant_div_control1 =
3039b7d5e03cSMatthew Dillon ar9300_eeprom_get(ahp, EEP_ANTDIV_control);
3040b7d5e03cSMatthew Dillon /* if enable_lnadiv is 0x1 and enable_fast_div is 0x1,
3041b7d5e03cSMatthew Dillon * we enable the diversity-combining algorithm.
3042b7d5e03cSMatthew Dillon */
3043b7d5e03cSMatthew Dillon if ((ant_div_control1 >> 0x6) == 0x3) {
3044b7d5e03cSMatthew Dillon p_cap->halAntDivCombSupport = AH_TRUE;
3045b7d5e03cSMatthew Dillon }
3046b7d5e03cSMatthew Dillon p_cap->halAntDivCombSupportOrg = p_cap->halAntDivCombSupport;
3047b7d5e03cSMatthew Dillon }
3048b7d5e03cSMatthew Dillon }
3049b7d5e03cSMatthew Dillon #endif /* ATH_ANT_DIV_COMB */
3050b7d5e03cSMatthew Dillon
3051b7d5e03cSMatthew Dillon /*
3052b7d5e03cSMatthew Dillon * FreeBSD: enable LNA mixing if the chip is Hornet or Poseidon.
3053b7d5e03cSMatthew Dillon */
3054b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3055b7d5e03cSMatthew Dillon p_cap->halRxUsingLnaMixing = AH_TRUE;
3056b7d5e03cSMatthew Dillon }
3057b7d5e03cSMatthew Dillon
3058d98a0bcfSMatthew Dillon /*
3059d98a0bcfSMatthew Dillon * AR5416 and later NICs support MYBEACON filtering.
3060d98a0bcfSMatthew Dillon */
3061d98a0bcfSMatthew Dillon p_cap->halRxDoMyBeacon = AH_TRUE;
3062b7d5e03cSMatthew Dillon
3063b7d5e03cSMatthew Dillon #if ATH_WOW_OFFLOAD
3064b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER_20_OR_LATER(ah) || AR_SREV_APHRODITE(ah)) {
3065b7d5e03cSMatthew Dillon p_cap->hal_wow_gtk_offload_support = AH_TRUE;
3066b7d5e03cSMatthew Dillon p_cap->hal_wow_arp_offload_support = AH_TRUE;
3067b7d5e03cSMatthew Dillon p_cap->hal_wow_ns_offload_support = AH_TRUE;
3068b7d5e03cSMatthew Dillon p_cap->hal_wow_4way_hs_wakeup_support = AH_TRUE;
3069b7d5e03cSMatthew Dillon p_cap->hal_wow_acer_magic_support = AH_TRUE;
3070b7d5e03cSMatthew Dillon p_cap->hal_wow_acer_swka_support = AH_TRUE;
3071b7d5e03cSMatthew Dillon } else {
3072b7d5e03cSMatthew Dillon p_cap->hal_wow_gtk_offload_support = AH_FALSE;
3073b7d5e03cSMatthew Dillon p_cap->hal_wow_arp_offload_support = AH_FALSE;
3074b7d5e03cSMatthew Dillon p_cap->hal_wow_ns_offload_support = AH_FALSE;
3075b7d5e03cSMatthew Dillon p_cap->hal_wow_4way_hs_wakeup_support = AH_FALSE;
3076b7d5e03cSMatthew Dillon p_cap->hal_wow_acer_magic_support = AH_FALSE;
3077b7d5e03cSMatthew Dillon p_cap->hal_wow_acer_swka_support = AH_FALSE;
3078b7d5e03cSMatthew Dillon }
3079b7d5e03cSMatthew Dillon #endif /* ATH_WOW_OFFLOAD */
3080b7d5e03cSMatthew Dillon
3081b7d5e03cSMatthew Dillon
3082b7d5e03cSMatthew Dillon return AH_TRUE;
3083b7d5e03cSMatthew Dillon #undef AR_KEYTABLE_SIZE
3084b7d5e03cSMatthew Dillon }
3085b7d5e03cSMatthew Dillon
3086b7d5e03cSMatthew Dillon #if 0
3087b7d5e03cSMatthew Dillon static HAL_BOOL
3088b7d5e03cSMatthew Dillon ar9300_get_chip_power_limits(struct ath_hal *ah, HAL_CHANNEL *chans,
3089b7d5e03cSMatthew Dillon u_int32_t nchans)
3090b7d5e03cSMatthew Dillon {
3091b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3092b7d5e03cSMatthew Dillon
3093b7d5e03cSMatthew Dillon return ahp->ah_rf_hal.get_chip_power_lim(ah, chans, nchans);
3094b7d5e03cSMatthew Dillon }
3095b7d5e03cSMatthew Dillon #endif
3096b7d5e03cSMatthew Dillon /* XXX FreeBSD */
3097b7d5e03cSMatthew Dillon
3098b7d5e03cSMatthew Dillon static HAL_BOOL
ar9300_get_chip_power_limits(struct ath_hal * ah,struct ieee80211_channel * chan)3099b7d5e03cSMatthew Dillon ar9300_get_chip_power_limits(struct ath_hal *ah,
3100b7d5e03cSMatthew Dillon struct ieee80211_channel *chan)
3101b7d5e03cSMatthew Dillon {
3102b7d5e03cSMatthew Dillon
3103b7d5e03cSMatthew Dillon chan->ic_maxpower = AR9300_MAX_RATE_POWER;
3104b7d5e03cSMatthew Dillon chan->ic_minpower = 0;
3105b7d5e03cSMatthew Dillon
3106b7d5e03cSMatthew Dillon return AH_TRUE;
3107b7d5e03cSMatthew Dillon }
3108b7d5e03cSMatthew Dillon
3109b7d5e03cSMatthew Dillon /*
3110b7d5e03cSMatthew Dillon * Disable PLL when in L0s as well as receiver clock when in L1.
3111b7d5e03cSMatthew Dillon * This power saving option must be enabled through the Serdes.
3112b7d5e03cSMatthew Dillon *
3113b7d5e03cSMatthew Dillon * Programming the Serdes must go through the same 288 bit serial shift
3114b7d5e03cSMatthew Dillon * register as the other analog registers. Hence the 9 writes.
3115b7d5e03cSMatthew Dillon *
3116b7d5e03cSMatthew Dillon * XXX Clean up the magic numbers.
3117b7d5e03cSMatthew Dillon */
3118b7d5e03cSMatthew Dillon void
ar9300_config_pci_power_save(struct ath_hal * ah,int restore,int power_off)3119b7d5e03cSMatthew Dillon ar9300_config_pci_power_save(struct ath_hal *ah, int restore, int power_off)
3120b7d5e03cSMatthew Dillon {
3121b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3122b7d5e03cSMatthew Dillon int i;
3123b7d5e03cSMatthew Dillon
3124b7d5e03cSMatthew Dillon if (AH_PRIVATE(ah)->ah_ispcie != AH_TRUE) {
3125b7d5e03cSMatthew Dillon return;
3126b7d5e03cSMatthew Dillon }
3127b7d5e03cSMatthew Dillon
3128b7d5e03cSMatthew Dillon /*
3129b7d5e03cSMatthew Dillon * Increase L1 Entry Latency. Some WB222 boards don't have
3130b7d5e03cSMatthew Dillon * this change in eeprom/OTP.
3131b7d5e03cSMatthew Dillon */
3132b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER(ah)) {
3133b7d5e03cSMatthew Dillon u_int32_t val = ah->ah_config.ath_hal_war70c;
3134b7d5e03cSMatthew Dillon if ((val & 0xff000000) == 0x17000000) {
3135b7d5e03cSMatthew Dillon val &= 0x00ffffff;
3136b7d5e03cSMatthew Dillon val |= 0x27000000;
3137b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, 0x570c, val);
3138b7d5e03cSMatthew Dillon }
3139b7d5e03cSMatthew Dillon }
3140b7d5e03cSMatthew Dillon
3141b7d5e03cSMatthew Dillon /* Do not touch SERDES registers */
3142b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_power_save_enable == 2) {
3143b7d5e03cSMatthew Dillon return;
3144b7d5e03cSMatthew Dillon }
3145b7d5e03cSMatthew Dillon
3146b7d5e03cSMatthew Dillon /* Nothing to do on restore for 11N */
3147b7d5e03cSMatthew Dillon if (!restore) {
3148b7d5e03cSMatthew Dillon /* set bit 19 to allow forcing of pcie core into L1 state */
3149b7d5e03cSMatthew Dillon OS_REG_SET_BIT(ah,
3150b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_PM_CTRL), AR_PCIE_PM_CTRL_ENA);
3151b7d5e03cSMatthew Dillon
3152b7d5e03cSMatthew Dillon /*
3153b7d5e03cSMatthew Dillon * Set PCIE workaround config only if requested, else use the reset
3154b7d5e03cSMatthew Dillon * value of this register.
3155b7d5e03cSMatthew Dillon */
3156b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_waen) {
3157b7d5e03cSMatthew Dillon OS_REG_WRITE(ah,
3158b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_WA),
3159b7d5e03cSMatthew Dillon ah->ah_config.ath_hal_pcie_waen);
3160b7d5e03cSMatthew Dillon } else {
3161b7d5e03cSMatthew Dillon /* Set Bits 17 and 14 in the AR_WA register. */
3162b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, AR_HOSTIF_REG(ah, AR_WA), ahp->ah_wa_reg_val);
3163b7d5e03cSMatthew Dillon }
3164b7d5e03cSMatthew Dillon }
3165b7d5e03cSMatthew Dillon
3166b7d5e03cSMatthew Dillon /* Configure PCIE after Ini init. SERDES values now come from ini file */
3167b7d5e03cSMatthew Dillon if (ah->ah_config.ath_hal_pcie_ser_des_write) {
3168b7d5e03cSMatthew Dillon if (power_off) {
3169b7d5e03cSMatthew Dillon for (i = 0; i < ahp->ah_ini_pcie_serdes.ia_rows; i++) {
3170b7d5e03cSMatthew Dillon OS_REG_WRITE(ah,
3171b7d5e03cSMatthew Dillon INI_RA(&ahp->ah_ini_pcie_serdes, i, 0),
3172b7d5e03cSMatthew Dillon INI_RA(&ahp->ah_ini_pcie_serdes, i, 1));
3173b7d5e03cSMatthew Dillon }
3174b7d5e03cSMatthew Dillon } else {
3175b7d5e03cSMatthew Dillon for (i = 0; i < ahp->ah_ini_pcie_serdes_low_power.ia_rows; i++) {
3176b7d5e03cSMatthew Dillon OS_REG_WRITE(ah,
3177b7d5e03cSMatthew Dillon INI_RA(&ahp->ah_ini_pcie_serdes_low_power, i, 0),
3178b7d5e03cSMatthew Dillon INI_RA(&ahp->ah_ini_pcie_serdes_low_power, i, 1));
3179b7d5e03cSMatthew Dillon }
3180b7d5e03cSMatthew Dillon }
3181b7d5e03cSMatthew Dillon }
3182b7d5e03cSMatthew Dillon
3183b7d5e03cSMatthew Dillon }
3184b7d5e03cSMatthew Dillon
3185b7d5e03cSMatthew Dillon /*
3186b7d5e03cSMatthew Dillon * Recipe from charles to turn off PCIe PHY in PCI mode for power savings
3187b7d5e03cSMatthew Dillon */
3188b7d5e03cSMatthew Dillon void
ar9300_disable_pcie_phy(struct ath_hal * ah)3189b7d5e03cSMatthew Dillon ar9300_disable_pcie_phy(struct ath_hal *ah)
3190b7d5e03cSMatthew Dillon {
3191b7d5e03cSMatthew Dillon /* Osprey does not support PCI mode */
3192b7d5e03cSMatthew Dillon }
3193b7d5e03cSMatthew Dillon
3194b7d5e03cSMatthew Dillon static inline HAL_STATUS
ar9300_init_mac_addr(struct ath_hal * ah)3195b7d5e03cSMatthew Dillon ar9300_init_mac_addr(struct ath_hal *ah)
3196b7d5e03cSMatthew Dillon {
3197b7d5e03cSMatthew Dillon u_int32_t sum;
3198b7d5e03cSMatthew Dillon int i;
3199b7d5e03cSMatthew Dillon u_int16_t eeval;
3200b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3201b7d5e03cSMatthew Dillon u_int32_t EEP_MAC [] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
3202b7d5e03cSMatthew Dillon
3203b7d5e03cSMatthew Dillon sum = 0;
3204b7d5e03cSMatthew Dillon for (i = 0; i < 3; i++) {
3205b7d5e03cSMatthew Dillon eeval = ar9300_eeprom_get(ahp, EEP_MAC[i]);
3206b7d5e03cSMatthew Dillon sum += eeval;
3207b7d5e03cSMatthew Dillon ahp->ah_macaddr[2*i] = eeval >> 8;
3208b7d5e03cSMatthew Dillon ahp->ah_macaddr[2*i + 1] = eeval & 0xff;
3209b7d5e03cSMatthew Dillon }
3210b7d5e03cSMatthew Dillon if (sum == 0 || sum == 0xffff*3) {
3211b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_EEPROM, "%s: mac address read failed: %s\n",
3212b7d5e03cSMatthew Dillon __func__, ath_hal_ether_sprintf(ahp->ah_macaddr));
3213b7d5e03cSMatthew Dillon return HAL_EEBADMAC;
3214b7d5e03cSMatthew Dillon }
3215b7d5e03cSMatthew Dillon
3216b7d5e03cSMatthew Dillon return HAL_OK;
3217b7d5e03cSMatthew Dillon }
3218b7d5e03cSMatthew Dillon
3219b7d5e03cSMatthew Dillon /*
3220b7d5e03cSMatthew Dillon * Code for the "real" chip i.e. non-emulation. Review and revisit
3221b7d5e03cSMatthew Dillon * when actual hardware is at hand.
3222b7d5e03cSMatthew Dillon */
3223b7d5e03cSMatthew Dillon static inline HAL_STATUS
ar9300_hw_attach(struct ath_hal * ah)3224b7d5e03cSMatthew Dillon ar9300_hw_attach(struct ath_hal *ah)
3225b7d5e03cSMatthew Dillon {
3226b7d5e03cSMatthew Dillon HAL_STATUS ecode;
3227b7d5e03cSMatthew Dillon
3228b7d5e03cSMatthew Dillon if (!ar9300_chip_test(ah)) {
3229b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_REGIO,
3230b7d5e03cSMatthew Dillon "%s: hardware self-test failed\n", __func__);
3231b7d5e03cSMatthew Dillon return HAL_ESELFTEST;
3232b7d5e03cSMatthew Dillon }
3233b7d5e03cSMatthew Dillon
3234b7d5e03cSMatthew Dillon ath_hal_printf(ah, "%s: calling ar9300_eeprom_attach\n", __func__);
3235b7d5e03cSMatthew Dillon ecode = ar9300_eeprom_attach(ah);
3236b7d5e03cSMatthew Dillon ath_hal_printf(ah, "%s: ar9300_eeprom_attach returned %d\n", __func__, ecode);
3237b7d5e03cSMatthew Dillon if (ecode != HAL_OK) {
3238b7d5e03cSMatthew Dillon return ecode;
3239b7d5e03cSMatthew Dillon }
3240b7d5e03cSMatthew Dillon if (!ar9300_rf_attach(ah, &ecode)) {
3241b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET, "%s: RF setup failed, status %u\n",
3242b7d5e03cSMatthew Dillon __func__, ecode);
3243b7d5e03cSMatthew Dillon }
3244b7d5e03cSMatthew Dillon
3245b7d5e03cSMatthew Dillon if (ecode != HAL_OK) {
3246b7d5e03cSMatthew Dillon return ecode;
3247b7d5e03cSMatthew Dillon }
3248b7d5e03cSMatthew Dillon ar9300_ani_attach(ah);
3249b7d5e03cSMatthew Dillon
3250b7d5e03cSMatthew Dillon return HAL_OK;
3251b7d5e03cSMatthew Dillon }
3252b7d5e03cSMatthew Dillon
3253b7d5e03cSMatthew Dillon static inline void
ar9300_hw_detach(struct ath_hal * ah)3254b7d5e03cSMatthew Dillon ar9300_hw_detach(struct ath_hal *ah)
3255b7d5e03cSMatthew Dillon {
3256b7d5e03cSMatthew Dillon /* XXX EEPROM allocated state */
3257b7d5e03cSMatthew Dillon ar9300_ani_detach(ah);
3258b7d5e03cSMatthew Dillon }
3259b7d5e03cSMatthew Dillon
3260b7d5e03cSMatthew Dillon static int16_t
ar9300_get_nf_adjust(struct ath_hal * ah,const HAL_CHANNEL_INTERNAL * c)3261b7d5e03cSMatthew Dillon ar9300_get_nf_adjust(struct ath_hal *ah, const HAL_CHANNEL_INTERNAL *c)
3262b7d5e03cSMatthew Dillon {
3263b7d5e03cSMatthew Dillon return 0;
3264b7d5e03cSMatthew Dillon }
3265b7d5e03cSMatthew Dillon
3266b7d5e03cSMatthew Dillon void
ar9300_set_immunity(struct ath_hal * ah,HAL_BOOL enable)3267b7d5e03cSMatthew Dillon ar9300_set_immunity(struct ath_hal *ah, HAL_BOOL enable)
3268b7d5e03cSMatthew Dillon {
3269b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3270b7d5e03cSMatthew Dillon u_int32_t m1_thresh_low = enable ? 127 : ahp->ah_immunity_vals[0],
3271b7d5e03cSMatthew Dillon m2_thresh_low = enable ? 127 : ahp->ah_immunity_vals[1],
3272b7d5e03cSMatthew Dillon m1_thresh = enable ? 127 : ahp->ah_immunity_vals[2],
3273b7d5e03cSMatthew Dillon m2_thresh = enable ? 127 : ahp->ah_immunity_vals[3],
3274b7d5e03cSMatthew Dillon m2_count_thr = enable ? 31 : ahp->ah_immunity_vals[4],
3275b7d5e03cSMatthew Dillon m2_count_thr_low = enable ? 63 : ahp->ah_immunity_vals[5];
3276b7d5e03cSMatthew Dillon
3277b7d5e03cSMatthew Dillon if (ahp->ah_immunity_on == enable) {
3278b7d5e03cSMatthew Dillon return;
3279b7d5e03cSMatthew Dillon }
3280b7d5e03cSMatthew Dillon
3281b7d5e03cSMatthew Dillon ahp->ah_immunity_on = enable;
3282b7d5e03cSMatthew Dillon
3283b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
3284b7d5e03cSMatthew Dillon AR_PHY_SFCORR_LOW_M1_THRESH_LOW, m1_thresh_low);
3285b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
3286b7d5e03cSMatthew Dillon AR_PHY_SFCORR_LOW_M2_THRESH_LOW, m2_thresh_low);
3287b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR,
3288b7d5e03cSMatthew Dillon AR_PHY_SFCORR_M1_THRESH, m1_thresh);
3289b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR,
3290b7d5e03cSMatthew Dillon AR_PHY_SFCORR_M2_THRESH, m2_thresh);
3291b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR,
3292b7d5e03cSMatthew Dillon AR_PHY_SFCORR_M2COUNT_THR, m2_count_thr);
3293b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_LOW,
3294b7d5e03cSMatthew Dillon AR_PHY_SFCORR_LOW_M2COUNT_THR_LOW, m2_count_thr_low);
3295b7d5e03cSMatthew Dillon
3296b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
3297b7d5e03cSMatthew Dillon AR_PHY_SFCORR_EXT_M1_THRESH_LOW, m1_thresh_low);
3298b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
3299b7d5e03cSMatthew Dillon AR_PHY_SFCORR_EXT_M2_THRESH_LOW, m2_thresh_low);
3300b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
3301b7d5e03cSMatthew Dillon AR_PHY_SFCORR_EXT_M1_THRESH, m1_thresh);
3302b7d5e03cSMatthew Dillon OS_REG_RMW_FIELD(ah, AR_PHY_SFCORR_EXT,
3303b7d5e03cSMatthew Dillon AR_PHY_SFCORR_EXT_M2_THRESH, m2_thresh);
3304b7d5e03cSMatthew Dillon
3305b7d5e03cSMatthew Dillon if (!enable) {
3306b7d5e03cSMatthew Dillon OS_REG_SET_BIT(ah, AR_PHY_SFCORR_LOW,
3307b7d5e03cSMatthew Dillon AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
3308b7d5e03cSMatthew Dillon } else {
3309b7d5e03cSMatthew Dillon OS_REG_CLR_BIT(ah, AR_PHY_SFCORR_LOW,
3310b7d5e03cSMatthew Dillon AR_PHY_SFCORR_LOW_USE_SELF_CORR_LOW);
3311b7d5e03cSMatthew Dillon }
3312b7d5e03cSMatthew Dillon }
3313b7d5e03cSMatthew Dillon
3314b7d5e03cSMatthew Dillon /* XXX FreeBSD: I'm not sure how to implement this.. */
3315b7d5e03cSMatthew Dillon #if 0
3316b7d5e03cSMatthew Dillon int
3317b7d5e03cSMatthew Dillon ar9300_get_cal_intervals(struct ath_hal *ah, HAL_CALIBRATION_TIMER **timerp,
3318b7d5e03cSMatthew Dillon HAL_CAL_QUERY query)
3319b7d5e03cSMatthew Dillon {
3320b7d5e03cSMatthew Dillon #define AR9300_IS_CHAIN_RX_IQCAL_INVALID(_ah, _reg) \
3321b7d5e03cSMatthew Dillon ((OS_REG_READ((_ah), _reg) & 0x3fff) == 0)
3322b7d5e03cSMatthew Dillon #define AR9300_IS_RX_IQCAL_DISABLED(_ah) \
3323b7d5e03cSMatthew Dillon (!(OS_REG_READ((_ah), AR_PHY_RX_IQCAL_CORR_B0) & \
3324b7d5e03cSMatthew Dillon AR_PHY_RX_IQCAL_CORR_IQCORR_ENABLE))
3325b7d5e03cSMatthew Dillon /* Avoid comilation warnings. Variables are not used when EMULATION. */
3326b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3327b7d5e03cSMatthew Dillon u_int8_t rxchainmask = ahp->ah_rx_chainmask, i;
3328b7d5e03cSMatthew Dillon int rx_iqcal_invalid = 0, num_chains = 0;
3329b7d5e03cSMatthew Dillon static const u_int32_t offset_array[3] = {
3330b7d5e03cSMatthew Dillon AR_PHY_RX_IQCAL_CORR_B0,
3331b7d5e03cSMatthew Dillon AR_PHY_RX_IQCAL_CORR_B1,
3332b7d5e03cSMatthew Dillon AR_PHY_RX_IQCAL_CORR_B2};
3333b7d5e03cSMatthew Dillon
3334b7d5e03cSMatthew Dillon *timerp = ar9300_cals;
3335b7d5e03cSMatthew Dillon
3336b7d5e03cSMatthew Dillon switch (query) {
3337b7d5e03cSMatthew Dillon case HAL_QUERY_CALS:
3338b7d5e03cSMatthew Dillon return AR9300_NUM_CAL_TYPES;
3339b7d5e03cSMatthew Dillon case HAL_QUERY_RERUN_CALS:
3340b7d5e03cSMatthew Dillon for (i = 0; i < AR9300_MAX_CHAINS; i++) {
3341b7d5e03cSMatthew Dillon if (rxchainmask & (1 << i)) {
3342b7d5e03cSMatthew Dillon num_chains++;
3343b7d5e03cSMatthew Dillon }
3344b7d5e03cSMatthew Dillon }
3345b7d5e03cSMatthew Dillon for (i = 0; i < num_chains; i++) {
3346b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah) || AR_SREV_APHRODITE(ah)) {
3347b7d5e03cSMatthew Dillon HALASSERT(num_chains == 0x1);
3348b7d5e03cSMatthew Dillon }
3349b7d5e03cSMatthew Dillon if (AR9300_IS_CHAIN_RX_IQCAL_INVALID(ah, offset_array[i])) {
3350b7d5e03cSMatthew Dillon rx_iqcal_invalid = 1;
3351b7d5e03cSMatthew Dillon }
3352b7d5e03cSMatthew Dillon }
3353b7d5e03cSMatthew Dillon if (AR9300_IS_RX_IQCAL_DISABLED(ah)) {
3354b7d5e03cSMatthew Dillon rx_iqcal_invalid = 1;
3355b7d5e03cSMatthew Dillon }
3356b7d5e03cSMatthew Dillon
3357b7d5e03cSMatthew Dillon return rx_iqcal_invalid;
3358b7d5e03cSMatthew Dillon default:
3359b7d5e03cSMatthew Dillon HALASSERT(0);
3360b7d5e03cSMatthew Dillon }
3361b7d5e03cSMatthew Dillon return 0;
3362b7d5e03cSMatthew Dillon }
3363b7d5e03cSMatthew Dillon #endif
3364b7d5e03cSMatthew Dillon
3365b7d5e03cSMatthew Dillon #if ATH_TRAFFIC_FAST_RECOVER
3366b7d5e03cSMatthew Dillon #define PLL3 0x16188
3367b7d5e03cSMatthew Dillon #define PLL3_DO_MEAS_MASK 0x40000000
3368b7d5e03cSMatthew Dillon #define PLL4 0x1618c
3369b7d5e03cSMatthew Dillon #define PLL4_MEAS_DONE 0x8
3370b7d5e03cSMatthew Dillon #define SQSUM_DVC_MASK 0x007ffff8
3371b7d5e03cSMatthew Dillon unsigned long
ar9300_get_pll3_sqsum_dvc(struct ath_hal * ah)3372b7d5e03cSMatthew Dillon ar9300_get_pll3_sqsum_dvc(struct ath_hal *ah)
3373b7d5e03cSMatthew Dillon {
3374b7d5e03cSMatthew Dillon if (AR_SREV_HORNET(ah) || AR_SREV_POSEIDON(ah) || AR_SREV_WASP(ah) || AR_SREV_SCORPION(ah)) {
3375b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PLL3, (OS_REG_READ(ah, PLL3) & ~(PLL3_DO_MEAS_MASK)));
3376b7d5e03cSMatthew Dillon OS_DELAY(100);
3377b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, PLL3, (OS_REG_READ(ah, PLL3) | PLL3_DO_MEAS_MASK));
3378b7d5e03cSMatthew Dillon
3379b7d5e03cSMatthew Dillon while ( (OS_REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) {
3380b7d5e03cSMatthew Dillon OS_DELAY(100);
3381b7d5e03cSMatthew Dillon }
3382b7d5e03cSMatthew Dillon
3383b7d5e03cSMatthew Dillon return (( OS_REG_READ(ah, PLL3) & SQSUM_DVC_MASK ) >> 3);
3384b7d5e03cSMatthew Dillon } else {
3385b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_UNMASKABLE,
3386b7d5e03cSMatthew Dillon "%s: unable to get pll3_sqsum_dvc\n",
3387b7d5e03cSMatthew Dillon __func__);
3388b7d5e03cSMatthew Dillon return 0;
3389b7d5e03cSMatthew Dillon }
3390b7d5e03cSMatthew Dillon }
3391b7d5e03cSMatthew Dillon #endif
3392b7d5e03cSMatthew Dillon
3393b7d5e03cSMatthew Dillon
3394b7d5e03cSMatthew Dillon #define RX_GAIN_TABLE_LENGTH 128
3395b7d5e03cSMatthew Dillon // this will be called if rfGainCAP is enabled and rfGainCAP setting is changed,
3396b7d5e03cSMatthew Dillon // or rxGainTable setting is changed
ar9300_rf_gain_cap_apply(struct ath_hal * ah,int is_2GHz)3397b7d5e03cSMatthew Dillon HAL_BOOL ar9300_rf_gain_cap_apply(struct ath_hal *ah, int is_2GHz)
3398b7d5e03cSMatthew Dillon {
3399b7d5e03cSMatthew Dillon int i, done = 0, i_rx_gain = 32;
3400b7d5e03cSMatthew Dillon u_int32_t rf_gain_cap;
3401b7d5e03cSMatthew Dillon u_int32_t rx_gain_value, a_Byte, rx_gain_value_caped;
3402b7d5e03cSMatthew Dillon static u_int32_t rx_gain_table[RX_GAIN_TABLE_LENGTH * 2][2];
3403b7d5e03cSMatthew Dillon ar9300_eeprom_t *eep = &AH9300(ah)->ah_eeprom;
3404b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3405b7d5e03cSMatthew Dillon
3406b7d5e03cSMatthew Dillon if ( !((eep->base_eep_header.misc_configuration & 0x80) >> 7) )
3407b7d5e03cSMatthew Dillon return AH_FALSE;
3408b7d5e03cSMatthew Dillon
3409b7d5e03cSMatthew Dillon if (is_2GHz)
3410b7d5e03cSMatthew Dillon {
3411b7d5e03cSMatthew Dillon rf_gain_cap = (u_int32_t) eep->modal_header_2g.rf_gain_cap;
3412b7d5e03cSMatthew Dillon }
3413b7d5e03cSMatthew Dillon else
3414b7d5e03cSMatthew Dillon {
3415b7d5e03cSMatthew Dillon rf_gain_cap = (u_int32_t) eep->modal_header_5g.rf_gain_cap;
3416b7d5e03cSMatthew Dillon }
3417b7d5e03cSMatthew Dillon
3418b7d5e03cSMatthew Dillon if (rf_gain_cap == 0)
3419b7d5e03cSMatthew Dillon return AH_FALSE;
3420b7d5e03cSMatthew Dillon
3421b7d5e03cSMatthew Dillon for (i = 0; i< RX_GAIN_TABLE_LENGTH * 2; i++)
3422b7d5e03cSMatthew Dillon {
3423b7d5e03cSMatthew Dillon if (AR_SREV_AR9580(ah))
3424b7d5e03cSMatthew Dillon {
3425b7d5e03cSMatthew Dillon // BB_rx_ocgain2
3426b7d5e03cSMatthew Dillon i_rx_gain = 128 + 32;
3427b7d5e03cSMatthew Dillon switch (ar9300_rx_gain_index_get(ah))
3428b7d5e03cSMatthew Dillon {
3429b7d5e03cSMatthew Dillon case 0:
3430b7d5e03cSMatthew Dillon rx_gain_table[i][0] =
3431b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_ar9580_1p0[i][0];
3432b7d5e03cSMatthew Dillon rx_gain_table[i][1] =
3433b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_ar9580_1p0[i][1];
3434b7d5e03cSMatthew Dillon break;
3435b7d5e03cSMatthew Dillon case 1:
3436b7d5e03cSMatthew Dillon rx_gain_table[i][0] =
3437b7d5e03cSMatthew Dillon ar9300_common_wo_xlna_rx_gain_table_ar9580_1p0[i][0];
3438b7d5e03cSMatthew Dillon rx_gain_table[i][1] =
3439b7d5e03cSMatthew Dillon ar9300_common_wo_xlna_rx_gain_table_ar9580_1p0[i][1];
3440b7d5e03cSMatthew Dillon break;
3441b7d5e03cSMatthew Dillon }
3442b7d5e03cSMatthew Dillon }
3443b7d5e03cSMatthew Dillon else if (AR_SREV_OSPREY_22(ah))
3444b7d5e03cSMatthew Dillon {
3445b7d5e03cSMatthew Dillon i_rx_gain = 128 + 32;
3446b7d5e03cSMatthew Dillon switch (ar9300_rx_gain_index_get(ah))
3447b7d5e03cSMatthew Dillon {
3448b7d5e03cSMatthew Dillon case 0:
3449b7d5e03cSMatthew Dillon rx_gain_table[i][0] = ar9300_common_rx_gain_table_osprey_2p2[i][0];
3450b7d5e03cSMatthew Dillon rx_gain_table[i][1] = ar9300_common_rx_gain_table_osprey_2p2[i][1];
3451b7d5e03cSMatthew Dillon break;
3452b7d5e03cSMatthew Dillon case 1:
3453b7d5e03cSMatthew Dillon rx_gain_table[i][0] =
3454b7d5e03cSMatthew Dillon ar9300Common_wo_xlna_rx_gain_table_osprey_2p2[i][0];
3455b7d5e03cSMatthew Dillon rx_gain_table[i][1] =
3456b7d5e03cSMatthew Dillon ar9300Common_wo_xlna_rx_gain_table_osprey_2p2[i][1];
3457b7d5e03cSMatthew Dillon break;
3458b7d5e03cSMatthew Dillon }
3459b7d5e03cSMatthew Dillon }
3460b7d5e03cSMatthew Dillon else
3461b7d5e03cSMatthew Dillon {
3462b7d5e03cSMatthew Dillon return AH_FALSE;
3463b7d5e03cSMatthew Dillon }
3464b7d5e03cSMatthew Dillon }
3465b7d5e03cSMatthew Dillon
3466b7d5e03cSMatthew Dillon while (1)
3467b7d5e03cSMatthew Dillon {
3468b7d5e03cSMatthew Dillon rx_gain_value = rx_gain_table[i_rx_gain][1];
3469b7d5e03cSMatthew Dillon rx_gain_value_caped = rx_gain_value;
3470b7d5e03cSMatthew Dillon a_Byte = rx_gain_value & (0x000000FF);
3471b7d5e03cSMatthew Dillon if (a_Byte>rf_gain_cap)
3472b7d5e03cSMatthew Dillon {
3473b7d5e03cSMatthew Dillon rx_gain_value_caped = (rx_gain_value_caped &
3474b7d5e03cSMatthew Dillon (0xFFFFFF00)) + rf_gain_cap;
3475b7d5e03cSMatthew Dillon }
3476b7d5e03cSMatthew Dillon a_Byte = rx_gain_value & (0x0000FF00);
3477b7d5e03cSMatthew Dillon if ( a_Byte > ( rf_gain_cap << 8 ) )
3478b7d5e03cSMatthew Dillon {
3479b7d5e03cSMatthew Dillon rx_gain_value_caped = (rx_gain_value_caped &
3480b7d5e03cSMatthew Dillon (0xFFFF00FF)) + (rf_gain_cap<<8);
3481b7d5e03cSMatthew Dillon }
3482b7d5e03cSMatthew Dillon a_Byte = rx_gain_value & (0x00FF0000);
3483b7d5e03cSMatthew Dillon if ( a_Byte > ( rf_gain_cap << 16 ) )
3484b7d5e03cSMatthew Dillon {
3485b7d5e03cSMatthew Dillon rx_gain_value_caped = (rx_gain_value_caped &
3486b7d5e03cSMatthew Dillon (0xFF00FFFF)) + (rf_gain_cap<<16);
3487b7d5e03cSMatthew Dillon }
3488b7d5e03cSMatthew Dillon a_Byte = rx_gain_value & (0xFF000000);
3489b7d5e03cSMatthew Dillon if ( a_Byte > ( rf_gain_cap << 24 ) )
3490b7d5e03cSMatthew Dillon {
3491b7d5e03cSMatthew Dillon rx_gain_value_caped = (rx_gain_value_caped &
3492b7d5e03cSMatthew Dillon (0x00FFFFFF)) + (rf_gain_cap<<24);
3493b7d5e03cSMatthew Dillon }
3494b7d5e03cSMatthew Dillon else
3495b7d5e03cSMatthew Dillon {
3496b7d5e03cSMatthew Dillon done = 1;
3497b7d5e03cSMatthew Dillon }
3498b7d5e03cSMatthew Dillon HALDEBUG(ah, HAL_DEBUG_RESET,
3499b7d5e03cSMatthew Dillon "%s: rx_gain_address: %x, rx_gain_value: %x rx_gain_value_caped: %x\n",
3500b7d5e03cSMatthew Dillon __func__, rx_gain_table[i_rx_gain][0], rx_gain_value, rx_gain_value_caped);
3501b7d5e03cSMatthew Dillon if (rx_gain_value_caped != rx_gain_value)
3502b7d5e03cSMatthew Dillon {
3503b7d5e03cSMatthew Dillon rx_gain_table[i_rx_gain][1] = rx_gain_value_caped;
3504b7d5e03cSMatthew Dillon }
3505b7d5e03cSMatthew Dillon if (done == 1)
3506b7d5e03cSMatthew Dillon break;
3507b7d5e03cSMatthew Dillon i_rx_gain ++;
3508b7d5e03cSMatthew Dillon }
3509b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain, rx_gain_table, ARRAY_LENGTH(rx_gain_table), 2);
3510b7d5e03cSMatthew Dillon return AH_TRUE;
3511b7d5e03cSMatthew Dillon }
3512b7d5e03cSMatthew Dillon
3513b7d5e03cSMatthew Dillon
ar9300_rx_gain_table_apply(struct ath_hal * ah)3514b7d5e03cSMatthew Dillon void ar9300_rx_gain_table_apply(struct ath_hal *ah)
3515b7d5e03cSMatthew Dillon {
3516b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3517b7d5e03cSMatthew Dillon //struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
3518b7d5e03cSMatthew Dillon u_int32_t xlan_gpio_cfg;
3519b7d5e03cSMatthew Dillon u_int8_t i;
3520b7d5e03cSMatthew Dillon
3521b7d5e03cSMatthew Dillon if (AR_SREV_OSPREY(ah) || AR_SREV_AR9580(ah))
3522b7d5e03cSMatthew Dillon {
3523b7d5e03cSMatthew Dillon // this will be called if rxGainTable setting is changed
3524b7d5e03cSMatthew Dillon if (ar9300_rf_gain_cap_apply(ah, 1))
3525b7d5e03cSMatthew Dillon return;
3526b7d5e03cSMatthew Dillon }
3527b7d5e03cSMatthew Dillon
3528b7d5e03cSMatthew Dillon switch (ar9300_rx_gain_index_get(ah))
3529b7d5e03cSMatthew Dillon {
3530b7d5e03cSMatthew Dillon case 2:
3531b7d5e03cSMatthew Dillon if (AR_SREV_JUPITER_10(ah)) {
3532b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3533b7d5e03cSMatthew Dillon ar9300_common_mixed_rx_gain_table_jupiter_1p0,
3534b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_mixed_rx_gain_table_jupiter_1p0), 2);
3535b7d5e03cSMatthew Dillon break;
3536b7d5e03cSMatthew Dillon }
3537b7d5e03cSMatthew Dillon else if (AR_SREV_JUPITER_20(ah)) {
3538b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3539b7d5e03cSMatthew Dillon ar9300Common_mixed_rx_gain_table_jupiter_2p0,
3540b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Common_mixed_rx_gain_table_jupiter_2p0), 2);
3541b7d5e03cSMatthew Dillon break;
3542b7d5e03cSMatthew Dillon }
3543b7d5e03cSMatthew Dillon case 0:
3544b7d5e03cSMatthew Dillon default:
3545b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3546b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3547b7d5e03cSMatthew Dillon ar9331_common_rx_gain_hornet1_2,
3548b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_rx_gain_hornet1_2), 2);
3549b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3550b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3551b7d5e03cSMatthew Dillon ar9331_common_rx_gain_hornet1_1,
3552b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_rx_gain_hornet1_1), 2);
3553b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3554b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3555b7d5e03cSMatthew Dillon ar9485_common_wo_xlna_rx_gain_poseidon1_1,
3556b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_common_wo_xlna_rx_gain_poseidon1_1), 2);
3557b7d5e03cSMatthew Dillon /* XXX FreeBSD: this needs to be revisited!! */
3558b7d5e03cSMatthew Dillon xlan_gpio_cfg = ah->ah_config.ath_hal_ext_lna_ctl_gpio;
3559b7d5e03cSMatthew Dillon if (xlan_gpio_cfg) {
3560b7d5e03cSMatthew Dillon for (i = 0; i < 32; i++) {
3561b7d5e03cSMatthew Dillon if (xlan_gpio_cfg & (1 << i)) {
3562b7d5e03cSMatthew Dillon /*
3563b7d5e03cSMatthew Dillon * XXX FreeBSD: definitely make sure this
3564b7d5e03cSMatthew Dillon * results in the correct value being written
3565b7d5e03cSMatthew Dillon * to the hardware, or weird crap is very likely
3566b7d5e03cSMatthew Dillon * to occur!
3567b7d5e03cSMatthew Dillon */
3568b7d5e03cSMatthew Dillon ath_hal_gpioCfgOutput(ah, i,
3569b7d5e03cSMatthew Dillon HAL_GPIO_OUTPUT_MUX_PCIE_ATTENTION_LED);
3570b7d5e03cSMatthew Dillon }
3571b7d5e03cSMatthew Dillon }
3572b7d5e03cSMatthew Dillon }
3573b7d5e03cSMatthew Dillon
3574b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3575b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3576b7d5e03cSMatthew Dillon ar9485Common_wo_xlna_rx_gain_poseidon1_0,
3577b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Common_wo_xlna_rx_gain_poseidon1_0), 2);
3578b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_10(ah)) {
3579b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3580b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_jupiter_1p0,
3581b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_jupiter_1p0), 2);
3582b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_20(ah)) {
3583b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3584b7d5e03cSMatthew Dillon ar9300Common_rx_gain_table_jupiter_2p0,
3585b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Common_rx_gain_table_jupiter_2p0), 2);
3586b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3587b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3588b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_ar9580_1p0,
3589b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_ar9580_1p0), 2);
3590b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3591b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3592b7d5e03cSMatthew Dillon ar9340Common_rx_gain_table_wasp_1p0,
3593b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Common_rx_gain_table_wasp_1p0), 2);
3594b7d5e03cSMatthew Dillon } else if (AR_SREV_SCORPION(ah)) {
3595b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3596b7d5e03cSMatthew Dillon ar955xCommon_rx_gain_table_scorpion_1p0,
3597b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_rx_gain_table_scorpion_1p0), 2);
3598b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
3599b7d5e03cSMatthew Dillon ar955xCommon_rx_gain_bounds_scorpion_1p0,
3600b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_rx_gain_bounds_scorpion_1p0), 5);
3601*a20e5e51SMatthew Dillon } else if (AR_SREV_HONEYBEE(ah)) {
3602*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3603*a20e5e51SMatthew Dillon qca953xCommon_rx_gain_table_honeybee_1p0,
3604*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_rx_gain_table_honeybee_1p0), 2);
3605*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
3606*a20e5e51SMatthew Dillon qca953xCommon_rx_gain_bounds_honeybee_1p0,
3607*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_rx_gain_bounds_honeybee_1p0), 5);
3608b7d5e03cSMatthew Dillon } else {
3609b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3610b7d5e03cSMatthew Dillon ar9300_common_rx_gain_table_osprey_2p2,
3611b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_rx_gain_table_osprey_2p2), 2);
3612b7d5e03cSMatthew Dillon }
3613b7d5e03cSMatthew Dillon break;
3614b7d5e03cSMatthew Dillon case 1:
3615b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3616b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3617b7d5e03cSMatthew Dillon ar9331_common_wo_xlna_rx_gain_hornet1_2,
3618b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_wo_xlna_rx_gain_hornet1_2), 2);
3619b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3620b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3621b7d5e03cSMatthew Dillon ar9331_common_wo_xlna_rx_gain_hornet1_1,
3622b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_common_wo_xlna_rx_gain_hornet1_1), 2);
3623b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3624b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3625b7d5e03cSMatthew Dillon ar9485_common_wo_xlna_rx_gain_poseidon1_1,
3626b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_common_wo_xlna_rx_gain_poseidon1_1), 2);
3627b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3628b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3629b7d5e03cSMatthew Dillon ar9485Common_wo_xlna_rx_gain_poseidon1_0,
3630b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Common_wo_xlna_rx_gain_poseidon1_0), 2);
3631b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_10(ah)) {
3632b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3633b7d5e03cSMatthew Dillon ar9300_common_wo_xlna_rx_gain_table_jupiter_1p0,
3634b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_wo_xlna_rx_gain_table_jupiter_1p0),
3635b7d5e03cSMatthew Dillon 2);
3636b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_20(ah)) {
3637b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3638b7d5e03cSMatthew Dillon ar9300Common_wo_xlna_rx_gain_table_jupiter_2p0,
3639b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Common_wo_xlna_rx_gain_table_jupiter_2p0),
3640b7d5e03cSMatthew Dillon 2);
3641b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
3642b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3643b7d5e03cSMatthew Dillon ar956XCommon_wo_xlna_rx_gain_table_aphrodite_1p0,
3644b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XCommon_wo_xlna_rx_gain_table_aphrodite_1p0),
3645b7d5e03cSMatthew Dillon 2);
3646b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3647b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3648b7d5e03cSMatthew Dillon ar9300_common_wo_xlna_rx_gain_table_ar9580_1p0,
3649b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_common_wo_xlna_rx_gain_table_ar9580_1p0), 2);
3650b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3651b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3652b7d5e03cSMatthew Dillon ar9340Common_wo_xlna_rx_gain_table_wasp_1p0,
3653b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Common_wo_xlna_rx_gain_table_wasp_1p0), 2);
3654b7d5e03cSMatthew Dillon } else if (AR_SREV_SCORPION(ah)) {
3655b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3656b7d5e03cSMatthew Dillon ar955xCommon_wo_xlna_rx_gain_table_scorpion_1p0,
3657b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_wo_xlna_rx_gain_table_scorpion_1p0), 2);
3658b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
3659b7d5e03cSMatthew Dillon ar955xCommon_wo_xlna_rx_gain_bounds_scorpion_1p0,
3660b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xCommon_wo_xlna_rx_gain_bounds_scorpion_1p0), 5);
3661*a20e5e51SMatthew Dillon } else if (AR_SREV_HONEYBEE(ah)) {
3662*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3663*a20e5e51SMatthew Dillon qca953xCommon_wo_xlna_rx_gain_table_honeybee_1p0,
3664*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_wo_xlna_rx_gain_table_honeybee_1p0), 2);
3665*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain_bounds,
3666*a20e5e51SMatthew Dillon qca953xCommon_wo_xlna_rx_gain_bounds_honeybee_1p0,
3667*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xCommon_wo_xlna_rx_gain_bounds_honeybee_1p0), 5);
3668b7d5e03cSMatthew Dillon } else {
3669b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_rxgain,
3670b7d5e03cSMatthew Dillon ar9300Common_wo_xlna_rx_gain_table_osprey_2p2,
3671b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Common_wo_xlna_rx_gain_table_osprey_2p2), 2);
3672b7d5e03cSMatthew Dillon }
3673b7d5e03cSMatthew Dillon break;
3674b7d5e03cSMatthew Dillon }
3675b7d5e03cSMatthew Dillon }
3676b7d5e03cSMatthew Dillon
ar9300_tx_gain_table_apply(struct ath_hal * ah)3677b7d5e03cSMatthew Dillon void ar9300_tx_gain_table_apply(struct ath_hal *ah)
3678b7d5e03cSMatthew Dillon {
3679b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
3680b7d5e03cSMatthew Dillon
3681b7d5e03cSMatthew Dillon switch (ar9300_tx_gain_index_get(ah))
3682b7d5e03cSMatthew Dillon {
3683b7d5e03cSMatthew Dillon case 0:
3684b7d5e03cSMatthew Dillon default:
3685b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3686b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3687b7d5e03cSMatthew Dillon ar9331_modes_lowest_ob_db_tx_gain_hornet1_2,
3688b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_lowest_ob_db_tx_gain_hornet1_2), 5);
3689b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3690b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3691b7d5e03cSMatthew Dillon ar9331_modes_lowest_ob_db_tx_gain_hornet1_1,
3692b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_lowest_ob_db_tx_gain_hornet1_1), 5);
3693b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3694b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3695b7d5e03cSMatthew Dillon ar9485_modes_lowest_ob_db_tx_gain_poseidon1_1,
3696b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_modes_lowest_ob_db_tx_gain_poseidon1_1), 5);
3697b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3698b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3699b7d5e03cSMatthew Dillon ar9485Modes_lowest_ob_db_tx_gain_poseidon1_0,
3700b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Modes_lowest_ob_db_tx_gain_poseidon1_0), 5);
3701b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3702b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3703b7d5e03cSMatthew Dillon ar9300Modes_lowest_ob_db_tx_gain_table_ar9580_1p0,
3704b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_lowest_ob_db_tx_gain_table_ar9580_1p0),
3705b7d5e03cSMatthew Dillon 5);
3706b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3707b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3708b7d5e03cSMatthew Dillon ar9340Modes_lowest_ob_db_tx_gain_table_wasp_1p0,
3709b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_lowest_ob_db_tx_gain_table_wasp_1p0),
3710b7d5e03cSMatthew Dillon 5);
3711b7d5e03cSMatthew Dillon } else if (AR_SREV_SCORPION(ah)) {
3712b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3713b7d5e03cSMatthew Dillon ar955xModes_xpa_tx_gain_table_scorpion_1p0,
3714b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xModes_xpa_tx_gain_table_scorpion_1p0),
3715b7d5e03cSMatthew Dillon 9);
3716b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_10(ah)) {
3717b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3718b7d5e03cSMatthew Dillon ar9300_modes_low_ob_db_tx_gain_table_jupiter_1p0,
3719b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_modes_low_ob_db_tx_gain_table_jupiter_1p0),
3720b7d5e03cSMatthew Dillon 5);
3721b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_20(ah)) {
3722b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3723b7d5e03cSMatthew Dillon ar9300Modes_low_ob_db_tx_gain_table_jupiter_2p0,
3724b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_low_ob_db_tx_gain_table_jupiter_2p0),
3725b7d5e03cSMatthew Dillon 5);
3726*a20e5e51SMatthew Dillon } else if (AR_SREV_HONEYBEE(ah)) {
3727*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3728*a20e5e51SMatthew Dillon qca953xModes_xpa_tx_gain_table_honeybee_1p0,
3729*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xModes_xpa_tx_gain_table_honeybee_1p0),
3730*a20e5e51SMatthew Dillon 2);
3731b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
3732b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3733b7d5e03cSMatthew Dillon ar956XModes_low_ob_db_tx_gain_table_aphrodite_1p0,
3734b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XModes_low_ob_db_tx_gain_table_aphrodite_1p0),
3735b7d5e03cSMatthew Dillon 5);
3736b7d5e03cSMatthew Dillon } else {
3737b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3738b7d5e03cSMatthew Dillon ar9300_modes_lowest_ob_db_tx_gain_table_osprey_2p2,
3739b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_modes_lowest_ob_db_tx_gain_table_osprey_2p2),
3740b7d5e03cSMatthew Dillon 5);
3741b7d5e03cSMatthew Dillon }
3742b7d5e03cSMatthew Dillon break;
3743b7d5e03cSMatthew Dillon case 1:
3744b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3745b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3746b7d5e03cSMatthew Dillon ar9331_modes_high_ob_db_tx_gain_hornet1_2,
3747b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_high_ob_db_tx_gain_hornet1_2), 5);
3748b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3749b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3750b7d5e03cSMatthew Dillon ar9331_modes_high_ob_db_tx_gain_hornet1_1,
3751b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_high_ob_db_tx_gain_hornet1_1), 5);
3752b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3753b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3754b7d5e03cSMatthew Dillon ar9485_modes_high_ob_db_tx_gain_poseidon1_1,
3755b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_modes_high_ob_db_tx_gain_poseidon1_1), 5);
3756b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3757b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3758b7d5e03cSMatthew Dillon ar9485Modes_high_ob_db_tx_gain_poseidon1_0,
3759b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Modes_high_ob_db_tx_gain_poseidon1_0), 5);
3760b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3761b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3762b7d5e03cSMatthew Dillon ar9300Modes_high_ob_db_tx_gain_table_ar9580_1p0,
3763b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_high_ob_db_tx_gain_table_ar9580_1p0),
3764b7d5e03cSMatthew Dillon 5);
3765b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3766b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3767b7d5e03cSMatthew Dillon ar9340Modes_high_ob_db_tx_gain_table_wasp_1p0,
3768b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_high_ob_db_tx_gain_table_wasp_1p0), 5);
3769b7d5e03cSMatthew Dillon } else if (AR_SREV_SCORPION(ah)) {
3770b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3771b7d5e03cSMatthew Dillon ar955xModes_no_xpa_tx_gain_table_scorpion_1p0,
3772b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar955xModes_no_xpa_tx_gain_table_scorpion_1p0), 9);
3773b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_10(ah)) {
3774b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3775b7d5e03cSMatthew Dillon ar9300_modes_high_ob_db_tx_gain_table_jupiter_1p0,
3776b7d5e03cSMatthew Dillon ARRAY_LENGTH(
3777b7d5e03cSMatthew Dillon ar9300_modes_high_ob_db_tx_gain_table_jupiter_1p0), 5);
3778b7d5e03cSMatthew Dillon } else if (AR_SREV_JUPITER_20(ah)) {
3779b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3780b7d5e03cSMatthew Dillon ar9300Modes_high_ob_db_tx_gain_table_jupiter_2p0,
3781b7d5e03cSMatthew Dillon ARRAY_LENGTH(
3782b7d5e03cSMatthew Dillon ar9300Modes_high_ob_db_tx_gain_table_jupiter_2p0), 5);
3783b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
3784b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3785b7d5e03cSMatthew Dillon ar956XModes_high_ob_db_tx_gain_table_aphrodite_1p0,
3786b7d5e03cSMatthew Dillon ARRAY_LENGTH(
3787b7d5e03cSMatthew Dillon ar956XModes_high_ob_db_tx_gain_table_aphrodite_1p0), 5);
3788*a20e5e51SMatthew Dillon } else if (AR_SREV_HONEYBEE(ah)) {
3789*a20e5e51SMatthew Dillon if (AR_SREV_HONEYBEE_11(ah)) {
3790*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3791*a20e5e51SMatthew Dillon qca953xModes_no_xpa_tx_gain_table_honeybee_1p1,
3792*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xModes_no_xpa_tx_gain_table_honeybee_1p1), 2);
3793*a20e5e51SMatthew Dillon } else {
3794*a20e5e51SMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3795*a20e5e51SMatthew Dillon qca953xModes_no_xpa_tx_gain_table_honeybee_1p0,
3796*a20e5e51SMatthew Dillon ARRAY_LENGTH(qca953xModes_no_xpa_tx_gain_table_honeybee_1p0), 2);
3797*a20e5e51SMatthew Dillon }
3798b7d5e03cSMatthew Dillon } else {
3799b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3800b7d5e03cSMatthew Dillon ar9300Modes_high_ob_db_tx_gain_table_osprey_2p2,
3801b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_high_ob_db_tx_gain_table_osprey_2p2),
3802b7d5e03cSMatthew Dillon 5);
3803b7d5e03cSMatthew Dillon }
3804b7d5e03cSMatthew Dillon break;
3805b7d5e03cSMatthew Dillon case 2:
3806b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3807b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3808b7d5e03cSMatthew Dillon ar9331_modes_low_ob_db_tx_gain_hornet1_2,
3809b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_low_ob_db_tx_gain_hornet1_2), 5);
3810b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3811b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3812b7d5e03cSMatthew Dillon ar9331_modes_low_ob_db_tx_gain_hornet1_1,
3813b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_low_ob_db_tx_gain_hornet1_1), 5);
3814b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3815b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3816b7d5e03cSMatthew Dillon ar9485_modes_low_ob_db_tx_gain_poseidon1_1,
3817b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_modes_low_ob_db_tx_gain_poseidon1_1), 5);
3818b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3819b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3820b7d5e03cSMatthew Dillon ar9485Modes_low_ob_db_tx_gain_poseidon1_0,
3821b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Modes_low_ob_db_tx_gain_poseidon1_0), 5);
3822b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3823b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3824b7d5e03cSMatthew Dillon ar9300Modes_low_ob_db_tx_gain_table_ar9580_1p0,
3825b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_low_ob_db_tx_gain_table_ar9580_1p0),
3826b7d5e03cSMatthew Dillon 5);
3827b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3828b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3829b7d5e03cSMatthew Dillon ar9340Modes_low_ob_db_tx_gain_table_wasp_1p0,
3830b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_low_ob_db_tx_gain_table_wasp_1p0), 5);
3831b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
3832b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3833b7d5e03cSMatthew Dillon ar956XModes_low_ob_db_tx_gain_table_aphrodite_1p0,
3834b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XModes_low_ob_db_tx_gain_table_aphrodite_1p0), 5);
3835b7d5e03cSMatthew Dillon } else {
3836b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3837b7d5e03cSMatthew Dillon ar9300Modes_low_ob_db_tx_gain_table_osprey_2p2,
3838b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_low_ob_db_tx_gain_table_osprey_2p2),
3839b7d5e03cSMatthew Dillon 5);
3840b7d5e03cSMatthew Dillon }
3841b7d5e03cSMatthew Dillon break;
3842b7d5e03cSMatthew Dillon case 3:
3843b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_12(ah)) {
3844b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3845b7d5e03cSMatthew Dillon ar9331_modes_high_power_tx_gain_hornet1_2,
3846b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_high_power_tx_gain_hornet1_2), 5);
3847b7d5e03cSMatthew Dillon } else if (AR_SREV_HORNET_11(ah)) {
3848b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3849b7d5e03cSMatthew Dillon ar9331_modes_high_power_tx_gain_hornet1_1,
3850b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9331_modes_high_power_tx_gain_hornet1_1), 5);
3851b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3852b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3853b7d5e03cSMatthew Dillon ar9485_modes_high_power_tx_gain_poseidon1_1,
3854b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485_modes_high_power_tx_gain_poseidon1_1), 5);
3855b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON(ah)) {
3856b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3857b7d5e03cSMatthew Dillon ar9485Modes_high_power_tx_gain_poseidon1_0,
3858b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9485Modes_high_power_tx_gain_poseidon1_0), 5);
3859b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3860b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3861b7d5e03cSMatthew Dillon ar9300Modes_high_power_tx_gain_table_ar9580_1p0,
3862b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_high_power_tx_gain_table_ar9580_1p0),
3863b7d5e03cSMatthew Dillon 5);
3864b7d5e03cSMatthew Dillon } else if (AR_SREV_WASP(ah)) {
3865b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3866b7d5e03cSMatthew Dillon ar9340Modes_high_power_tx_gain_table_wasp_1p0,
3867b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_high_power_tx_gain_table_wasp_1p0),
3868b7d5e03cSMatthew Dillon 5);
3869b7d5e03cSMatthew Dillon } else if (AR_SREV_APHRODITE(ah)) {
3870b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3871b7d5e03cSMatthew Dillon ar956XModes_high_power_tx_gain_table_aphrodite_1p0,
3872b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar956XModes_high_power_tx_gain_table_aphrodite_1p0), 5);
3873b7d5e03cSMatthew Dillon } else {
3874b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3875b7d5e03cSMatthew Dillon ar9300Modes_high_power_tx_gain_table_osprey_2p2,
3876b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_high_power_tx_gain_table_osprey_2p2),
3877b7d5e03cSMatthew Dillon 5);
3878b7d5e03cSMatthew Dillon }
3879b7d5e03cSMatthew Dillon break;
3880b7d5e03cSMatthew Dillon case 4:
3881b7d5e03cSMatthew Dillon if (AR_SREV_WASP(ah)) {
3882b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3883b7d5e03cSMatthew Dillon ar9340Modes_mixed_ob_db_tx_gain_table_wasp_1p0,
3884b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9340Modes_mixed_ob_db_tx_gain_table_wasp_1p0),
3885b7d5e03cSMatthew Dillon 5);
3886b7d5e03cSMatthew Dillon } else if (AR_SREV_AR9580(ah)) {
3887b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3888b7d5e03cSMatthew Dillon ar9300_modes_mixed_ob_db_tx_gain_table_ar9580_1p0,
3889b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300_modes_mixed_ob_db_tx_gain_table_ar9580_1p0),
3890b7d5e03cSMatthew Dillon 5);
3891b7d5e03cSMatthew Dillon } else {
3892b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3893b7d5e03cSMatthew Dillon ar9300Modes_mixed_ob_db_tx_gain_table_osprey_2p2,
3894b7d5e03cSMatthew Dillon ARRAY_LENGTH(ar9300Modes_mixed_ob_db_tx_gain_table_osprey_2p2),
3895b7d5e03cSMatthew Dillon 5);
3896b7d5e03cSMatthew Dillon }
3897b7d5e03cSMatthew Dillon break;
3898b7d5e03cSMatthew Dillon case 5:
3899b7d5e03cSMatthew Dillon /* HW Green TX */
3900b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah)) {
3901b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3902b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3903b7d5e03cSMatthew Dillon ar9485_modes_green_ob_db_tx_gain_poseidon1_1,
3904b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_ob_db_tx_gain_poseidon1_1) /
3905b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_ob_db_tx_gain_poseidon1_1[0]), 5);
3906b7d5e03cSMatthew Dillon } else {
3907b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3908b7d5e03cSMatthew Dillon ar9485_modes_green_ob_db_tx_gain_poseidon1_0,
3909b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_ob_db_tx_gain_poseidon1_0) /
3910b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_ob_db_tx_gain_poseidon1_0[0]), 5);
3911b7d5e03cSMatthew Dillon }
3912b7d5e03cSMatthew Dillon ahp->ah_hw_green_tx_enable = 1;
3913b7d5e03cSMatthew Dillon }
3914b7d5e03cSMatthew Dillon else if (AR_SREV_WASP(ah)) {
3915b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3916b7d5e03cSMatthew Dillon ar9340_modes_ub124_tx_gain_table_wasp_1p0,
3917b7d5e03cSMatthew Dillon sizeof(ar9340_modes_ub124_tx_gain_table_wasp_1p0) /
3918b7d5e03cSMatthew Dillon sizeof(ar9340_modes_ub124_tx_gain_table_wasp_1p0[0]), 5);
3919b7d5e03cSMatthew Dillon }
3920b7d5e03cSMatthew Dillon else if (AR_SREV_AR9580(ah)) {
3921b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3922b7d5e03cSMatthew Dillon ar9300_modes_type5_tx_gain_table_ar9580_1p0,
3923b7d5e03cSMatthew Dillon ARRAY_LENGTH( ar9300_modes_type5_tx_gain_table_ar9580_1p0),
3924b7d5e03cSMatthew Dillon 5);
3925b7d5e03cSMatthew Dillon }
3926b7d5e03cSMatthew Dillon else if (AR_SREV_OSPREY_22(ah)) {
3927b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3928b7d5e03cSMatthew Dillon ar9300_modes_number_5_tx_gain_table_osprey_2p2,
3929b7d5e03cSMatthew Dillon ARRAY_LENGTH( ar9300_modes_number_5_tx_gain_table_osprey_2p2),
3930b7d5e03cSMatthew Dillon 5);
3931b7d5e03cSMatthew Dillon }
3932b7d5e03cSMatthew Dillon break;
3933b7d5e03cSMatthew Dillon case 6:
3934b7d5e03cSMatthew Dillon if (AR_SREV_WASP(ah)) {
3935b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3936b7d5e03cSMatthew Dillon ar9340_modes_low_ob_db_and_spur_tx_gain_table_wasp_1p0,
3937b7d5e03cSMatthew Dillon sizeof(ar9340_modes_low_ob_db_and_spur_tx_gain_table_wasp_1p0) /
3938b7d5e03cSMatthew Dillon sizeof(ar9340_modes_low_ob_db_and_spur_tx_gain_table_wasp_1p0[0]), 5);
3939b7d5e03cSMatthew Dillon }
3940b7d5e03cSMatthew Dillon /* HW Green TX */
3941b7d5e03cSMatthew Dillon else if (AR_SREV_POSEIDON(ah)) {
3942b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3943b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3944b7d5e03cSMatthew Dillon ar9485_modes_green_spur_ob_db_tx_gain_poseidon1_1,
3945b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_spur_ob_db_tx_gain_poseidon1_1) /
3946b7d5e03cSMatthew Dillon sizeof(ar9485_modes_green_spur_ob_db_tx_gain_poseidon1_1[0]),
3947b7d5e03cSMatthew Dillon 5);
3948b7d5e03cSMatthew Dillon }
3949b7d5e03cSMatthew Dillon ahp->ah_hw_green_tx_enable = 1;
3950b7d5e03cSMatthew Dillon }
3951b7d5e03cSMatthew Dillon else if (AR_SREV_AR9580(ah)) {
3952b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3953b7d5e03cSMatthew Dillon ar9300_modes_type6_tx_gain_table_ar9580_1p0,
3954b7d5e03cSMatthew Dillon ARRAY_LENGTH( ar9300_modes_type6_tx_gain_table_ar9580_1p0),
3955b7d5e03cSMatthew Dillon 5);
3956b7d5e03cSMatthew Dillon }
3957b7d5e03cSMatthew Dillon break;
3958b7d5e03cSMatthew Dillon case 7:
3959b7d5e03cSMatthew Dillon if (AR_SREV_WASP(ah)) {
3960b7d5e03cSMatthew Dillon INIT_INI_ARRAY(&ahp->ah_ini_modes_txgain,
3961b7d5e03cSMatthew Dillon ar9340Modes_cus227_tx_gain_table_wasp_1p0,
3962b7d5e03cSMatthew Dillon sizeof(ar9340Modes_cus227_tx_gain_table_wasp_1p0) /
3963b7d5e03cSMatthew Dillon sizeof(ar9340Modes_cus227_tx_gain_table_wasp_1p0[0]), 5);
3964b7d5e03cSMatthew Dillon }
3965b7d5e03cSMatthew Dillon break;
3966b7d5e03cSMatthew Dillon }
3967b7d5e03cSMatthew Dillon }
3968b7d5e03cSMatthew Dillon
3969b7d5e03cSMatthew Dillon #if ATH_ANT_DIV_COMB
3970b7d5e03cSMatthew Dillon void
ar9300_ant_div_comb_get_config(struct ath_hal * ah,HAL_ANT_COMB_CONFIG * div_comb_conf)3971b7d5e03cSMatthew Dillon ar9300_ant_div_comb_get_config(struct ath_hal *ah,
3972b7d5e03cSMatthew Dillon HAL_ANT_COMB_CONFIG *div_comb_conf)
3973b7d5e03cSMatthew Dillon {
3974b7d5e03cSMatthew Dillon u_int32_t reg_val = OS_REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
3975b7d5e03cSMatthew Dillon div_comb_conf->main_lna_conf =
3976b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_MAIN_LNACONF__READ(reg_val);
3977b7d5e03cSMatthew Dillon div_comb_conf->alt_lna_conf =
3978b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_ALT_LNACONF__READ(reg_val);
3979b7d5e03cSMatthew Dillon div_comb_conf->fast_div_bias =
3980b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_FAST_DIV_BIAS__READ(reg_val);
3981b7d5e03cSMatthew Dillon if (AR_SREV_HORNET_11(ah)) {
3982b7d5e03cSMatthew Dillon div_comb_conf->antdiv_configgroup = HAL_ANTDIV_CONFIG_GROUP_1;
3983b7d5e03cSMatthew Dillon } else if (AR_SREV_POSEIDON_11_OR_LATER(ah)) {
3984b7d5e03cSMatthew Dillon div_comb_conf->antdiv_configgroup = HAL_ANTDIV_CONFIG_GROUP_2;
3985b7d5e03cSMatthew Dillon } else {
3986b7d5e03cSMatthew Dillon div_comb_conf->antdiv_configgroup = DEFAULT_ANTDIV_CONFIG_GROUP;
3987b7d5e03cSMatthew Dillon }
3988848b370cSMatthew Dillon
3989848b370cSMatthew Dillon /*
3990848b370cSMatthew Dillon * XXX TODO: allow the HAL to override the rssithres and fast_div_bias
3991848b370cSMatthew Dillon * values (eg CUS198.)
3992848b370cSMatthew Dillon */
3993b7d5e03cSMatthew Dillon }
3994b7d5e03cSMatthew Dillon
3995b7d5e03cSMatthew Dillon void
ar9300_ant_div_comb_set_config(struct ath_hal * ah,HAL_ANT_COMB_CONFIG * div_comb_conf)3996b7d5e03cSMatthew Dillon ar9300_ant_div_comb_set_config(struct ath_hal *ah,
3997b7d5e03cSMatthew Dillon HAL_ANT_COMB_CONFIG *div_comb_conf)
3998b7d5e03cSMatthew Dillon {
3999b7d5e03cSMatthew Dillon u_int32_t reg_val;
4000b7d5e03cSMatthew Dillon struct ath_hal_9300 *ahp = AH9300(ah);
4001b7d5e03cSMatthew Dillon
4002b7d5e03cSMatthew Dillon /* DO NOTHING when set to fixed antenna for manufacturing purpose */
4003b7d5e03cSMatthew Dillon if (AR_SREV_POSEIDON(ah) && ( ahp->ah_diversity_control == HAL_ANT_FIXED_A
4004b7d5e03cSMatthew Dillon || ahp->ah_diversity_control == HAL_ANT_FIXED_B)) {
4005b7d5e03cSMatthew Dillon return;
4006b7d5e03cSMatthew Dillon }
4007b7d5e03cSMatthew Dillon reg_val = OS_REG_READ(ah, AR_PHY_MC_GAIN_CTRL);
4008b7d5e03cSMatthew Dillon reg_val &= ~(MULTICHAIN_GAIN_CTRL__ANT_DIV_MAIN_LNACONF__MASK |
4009b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_ALT_LNACONF__MASK |
4010b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_FAST_DIV_BIAS__MASK |
4011b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_MAIN_GAINTB__MASK |
4012b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_ALT_GAINTB__MASK );
4013b7d5e03cSMatthew Dillon reg_val |=
4014b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_MAIN_GAINTB__WRITE(
4015b7d5e03cSMatthew Dillon div_comb_conf->main_gaintb);
4016b7d5e03cSMatthew Dillon reg_val |=
4017b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_ALT_GAINTB__WRITE(
4018b7d5e03cSMatthew Dillon div_comb_conf->alt_gaintb);
4019b7d5e03cSMatthew Dillon reg_val |=
4020b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_MAIN_LNACONF__WRITE(
4021b7d5e03cSMatthew Dillon div_comb_conf->main_lna_conf);
4022b7d5e03cSMatthew Dillon reg_val |=
4023b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_DIV_ALT_LNACONF__WRITE(
4024b7d5e03cSMatthew Dillon div_comb_conf->alt_lna_conf);
4025b7d5e03cSMatthew Dillon reg_val |=
4026b7d5e03cSMatthew Dillon MULTICHAIN_GAIN_CTRL__ANT_FAST_DIV_BIAS__WRITE(
4027b7d5e03cSMatthew Dillon div_comb_conf->fast_div_bias);
4028b7d5e03cSMatthew Dillon OS_REG_WRITE(ah, AR_PHY_MC_GAIN_CTRL, reg_val);
4029b7d5e03cSMatthew Dillon
4030b7d5e03cSMatthew Dillon }
4031b7d5e03cSMatthew Dillon #endif /* ATH_ANT_DIV_COMB */
4032b7d5e03cSMatthew Dillon
4033b7d5e03cSMatthew Dillon static void
ar9300_init_hostif_offsets(struct ath_hal * ah)4034b7d5e03cSMatthew Dillon ar9300_init_hostif_offsets(struct ath_hal *ah)
4035b7d5e03cSMatthew Dillon {
4036b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_RC) =
4037b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_RESET_CONTROL);
4038b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_WA) =
4039b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_WORK_AROUND);
4040b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PM_STATE) =
4041b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PM_STATE);
4042b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_H_INFOL) =
4043b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_CXPL_DEBUG_INFOL);
4044b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_H_INFOH) =
4045b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_CXPL_DEBUG_INFOH);
4046b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_PM_CTRL) =
4047b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PM_CTRL);
4048b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_HOST_TIMEOUT) =
4049b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_TIMEOUT);
4050b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_EEPROM) =
4051b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_EEPROM_CTRL);
4052b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_SREV) =
4053b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_SREV);
4054b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_CAUSE) =
4055b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_CAUSE);
4056b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_CAUSE_CLR) =
4057b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_CAUSE);
4058b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_ENABLE) =
4059b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_ENABLE);
4060b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_MASK) =
4061b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_MASK);
4062b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_MASK) =
4063b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_MASK);
4064b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_CAUSE_CLR) =
4065b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_CAUSE);
4066b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_CAUSE) =
4067b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_CAUSE);
4068b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_ENABLE) =
4069b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_ENABLE);
4070b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_SERDES) =
4071b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PCIE_PHY_RW);
4072b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_SERDES2) =
4073b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PCIE_PHY_LOAD);
4074b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUT) =
4075b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OUT);
4076b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_IN) =
4077b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_IN);
4078b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OE_OUT) =
4079b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OE);
4080b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OE1_OUT) =
4081b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OE1);
4082b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INTR_POL) =
4083b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_INTR_POLAR);
4084b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_EN_VAL) =
4085b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_VALUE);
4086b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_MUX1) =
4087b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_MUX1);
4088b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_MUX2) =
4089b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_MUX2);
4090b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX1) =
4091b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX1);
4092b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX2) =
4093b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX2);
4094b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX3) =
4095b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX3);
4096b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INPUT_STATE) =
4097b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_STATE);
4098b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_SPARE) =
4099b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_SPARE);
4100b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_CORE_RESET_EN) =
4101b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PCIE_CORE_RST_EN);
4102b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_CLKRUN) =
4103b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_CLKRUN);
4104b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_EEPROM_STATUS_DATA) =
4105b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_EEPROM_STS);
4106b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_OBS) =
4107b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_OBS_CTRL);
4108b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_RFSILENT) =
4109b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_RFSILENT);
4110b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_PDPU) =
4111b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_PDPU);
4112b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_DS) =
4113b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_GPIO_DS);
4114b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_MISC) =
4115b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_MISC);
4116b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_MSI) =
4117b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PCIE_MSI);
4118b7d5e03cSMatthew Dillon #if 0 /* Offsets are not defined in reg_map structure */
4119b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TSF_SNAPSHOT_BT_ACTIVE) =
4120b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_TSF_SNAPSHOT_BT_ACTIVE);
4121b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TSF_SNAPSHOT_BT_PRIORITY) =
4122b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_TSF_SNAPSHOT_BT_PRIORITY);
4123b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TSF_SNAPSHOT_BT_CNTL) =
4124b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_MAC_TSF_SNAPSHOT_BT_CNTL);
4125b7d5e03cSMatthew Dillon #endif
4126b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_PHY_LATENCY_NFTS_ADJ) =
4127b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_PCIE_PHY_LATENCY_NFTS_ADJ);
4128b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TDMA_CCA_CNTL) =
4129b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_MAC_TDMA_CCA_CNTL);
4130b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TXAPSYNC) =
4131b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_MAC_TXAPSYNC);
4132b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TXSYNC_INIT_SYNC_TMR) =
4133b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_MAC_TXSYNC_INITIAL_SYNC_TMR);
4134b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_CAUSE) =
4135b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_CAUSE);
4136b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_ENABLE) =
4137b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_ENABLE);
4138b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_MASK) =
4139b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_MASK);
4140b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_MASK) =
4141b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_MASK);
4142b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_CAUSE) =
4143b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_CAUSE);
4144b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_ENABLE) =
4145b7d5e03cSMatthew Dillon AR9300_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_ENABLE);
4146b7d5e03cSMatthew Dillon }
4147b7d5e03cSMatthew Dillon
4148b7d5e03cSMatthew Dillon static void
ar9340_init_hostif_offsets(struct ath_hal * ah)4149b7d5e03cSMatthew Dillon ar9340_init_hostif_offsets(struct ath_hal *ah)
4150b7d5e03cSMatthew Dillon {
4151b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_RC) =
4152b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_RESET_CONTROL);
4153b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_WA) =
4154b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_WORK_AROUND);
4155b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_PM_CTRL) =
4156b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_PM_CTRL);
4157b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_HOST_TIMEOUT) =
4158b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_TIMEOUT);
4159b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_SREV) =
4160b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_SREV);
4161b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_CAUSE) =
4162b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_CAUSE);
4163b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_CAUSE_CLR) =
4164b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_CAUSE);
4165b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_ENABLE) =
4166b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_ENABLE);
4167b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_MASK) =
4168b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_MASK);
4169b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_SYNC_MASK) =
4170b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_SYNC_MASK);
4171b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_CAUSE_CLR) =
4172b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_CAUSE);
4173b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_CAUSE) =
4174b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_CAUSE);
4175b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_ASYNC_ENABLE) =
4176b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_ASYNC_ENABLE);
4177b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUT) =
4178b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OUT);
4179b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_IN) =
4180b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_IN);
4181b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OE_OUT) =
4182b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OE);
4183b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OE1_OUT) =
4184b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OE1);
4185b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INTR_POL) =
4186b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_INTR_POLAR);
4187b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_EN_VAL) =
4188b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_VALUE);
4189b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_MUX1) =
4190b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_MUX1);
4191b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_INPUT_MUX2) =
4192b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_MUX2);
4193b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX1) =
4194b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX1);
4195b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX2) =
4196b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX2);
4197b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_GPIO_OUTPUT_MUX3) =
4198b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_OUTPUT_MUX3);
4199b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INPUT_STATE) =
4200b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_GPIO_INPUT_STATE);
4201b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_CLKRUN) =
4202b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_CLKRUN);
4203b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_EEPROM_STATUS_DATA) =
4204b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_EEPROM_STS);
4205b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_OBS) =
4206b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_OBS_CTRL);
4207b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_RFSILENT) =
4208b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_RFSILENT);
4209b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_MISC) =
4210b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_MISC);
4211b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_PCIE_MSI) =
4212b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_PCIE_MSI);
4213b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TDMA_CCA_CNTL) =
4214b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_MAC_TDMA_CCA_CNTL);
4215b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TXAPSYNC) =
4216b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_MAC_TXAPSYNC);
4217b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_TXSYNC_INIT_SYNC_TMR) =
4218b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_MAC_TXSYNC_INITIAL_SYNC_TMR);
4219b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_CAUSE) =
4220b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_CAUSE);
4221b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_ENABLE) =
4222b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_ENABLE);
4223b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_MASK) =
4224b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_MASK);
4225b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_SYNC_MASK) =
4226b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_SYNC_MASK);
4227b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_CAUSE) =
4228b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_CAUSE);
4229b7d5e03cSMatthew Dillon AR_HOSTIF_REG(ah, AR_INTR_PRIO_ASYNC_ENABLE) =
4230b7d5e03cSMatthew Dillon AR9340_HOSTIF_OFFSET(HOST_INTF_INTR_PRIORITY_ASYNC_ENABLE);
4231b7d5e03cSMatthew Dillon }
4232b7d5e03cSMatthew Dillon
4233b7d5e03cSMatthew Dillon /*
4234b7d5e03cSMatthew Dillon * Host interface register offsets are different for Osprey and Wasp
4235b7d5e03cSMatthew Dillon * and hence store the offsets in hal structure
4236b7d5e03cSMatthew Dillon */
ar9300_init_offsets(struct ath_hal * ah,u_int16_t devid)4237b7d5e03cSMatthew Dillon static int ar9300_init_offsets(struct ath_hal *ah, u_int16_t devid)
4238b7d5e03cSMatthew Dillon {
4239b7d5e03cSMatthew Dillon if (devid == AR9300_DEVID_AR9340) {
4240b7d5e03cSMatthew Dillon ar9340_init_hostif_offsets(ah);
4241b7d5e03cSMatthew Dillon } else {
4242b7d5e03cSMatthew Dillon ar9300_init_hostif_offsets(ah);
4243b7d5e03cSMatthew Dillon }
4244b7d5e03cSMatthew Dillon return 0;
4245b7d5e03cSMatthew Dillon }
4246b7d5e03cSMatthew Dillon
4247b7d5e03cSMatthew Dillon
4248b7d5e03cSMatthew Dillon static const char*
ar9300_probe(uint16_t vendorid,uint16_t devid)4249b7d5e03cSMatthew Dillon ar9300_probe(uint16_t vendorid, uint16_t devid)
4250b7d5e03cSMatthew Dillon {
4251b7d5e03cSMatthew Dillon if (vendorid != ATHEROS_VENDOR_ID)
4252b7d5e03cSMatthew Dillon return AH_NULL;
4253b7d5e03cSMatthew Dillon
4254b7d5e03cSMatthew Dillon switch (devid) {
4255b7d5e03cSMatthew Dillon case AR9300_DEVID_AR9380_PCIE: /* PCIE (Osprey) */
4256b7d5e03cSMatthew Dillon return "Atheros AR938x";
4257b7d5e03cSMatthew Dillon case AR9300_DEVID_AR9340: /* Wasp */
4258b7d5e03cSMatthew Dillon return "Atheros AR934x";
4259b7d5e03cSMatthew Dillon case AR9300_DEVID_AR9485_PCIE: /* Poseidon */
4260b7d5e03cSMatthew Dillon return "Atheros AR9485";
4261b7d5e03cSMatthew Dillon case AR9300_DEVID_AR9580_PCIE: /* Peacock */
4262b7d5e03cSMatthew Dillon return "Atheros AR9580";
4263b7d5e03cSMatthew Dillon case AR9300_DEVID_AR946X_PCIE: /* AR9462, AR9463, AR9482 */
4264b7d5e03cSMatthew Dillon return "Atheros AR946x/AR948x";
4265b7d5e03cSMatthew Dillon case AR9300_DEVID_AR9330: /* Hornet */
4266b7d5e03cSMatthew Dillon return "Atheros AR933x";
4267b7d5e03cSMatthew Dillon case AR9300_DEVID_QCA955X: /* Scorpion */
4268b7d5e03cSMatthew Dillon return "Qualcomm Atheros QCA955x";
4269b7d5e03cSMatthew Dillon case AR9300_DEVID_QCA9565: /* Aphrodite */
4270b7d5e03cSMatthew Dillon return "Qualcomm Atheros AR9565";
4271*a20e5e51SMatthew Dillon case AR9300_DEVID_QCA953X: /* Honeybee */
4272*a20e5e51SMatthew Dillon return "Qualcomm Atheros QCA953x";
42734b8649cbSMatthew Dillon case AR9300_DEVID_AR1111_PCIE:
42744b8649cbSMatthew Dillon return "Atheros AR1111";
4275b7d5e03cSMatthew Dillon default:
4276b7d5e03cSMatthew Dillon return AH_NULL;
4277b7d5e03cSMatthew Dillon }
4278b7d5e03cSMatthew Dillon
4279b7d5e03cSMatthew Dillon return AH_NULL;
4280b7d5e03cSMatthew Dillon }
4281b7d5e03cSMatthew Dillon
4282b7d5e03cSMatthew Dillon AH_CHIP(AR9300, ar9300_probe, ar9300_attach);
4283b7d5e03cSMatthew Dillon
4284