Lines Matching refs:ah
24 static void ar9003_mci_reset_req_wakeup(struct ath_hw *ah) in ar9003_mci_reset_req_wakeup() argument
26 REG_RMW_FIELD(ah, AR_MCI_COMMAND2, in ar9003_mci_reset_req_wakeup()
29 REG_RMW_FIELD(ah, AR_MCI_COMMAND2, in ar9003_mci_reset_req_wakeup()
33 static int ar9003_mci_wait_for_interrupt(struct ath_hw *ah, u32 address, in ar9003_mci_wait_for_interrupt() argument
36 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_wait_for_interrupt()
39 if (!(REG_READ(ah, address) & bit_position)) { in ar9003_mci_wait_for_interrupt()
48 REG_WRITE(ah, address, bit_position); in ar9003_mci_wait_for_interrupt()
54 ar9003_mci_reset_req_wakeup(ah); in ar9003_mci_wait_for_interrupt()
58 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, in ar9003_mci_wait_for_interrupt()
61 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_RX_MSG); in ar9003_mci_wait_for_interrupt()
71 REG_READ(ah, AR_MCI_INTERRUPT_RAW), in ar9003_mci_wait_for_interrupt()
72 REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW)); in ar9003_mci_wait_for_interrupt()
79 static void ar9003_mci_remote_reset(struct ath_hw *ah, bool wait_done) in ar9003_mci_remote_reset() argument
83 ar9003_mci_send_message(ah, MCI_REMOTE_RESET, 0, payload, 16, in ar9003_mci_remote_reset()
88 static void ar9003_mci_send_lna_transfer(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_lna_transfer() argument
92 ar9003_mci_send_message(ah, MCI_LNA_TRANS, 0, &payload, 1, in ar9003_mci_send_lna_transfer()
96 static void ar9003_mci_send_req_wake(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_req_wake() argument
98 ar9003_mci_send_message(ah, MCI_REQ_WAKE, MCI_FLAG_DISABLE_TIMESTAMP, in ar9003_mci_send_req_wake()
103 static void ar9003_mci_send_sys_waking(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_sys_waking() argument
105 ar9003_mci_send_message(ah, MCI_SYS_WAKING, MCI_FLAG_DISABLE_TIMESTAMP, in ar9003_mci_send_sys_waking()
109 static void ar9003_mci_send_lna_take(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_lna_take() argument
113 ar9003_mci_send_message(ah, MCI_LNA_TAKE, 0, &payload, 1, in ar9003_mci_send_lna_take()
117 static void ar9003_mci_send_sys_sleeping(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_sys_sleeping() argument
119 ar9003_mci_send_message(ah, MCI_SYS_SLEEPING, in ar9003_mci_send_sys_sleeping()
124 static void ar9003_mci_send_coex_version_query(struct ath_hw *ah, in ar9003_mci_send_coex_version_query() argument
127 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_coex_version_query()
136 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); in ar9003_mci_send_coex_version_query()
139 static void ar9003_mci_send_coex_version_response(struct ath_hw *ah, in ar9003_mci_send_coex_version_response() argument
142 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_coex_version_response()
151 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); in ar9003_mci_send_coex_version_response()
154 static void ar9003_mci_send_coex_wlan_channels(struct ath_hw *ah, in ar9003_mci_send_coex_wlan_channels() argument
157 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_coex_wlan_channels()
166 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); in ar9003_mci_send_coex_wlan_channels()
170 static void ar9003_mci_send_coex_bt_status_query(struct ath_hw *ah, in ar9003_mci_send_coex_bt_status_query() argument
173 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_coex_bt_status_query()
191 if (!ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, in ar9003_mci_send_coex_bt_status_query()
201 static void ar9003_mci_send_coex_halt_bt_gpm(struct ath_hw *ah, bool halt, in ar9003_mci_send_coex_halt_bt_gpm() argument
204 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_coex_halt_bt_gpm()
221 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, wait_done, true); in ar9003_mci_send_coex_halt_bt_gpm()
224 static void ar9003_mci_prep_interface(struct ath_hw *ah) in ar9003_mci_prep_interface() argument
226 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_prep_interface()
227 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_prep_interface()
232 saved_mci_int_en = REG_READ(ah, AR_MCI_INTERRUPT_EN); in ar9003_mci_prep_interface()
234 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); in ar9003_mci_prep_interface()
235 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
236 REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW)); in ar9003_mci_prep_interface()
237 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, in ar9003_mci_prep_interface()
238 REG_READ(ah, AR_MCI_INTERRUPT_RAW)); in ar9003_mci_prep_interface()
240 ar9003_mci_remote_reset(ah, true); in ar9003_mci_prep_interface()
241 ar9003_mci_send_req_wake(ah, true); in ar9003_mci_prep_interface()
243 if (!ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
265 ar9003_mci_send_sys_waking(ah, true); in ar9003_mci_prep_interface()
272 REG_WRITE(ah, AR_MCI_BT_PRI0, 0xFFFFFFFF); in ar9003_mci_prep_interface()
273 REG_WRITE(ah, AR_MCI_BT_PRI1, 0xFFFFFFFF); in ar9003_mci_prep_interface()
274 REG_WRITE(ah, AR_MCI_BT_PRI2, 0xFFFFFFFF); in ar9003_mci_prep_interface()
275 REG_WRITE(ah, AR_MCI_BT_PRI3, 0xFFFFFFFF); in ar9003_mci_prep_interface()
276 REG_WRITE(ah, AR_MCI_BT_PRI, 0X000000FF); in ar9003_mci_prep_interface()
284 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
286 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, AR_MCI_INTERRUPT_BT_PRI); in ar9003_mci_prep_interface()
289 ar9003_mci_send_lna_transfer(ah, true); in ar9003_mci_prep_interface()
294 if (ar9003_mci_wait_for_interrupt(ah, in ar9003_mci_prep_interface()
308 (REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
310 (REG_READ_FIELD(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
312 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_prep_interface()
314 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, in ar9003_mci_prep_interface()
318 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, saved_mci_int_en); in ar9003_mci_prep_interface()
321 void ar9003_mci_set_full_sleep(struct ath_hw *ah) in ar9003_mci_set_full_sleep() argument
323 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_set_full_sleep()
325 if (ar9003_mci_state(ah, MCI_STATE_ENABLE) && in ar9003_mci_set_full_sleep()
328 ar9003_mci_send_coex_halt_bt_gpm(ah, true, true); in ar9003_mci_set_full_sleep()
334 static void ar9003_mci_disable_interrupt(struct ath_hw *ah) in ar9003_mci_disable_interrupt() argument
336 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); in ar9003_mci_disable_interrupt()
337 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, 0); in ar9003_mci_disable_interrupt()
340 static void ar9003_mci_enable_interrupt(struct ath_hw *ah) in ar9003_mci_enable_interrupt() argument
342 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, AR_MCI_INTERRUPT_DEFAULT); in ar9003_mci_enable_interrupt()
343 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, in ar9003_mci_enable_interrupt()
347 static bool ar9003_mci_check_int(struct ath_hw *ah, u32 ints) in ar9003_mci_check_int() argument
351 intr = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW); in ar9003_mci_check_int()
355 void ar9003_mci_get_interrupt(struct ath_hw *ah, u32 *raw_intr, in ar9003_mci_get_interrupt() argument
358 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_get_interrupt()
369 void ar9003_mci_get_isr(struct ath_hw *ah, enum ath9k_int *masked) in ar9003_mci_get_isr() argument
371 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_get_isr()
372 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_get_isr()
375 rx_msg_intr = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_RAW); in ar9003_mci_get_isr()
376 raw_intr = REG_READ(ah, AR_MCI_INTERRUPT_RAW); in ar9003_mci_get_isr()
387 mci->cont_status = REG_READ(ah, AR_MCI_CONT_STATUS); in ar9003_mci_get_isr()
389 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, rx_msg_intr); in ar9003_mci_get_isr()
390 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, raw_intr); in ar9003_mci_get_isr()
394 static void ar9003_mci_2g5g_changed(struct ath_hw *ah, bool is_2g) in ar9003_mci_2g5g_changed() argument
396 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_2g5g_changed()
405 static bool ar9003_mci_is_gpm_valid(struct ath_hw *ah, u32 msg_index) in ar9003_mci_is_gpm_valid() argument
407 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_is_gpm_valid()
425 static void ar9003_mci_observation_set_up(struct ath_hw *ah) in ar9003_mci_observation_set_up() argument
427 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_observation_set_up()
430 ath9k_hw_gpio_request_out(ah, 3, NULL, in ar9003_mci_observation_set_up()
432 ath9k_hw_gpio_request_out(ah, 2, NULL, in ar9003_mci_observation_set_up()
434 ath9k_hw_gpio_request_out(ah, 1, NULL, in ar9003_mci_observation_set_up()
436 ath9k_hw_gpio_request_out(ah, 0, NULL, in ar9003_mci_observation_set_up()
439 ath9k_hw_gpio_request_out(ah, 3, NULL, in ar9003_mci_observation_set_up()
441 ath9k_hw_gpio_request_out(ah, 2, NULL, in ar9003_mci_observation_set_up()
443 ath9k_hw_gpio_request_out(ah, 1, NULL, in ar9003_mci_observation_set_up()
445 ath9k_hw_gpio_request_out(ah, 0, NULL, in ar9003_mci_observation_set_up()
447 ath9k_hw_gpio_request_out(ah, 5, NULL, in ar9003_mci_observation_set_up()
450 ath9k_hw_gpio_request_out(ah, 3, NULL, in ar9003_mci_observation_set_up()
452 ath9k_hw_gpio_request_out(ah, 2, NULL, in ar9003_mci_observation_set_up()
454 ath9k_hw_gpio_request_out(ah, 1, NULL, in ar9003_mci_observation_set_up()
456 ath9k_hw_gpio_request_out(ah, 0, NULL, in ar9003_mci_observation_set_up()
461 REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE); in ar9003_mci_observation_set_up()
463 REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL, AR_GLB_DS_JTAG_DISABLE, 1); in ar9003_mci_observation_set_up()
464 REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL, AR_GLB_WLAN_UART_INTF_EN, 0); in ar9003_mci_observation_set_up()
465 REG_SET_BIT(ah, AR_GLB_GPIO_CONTROL, ATH_MCI_CONFIG_MCI_OBS_GPIO); in ar9003_mci_observation_set_up()
467 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_GPIO_OBS_SEL, 0); in ar9003_mci_observation_set_up()
468 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_MAC_BB_OBS_SEL, 1); in ar9003_mci_observation_set_up()
469 REG_WRITE(ah, AR_OBS, 0x4b); in ar9003_mci_observation_set_up()
470 REG_RMW_FIELD(ah, AR_DIAG_SW, AR_DIAG_OBS_PT_SEL1, 0x03); in ar9003_mci_observation_set_up()
471 REG_RMW_FIELD(ah, AR_DIAG_SW, AR_DIAG_OBS_PT_SEL2, 0x01); in ar9003_mci_observation_set_up()
472 REG_RMW_FIELD(ah, AR_MACMISC, AR_MACMISC_MISC_OBS_BUS_LSB, 0x02); in ar9003_mci_observation_set_up()
473 REG_RMW_FIELD(ah, AR_MACMISC, AR_MACMISC_MISC_OBS_BUS_MSB, 0x03); in ar9003_mci_observation_set_up()
474 REG_RMW_FIELD(ah, AR_PHY_TEST_CTL_STATUS, in ar9003_mci_observation_set_up()
478 static bool ar9003_mci_send_coex_bt_flags(struct ath_hw *ah, bool wait_done, in ar9003_mci_send_coex_bt_flags() argument
492 return ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, in ar9003_mci_send_coex_bt_flags()
496 static void ar9003_mci_sync_bt_state(struct ath_hw *ah) in ar9003_mci_sync_bt_state() argument
498 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_sync_bt_state()
501 cur_bt_state = ar9003_mci_state(ah, MCI_STATE_REMOTE_SLEEP); in ar9003_mci_sync_bt_state()
508 ar9003_mci_send_coex_version_query(ah, true); in ar9003_mci_sync_bt_state()
509 ar9003_mci_send_coex_wlan_channels(ah, true); in ar9003_mci_sync_bt_state()
512 ar9003_mci_send_coex_halt_bt_gpm(ah, false, true); in ar9003_mci_sync_bt_state()
516 void ar9003_mci_check_bt(struct ath_hw *ah) in ar9003_mci_check_bt() argument
518 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_check_bt()
527 ar9003_mci_sync_bt_state(ah); in ar9003_mci_check_bt()
528 ar9003_mci_2g5g_switch(ah, true); in ar9003_mci_check_bt()
536 static void ar9003_mci_process_gpm_extra(struct ath_hw *ah, u8 gpm_type, in ar9003_mci_process_gpm_extra() argument
539 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_process_gpm_extra()
540 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_process_gpm_extra()
549 ar9003_mci_send_coex_version_response(ah, true); in ar9003_mci_process_gpm_extra()
566 ar9003_mci_send_coex_wlan_channels(ah, true); in ar9003_mci_process_gpm_extra()
583 static u32 ar9003_mci_wait_for_gpm(struct ath_hw *ah, u8 gpm_type, in ar9003_mci_wait_for_gpm() argument
586 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_wait_for_gpm()
587 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_wait_for_gpm()
602 time_out = ar9003_mci_wait_for_interrupt(ah, in ar9003_mci_wait_for_gpm()
610 offset = ar9003_mci_get_next_gpm_offset(ah, &more_data); in ar9003_mci_wait_for_gpm()
653 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, 16, in ar9003_mci_wait_for_gpm()
660 ar9003_mci_process_gpm_extra(ah, recv_type, in ar9003_mci_wait_for_gpm()
674 offset = ar9003_mci_get_next_gpm_offset(ah, &more_data); in ar9003_mci_wait_for_gpm()
683 ar9003_mci_process_gpm_extra(ah, recv_type, in ar9003_mci_wait_for_gpm()
692 bool ar9003_mci_start_reset(struct ath_hw *ah, struct ath9k_channel *chan) in ar9003_mci_start_reset() argument
694 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_start_reset()
695 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_start_reset()
698 ar9003_mci_2g5g_changed(ah, IS_CHAN_2GHZ(chan)); in ar9003_mci_start_reset()
710 ar9003_mci_disable_interrupt(ah); in ar9003_mci_start_reset()
713 ar9003_mci_send_message(ah, MCI_GPM, 0, payload, in ar9003_mci_start_reset()
718 if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_DONE, in ar9003_mci_start_reset()
727 ar9003_mci_enable_interrupt(ah); in ar9003_mci_start_reset()
732 int ar9003_mci_end_reset(struct ath_hw *ah, struct ath9k_channel *chan, in ar9003_mci_end_reset() argument
735 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_end_reset()
743 if (!ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REMOTE_RESET) && in ar9003_mci_end_reset()
744 !ar9003_mci_check_int(ah, AR_MCI_INTERRUPT_RX_MSG_REQ_WAKE)) in ar9003_mci_end_reset()
753 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_end_reset()
757 ar9003_mci_remote_reset(ah, true); in ar9003_mci_end_reset()
758 ar9003_mci_send_sys_waking(ah, true); in ar9003_mci_end_reset()
762 ar9003_mci_send_lna_transfer(ah, true); in ar9003_mci_end_reset()
766 REG_CLR_BIT(ah, AR_PHY_TIMING4, in ar9003_mci_end_reset()
775 if (!ath9k_hw_init_cal(ah, chan)) in ar9003_mci_end_reset()
778 REG_SET_BIT(ah, AR_PHY_TIMING4, in ar9003_mci_end_reset()
782 ar9003_mci_enable_interrupt(ah); in ar9003_mci_end_reset()
786 static void ar9003_mci_mute_bt(struct ath_hw *ah) in ar9003_mci_mute_bt() argument
788 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_mute_bt()
791 REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, 0xffff0000); in ar9003_mci_mute_bt()
792 REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS0, 0xffffffff); in ar9003_mci_mute_bt()
793 REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS1, 0xffffffff); in ar9003_mci_mute_bt()
794 REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS2, 0xffffffff); in ar9003_mci_mute_bt()
795 REG_WRITE(ah, AR_BTCOEX_WL_WEIGHTS3, 0xffffffff); in ar9003_mci_mute_bt()
796 REG_SET_BIT(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_DISABLE_LNA_UPDATE); in ar9003_mci_mute_bt()
807 ar9003_mci_send_lna_take(ah, true); in ar9003_mci_mute_bt()
811 ar9003_mci_send_sys_sleeping(ah, true); in ar9003_mci_mute_bt()
814 static void ar9003_mci_osla_setup(struct ath_hw *ah, bool enable) in ar9003_mci_osla_setup() argument
816 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_osla_setup()
820 REG_CLR_BIT(ah, AR_BTCOEX_CTRL, in ar9003_mci_osla_setup()
824 REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, AR_MCI_SCHD_TABLE_2_HW_BASED, 1); in ar9003_mci_osla_setup()
825 REG_RMW_FIELD(ah, AR_MCI_SCHD_TABLE_2, in ar9003_mci_osla_setup()
828 if (AR_SREV_9565(ah)) in ar9003_mci_osla_setup()
829 REG_RMW_FIELD(ah, AR_MCI_MISC, AR_MCI_MISC_HW_FIX_EN, 1); in ar9003_mci_osla_setup()
833 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, in ar9003_mci_osla_setup()
835 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, in ar9003_mci_osla_setup()
838 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, in ar9003_mci_osla_setup()
841 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, in ar9003_mci_osla_setup()
845 static void ar9003_mci_stat_setup(struct ath_hw *ah) in ar9003_mci_stat_setup() argument
847 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_stat_setup()
849 if (!AR_SREV_9565(ah)) in ar9003_mci_stat_setup()
853 REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL, in ar9003_mci_stat_setup()
855 REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL, in ar9003_mci_stat_setup()
859 REG_RMW_FIELD(ah, AR_MCI_DBG_CNT_CTRL, in ar9003_mci_stat_setup()
864 static void ar9003_mci_set_btcoex_ctrl_9565_1ANT(struct ath_hw *ah) in ar9003_mci_set_btcoex_ctrl_9565_1ANT() argument
878 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, in ar9003_mci_set_btcoex_ctrl_9565_1ANT()
880 REG_WRITE(ah, AR_BTCOEX_CTRL, regval); in ar9003_mci_set_btcoex_ctrl_9565_1ANT()
883 static void ar9003_mci_set_btcoex_ctrl_9565_2ANT(struct ath_hw *ah) in ar9003_mci_set_btcoex_ctrl_9565_2ANT() argument
897 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, in ar9003_mci_set_btcoex_ctrl_9565_2ANT()
899 REG_WRITE(ah, AR_BTCOEX_CTRL, regval); in ar9003_mci_set_btcoex_ctrl_9565_2ANT()
902 static void ar9003_mci_set_btcoex_ctrl_9462(struct ath_hw *ah) in ar9003_mci_set_btcoex_ctrl_9462() argument
916 REG_WRITE(ah, AR_BTCOEX_CTRL, regval); in ar9003_mci_set_btcoex_ctrl_9462()
919 int ar9003_mci_reset(struct ath_hw *ah, bool en_int, bool is_2g, in ar9003_mci_reset() argument
922 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_reset()
923 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_reset()
929 if (REG_READ(ah, AR_BTCOEX_CTRL) == 0xdeadbeef) { in ar9003_mci_reset()
935 REG_WRITE(ah, AR_MCI_GPM_0, mci->gpm_addr); in ar9003_mci_reset()
936 REG_WRITE(ah, AR_MCI_GPM_1, mci->gpm_len); in ar9003_mci_reset()
937 REG_WRITE(ah, AR_MCI_SCHD_TABLE_0, mci->sched_addr); in ar9003_mci_reset()
943 if (AR_SREV_9565(ah)) { in ar9003_mci_reset()
947 ar9003_mci_set_btcoex_ctrl_9565_1ANT(ah); in ar9003_mci_reset()
949 ar9003_mci_set_btcoex_ctrl_9565_2ANT(ah); in ar9003_mci_reset()
951 ar9003_mci_set_btcoex_ctrl_9462(ah); in ar9003_mci_reset()
955 ar9003_mci_osla_setup(ah, true); in ar9003_mci_reset()
957 ar9003_mci_osla_setup(ah, false); in ar9003_mci_reset()
959 REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, in ar9003_mci_reset()
961 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL3, in ar9003_mci_reset()
964 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, AR_BTCOEX_CTRL2_RX_DEWEIGHT, 0); in ar9003_mci_reset()
965 REG_RMW_FIELD(ah, AR_PCU_MISC, AR_PCU_BT_ANT_PREVENT_RX, 0); in ar9003_mci_reset()
968 REG_RMW_FIELD(ah, AR_BTCOEX_WL_LNA, AR_BTCOEX_WL_LNA_TIMEOUT, 0x3D090); in ar9003_mci_reset()
972 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, in ar9003_mci_reset()
974 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL2, in ar9003_mci_reset()
976 REG_RMW_FIELD(ah, AR_BTCOEX_CTRL, in ar9003_mci_reset()
979 REG_WRITE(ah, AR_BTCOEX_MAX_TXPWR(i), 0x7f7f7f7f); in ar9003_mci_reset()
983 REG_RMW_FIELD(ah, AR_MCI_TX_CTRL, AR_MCI_TX_CTRL_CLK_DIV, regval); in ar9003_mci_reset()
984 REG_SET_BIT(ah, AR_BTCOEX_CTRL, AR_BTCOEX_CTRL_MCI_MODE_EN); in ar9003_mci_reset()
987 regval = REG_READ(ah, AR_MCI_COMMAND2); in ar9003_mci_reset()
989 REG_WRITE(ah, AR_MCI_COMMAND2, regval); in ar9003_mci_reset()
994 REG_WRITE(ah, AR_MCI_COMMAND2, regval); in ar9003_mci_reset()
997 ar9003_mci_mute_bt(ah); in ar9003_mci_reset()
1002 ar9003_mci_check_gpm_offset(ah); in ar9003_mci_reset()
1005 REG_WRITE(ah, AR_MCI_COMMAND2, regval); in ar9003_mci_reset()
1008 REG_WRITE(ah, AR_MCI_COMMAND2, regval); in ar9003_mci_reset()
1011 ar9003_mci_state(ah, MCI_STATE_INIT_GPM_OFFSET); in ar9003_mci_reset()
1013 REG_WRITE(ah, AR_MCI_MSG_ATTRIBUTES_TABLE, in ar9003_mci_reset()
1018 REG_CLR_BIT(ah, AR_MCI_TX_CTRL, in ar9003_mci_reset()
1021 REG_SET_BIT(ah, AR_MCI_TX_CTRL, in ar9003_mci_reset()
1024 ar9003_mci_observation_set_up(ah); in ar9003_mci_reset()
1027 ar9003_mci_prep_interface(ah); in ar9003_mci_reset()
1028 ar9003_mci_stat_setup(ah); in ar9003_mci_reset()
1031 ar9003_mci_enable_interrupt(ah); in ar9003_mci_reset()
1033 if (ath9k_hw_is_aic_enabled(ah)) in ar9003_mci_reset()
1034 ar9003_aic_start_normal(ah); in ar9003_mci_reset()
1039 void ar9003_mci_stop_bt(struct ath_hw *ah, bool save_fullsleep) in ar9003_mci_stop_bt() argument
1041 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_stop_bt()
1043 ar9003_mci_disable_interrupt(ah); in ar9003_mci_stop_bt()
1046 ar9003_mci_mute_bt(ah); in ar9003_mci_stop_bt()
1048 REG_WRITE(ah, AR_BTCOEX_CTRL, 0); in ar9003_mci_stop_bt()
1055 static void ar9003_mci_send_2g5g_status(struct ath_hw *ah, bool wait_done) in ar9003_mci_send_2g5g_status() argument
1057 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_2g5g_status()
1072 ar9003_mci_send_coex_bt_flags(ah, wait_done, in ar9003_mci_send_2g5g_status()
1076 ar9003_mci_send_coex_bt_flags(ah, wait_done, in ar9003_mci_send_2g5g_status()
1081 static void ar9003_mci_queue_unsent_gpm(struct ath_hw *ah, u8 header, in ar9003_mci_queue_unsent_gpm() argument
1084 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_queue_unsent_gpm()
1130 void ar9003_mci_2g5g_switch(struct ath_hw *ah, bool force) in ar9003_mci_2g5g_switch() argument
1132 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_2g5g_switch()
1138 ar9003_mci_send_2g5g_status(ah, true); in ar9003_mci_2g5g_switch()
1139 ar9003_mci_send_lna_transfer(ah, true); in ar9003_mci_2g5g_switch()
1142 REG_CLR_BIT(ah, AR_MCI_TX_CTRL, in ar9003_mci_2g5g_switch()
1144 REG_CLR_BIT(ah, AR_PHY_GLB_CONTROL, in ar9003_mci_2g5g_switch()
1148 ar9003_mci_osla_setup(ah, true); in ar9003_mci_2g5g_switch()
1150 if (AR_SREV_9462(ah)) in ar9003_mci_2g5g_switch()
1151 REG_WRITE(ah, AR_SELFGEN_MASK, 0x02); in ar9003_mci_2g5g_switch()
1153 ar9003_mci_send_lna_take(ah, true); in ar9003_mci_2g5g_switch()
1156 REG_SET_BIT(ah, AR_MCI_TX_CTRL, in ar9003_mci_2g5g_switch()
1158 REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, in ar9003_mci_2g5g_switch()
1161 ar9003_mci_osla_setup(ah, false); in ar9003_mci_2g5g_switch()
1162 ar9003_mci_send_2g5g_status(ah, true); in ar9003_mci_2g5g_switch()
1166 bool ar9003_mci_send_message(struct ath_hw *ah, u8 header, u32 flag, in ar9003_mci_send_message() argument
1170 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_send_message()
1171 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_message()
1177 saved_mci_int_en = REG_READ(ah, AR_MCI_INTERRUPT_EN); in ar9003_mci_send_message()
1178 regval = REG_READ(ah, AR_BTCOEX_CTRL); in ar9003_mci_send_message()
1183 header, (ah->power_mode == ATH9K_PM_FULL_SLEEP) ? 1 : 0); in ar9003_mci_send_message()
1184 ar9003_mci_queue_unsent_gpm(ah, header, payload, true); in ar9003_mci_send_message()
1190 ar9003_mci_queue_unsent_gpm(ah, header, payload, true); in ar9003_mci_send_message()
1195 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, 0); in ar9003_mci_send_message()
1199 REG_WRITE(ah, AR_MCI_INTERRUPT_RAW, in ar9003_mci_send_message()
1205 REG_WRITE(ah, (AR_MCI_TX_PAYLOAD0 + i * 4), in ar9003_mci_send_message()
1209 REG_WRITE(ah, AR_MCI_COMMAND0, in ar9003_mci_send_message()
1216 !(ar9003_mci_wait_for_interrupt(ah, AR_MCI_INTERRUPT_RAW, in ar9003_mci_send_message()
1218 ar9003_mci_queue_unsent_gpm(ah, header, payload, true); in ar9003_mci_send_message()
1220 ar9003_mci_queue_unsent_gpm(ah, header, payload, false); in ar9003_mci_send_message()
1225 REG_WRITE(ah, AR_MCI_INTERRUPT_EN, saved_mci_int_en); in ar9003_mci_send_message()
1231 void ar9003_mci_init_cal_req(struct ath_hw *ah, bool *is_reusable) in ar9003_mci_init_cal_req() argument
1233 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_init_cal_req()
1234 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_init_cal_req()
1244 ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false); in ar9003_mci_init_cal_req()
1246 if (ar9003_mci_wait_for_gpm(ah, MCI_GPM_BT_CAL_GRANT, 0, 50000)) { in ar9003_mci_init_cal_req()
1254 void ar9003_mci_init_cal_done(struct ath_hw *ah) in ar9003_mci_init_cal_done() argument
1256 struct ath9k_hw_mci *mci_hw = &ah->btcoex_hw.mci; in ar9003_mci_init_cal_done()
1265 ar9003_mci_send_message(ah, MCI_GPM, 0, pld, 16, true, false); in ar9003_mci_init_cal_done()
1268 int ar9003_mci_setup(struct ath_hw *ah, u32 gpm_addr, void *gpm_buf, in ar9003_mci_setup() argument
1271 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_setup()
1278 return ar9003_mci_reset(ah, true, true, true); in ar9003_mci_setup()
1282 void ar9003_mci_cleanup(struct ath_hw *ah) in ar9003_mci_cleanup() argument
1285 REG_WRITE(ah, AR_BTCOEX_CTRL, 0x00); in ar9003_mci_cleanup()
1286 ar9003_mci_disable_interrupt(ah); in ar9003_mci_cleanup()
1290 u32 ar9003_mci_state(struct ath_hw *ah, u32 state_type) in ar9003_mci_state() argument
1292 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_state()
1299 value = REG_READ(ah, AR_BTCOEX_CTRL); in ar9003_mci_state()
1307 value = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); in ar9003_mci_state()
1315 value = MS(REG_READ(ah, AR_MCI_RX_STATUS), in ar9003_mci_state()
1321 value = MS(REG_READ(ah, AR_MCI_RX_STATUS), in ar9003_mci_state()
1327 ar9003_mci_send_coex_version_query(ah, true); in ar9003_mci_state()
1328 ar9003_mci_send_coex_wlan_channels(ah, true); in ar9003_mci_state()
1331 ar9003_mci_send_coex_halt_bt_gpm(ah, false, true); in ar9003_mci_state()
1333 ar9003_mci_2g5g_switch(ah, false); in ar9003_mci_state()
1336 ar9003_mci_reset_req_wakeup(ah); in ar9003_mci_state()
1341 if ((REG_READ(ah, AR_GLB_GPIO_CONTROL) & in ar9003_mci_state()
1344 ar9003_mci_observation_set_up(ah); in ar9003_mci_state()
1349 ar9003_mci_send_coex_version_response(ah, true); in ar9003_mci_state()
1352 ar9003_mci_send_coex_version_query(ah, true); in ar9003_mci_state()
1356 ar9003_mci_send_coex_bt_status_query(ah, true, query_type); in ar9003_mci_state()
1359 tsf = ath9k_hw_gettsf32(ah); in ar9003_mci_state()
1361 ath_dbg(ath9k_hw_common(ah), MCI, in ar9003_mci_state()
1365 ath_dbg(ath9k_hw_common(ah), MCI, "(MCI) RECOVER RX\n"); in ar9003_mci_state()
1367 ar9003_mci_prep_interface(ah); in ar9003_mci_state()
1370 ar9003_mci_send_coex_wlan_channels(ah, true); in ar9003_mci_state()
1371 ar9003_mci_2g5g_switch(ah, false); in ar9003_mci_state()
1381 if (ath9k_hw_is_aic_enabled(ah)) in ar9003_mci_state()
1382 value = ar9003_aic_calibration(ah); in ar9003_mci_state()
1385 if (ath9k_hw_is_aic_enabled(ah)) in ar9003_mci_state()
1386 ar9003_aic_start_normal(ah); in ar9003_mci_state()
1389 if (ath9k_hw_is_aic_enabled(ah)) in ar9003_mci_state()
1390 value = ar9003_aic_cal_reset(ah); in ar9003_mci_state()
1393 if (ath9k_hw_is_aic_enabled(ah)) in ar9003_mci_state()
1394 value = ar9003_aic_calibration_single(ah); in ar9003_mci_state()
1404 void ar9003_mci_bt_gain_ctrl(struct ath_hw *ah) in ar9003_mci_bt_gain_ctrl() argument
1406 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_bt_gain_ctrl()
1407 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_bt_gain_ctrl()
1411 ar9003_mci_send_lna_take(ah, true); in ar9003_mci_bt_gain_ctrl()
1414 REG_SET_BIT(ah, AR_PHY_GLB_CONTROL, AR_BTCOEX_CTRL_BT_OWN_SPDT_CTRL); in ar9003_mci_bt_gain_ctrl()
1417 ar9003_mci_send_2g5g_status(ah, true); in ar9003_mci_bt_gain_ctrl()
1423 void ar9003_mci_set_power_awake(struct ath_hw *ah) in ar9003_mci_set_power_awake() argument
1430 btcoex_ctrl2 = REG_READ(ah, AR_BTCOEX_CTRL2); in ar9003_mci_set_power_awake()
1435 REG_WRITE(ah, AR_BTCOEX_CTRL2, (btcoex_ctrl2 | BIT(23))); in ar9003_mci_set_power_awake()
1438 diag_sw = REG_READ(ah, AR_DIAG_SW); in ar9003_mci_set_power_awake()
1443 REG_WRITE(ah, AR_DIAG_SW, (diag_sw | BIT(27) | BIT(19) | BIT(18))); in ar9003_mci_set_power_awake()
1444 lna_ctrl = REG_READ(ah, AR_OBS_BUS_CTRL) & 0x3; in ar9003_mci_set_power_awake()
1445 bt_sleep = MS(REG_READ(ah, AR_MCI_RX_STATUS), AR_MCI_RX_REMOTE_SLEEP); in ar9003_mci_set_power_awake()
1447 REG_WRITE(ah, AR_BTCOEX_CTRL2, btcoex_ctrl2); in ar9003_mci_set_power_awake()
1448 REG_WRITE(ah, AR_DIAG_SW, diag_sw); in ar9003_mci_set_power_awake()
1451 REG_SET_BIT(ah, AR_BTCOEX_RC, 0x1); in ar9003_mci_set_power_awake()
1452 REG_CLR_BIT(ah, AR_BTCOEX_RC, 0x1); in ar9003_mci_set_power_awake()
1457 void ar9003_mci_check_gpm_offset(struct ath_hw *ah) in ar9003_mci_check_gpm_offset() argument
1459 struct ath_common *common = ath9k_hw_common(ah); in ar9003_mci_check_gpm_offset()
1460 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_check_gpm_offset()
1466 offset = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); in ar9003_mci_check_gpm_offset()
1476 u32 ar9003_mci_get_next_gpm_offset(struct ath_hw *ah, u32 *more) in ar9003_mci_get_next_gpm_offset() argument
1478 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_get_next_gpm_offset()
1490 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_RAW, in ar9003_mci_get_next_gpm_offset()
1493 gpm_ptr = MS(REG_READ(ah, AR_MCI_GPM_1), AR_MCI_GPM_WRITE_PTR); in ar9003_mci_get_next_gpm_offset()
1530 if (ar9003_mci_is_gpm_valid(ah, temp_index)) { in ar9003_mci_get_next_gpm_offset()
1551 void ar9003_mci_set_bt_version(struct ath_hw *ah, u8 major, u8 minor) in ar9003_mci_set_bt_version() argument
1553 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_set_bt_version()
1558 ath_dbg(ath9k_hw_common(ah), MCI, "MCI BT version set: %d.%d\n", in ar9003_mci_set_bt_version()
1563 void ar9003_mci_send_wlan_channels(struct ath_hw *ah) in ar9003_mci_send_wlan_channels() argument
1565 struct ath9k_hw_mci *mci = &ah->btcoex_hw.mci; in ar9003_mci_send_wlan_channels()
1568 ar9003_mci_send_coex_wlan_channels(ah, true); in ar9003_mci_send_wlan_channels()
1572 u16 ar9003_mci_get_max_txpower(struct ath_hw *ah, u8 ctlmode) in ar9003_mci_get_max_txpower() argument
1574 if (!ah->btcoex_hw.mci.concur_tx) in ar9003_mci_get_max_txpower()