Lines Matching refs:trans
20 int iwl_pcie_gen2_apm_init(struct iwl_trans *trans) in iwl_pcie_gen2_apm_init() argument
24 IWL_DEBUG_INFO(trans, "Init card's basic functions\n"); in iwl_pcie_gen2_apm_init()
35 iwl_set_bit(trans, CSR_GIO_CHICKEN_BITS, in iwl_pcie_gen2_apm_init()
39 iwl_set_bit(trans, CSR_DBG_HPET_MEM_REG, CSR_DBG_HPET_MEM_REG_VAL); in iwl_pcie_gen2_apm_init()
45 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, in iwl_pcie_gen2_apm_init()
48 iwl_pcie_apm_config(trans); in iwl_pcie_gen2_apm_init()
50 ret = iwl_finish_nic_init(trans); in iwl_pcie_gen2_apm_init()
54 set_bit(STATUS_DEVICE_ENABLED, &trans->status); in iwl_pcie_gen2_apm_init()
59 static void iwl_pcie_gen2_apm_stop(struct iwl_trans *trans, bool op_mode_leave) in iwl_pcie_gen2_apm_stop() argument
61 IWL_DEBUG_INFO(trans, "Stop card, put in low power state\n"); in iwl_pcie_gen2_apm_stop()
64 if (!test_bit(STATUS_DEVICE_ENABLED, &trans->status)) in iwl_pcie_gen2_apm_stop()
65 iwl_pcie_gen2_apm_init(trans); in iwl_pcie_gen2_apm_stop()
68 iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, in iwl_pcie_gen2_apm_stop()
70 iwl_set_bit(trans, CSR_HW_IF_CONFIG_REG, in iwl_pcie_gen2_apm_stop()
74 iwl_clear_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, in iwl_pcie_gen2_apm_stop()
79 clear_bit(STATUS_DEVICE_ENABLED, &trans->status); in iwl_pcie_gen2_apm_stop()
82 iwl_pcie_apm_stop_master(trans); in iwl_pcie_gen2_apm_stop()
84 iwl_trans_sw_reset(trans, false); in iwl_pcie_gen2_apm_stop()
90 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) in iwl_pcie_gen2_apm_stop()
91 iwl_clear_bit(trans, CSR_GP_CNTRL, in iwl_pcie_gen2_apm_stop()
94 iwl_clear_bit(trans, CSR_GP_CNTRL, in iwl_pcie_gen2_apm_stop()
98 static void iwl_trans_pcie_fw_reset_handshake(struct iwl_trans *trans) in iwl_trans_pcie_fw_reset_handshake() argument
100 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_trans_pcie_fw_reset_handshake()
105 if (trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210) in iwl_trans_pcie_fw_reset_handshake()
106 iwl_write_umac_prph(trans, UREG_NIC_SET_NMI_DRIVER, in iwl_trans_pcie_fw_reset_handshake()
108 else if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210) in iwl_trans_pcie_fw_reset_handshake()
109 iwl_write_umac_prph(trans, UREG_DOORBELL_TO_ISR6, in iwl_trans_pcie_fw_reset_handshake()
112 iwl_write32(trans, CSR_DOORBELL_VECTOR, in iwl_trans_pcie_fw_reset_handshake()
120 IWL_INFO(trans, in iwl_trans_pcie_fw_reset_handshake()
122 iwl_trans_fw_error(trans, true); in iwl_trans_pcie_fw_reset_handshake()
128 void _iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans) in _iwl_trans_pcie_gen2_stop_device() argument
130 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in _iwl_trans_pcie_gen2_stop_device()
137 if (trans->state >= IWL_TRANS_FW_STARTED) in _iwl_trans_pcie_gen2_stop_device()
139 iwl_trans_pcie_fw_reset_handshake(trans); in _iwl_trans_pcie_gen2_stop_device()
144 iwl_disable_interrupts(trans); in _iwl_trans_pcie_gen2_stop_device()
147 iwl_pcie_disable_ict(trans); in _iwl_trans_pcie_gen2_stop_device()
156 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { in _iwl_trans_pcie_gen2_stop_device()
157 IWL_DEBUG_INFO(trans, in _iwl_trans_pcie_gen2_stop_device()
159 iwl_txq_gen2_tx_free(trans); in _iwl_trans_pcie_gen2_stop_device()
160 iwl_pcie_rx_stop(trans); in _iwl_trans_pcie_gen2_stop_device()
163 iwl_pcie_ctxt_info_free_paging(trans); in _iwl_trans_pcie_gen2_stop_device()
164 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in _iwl_trans_pcie_gen2_stop_device()
165 iwl_pcie_ctxt_info_gen3_free(trans, false); in _iwl_trans_pcie_gen2_stop_device()
167 iwl_pcie_ctxt_info_free(trans); in _iwl_trans_pcie_gen2_stop_device()
170 iwl_pcie_gen2_apm_stop(trans, false); in _iwl_trans_pcie_gen2_stop_device()
173 iwl_trans_sw_reset(trans, true); in _iwl_trans_pcie_gen2_stop_device()
191 iwl_disable_interrupts(trans); in _iwl_trans_pcie_gen2_stop_device()
194 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); in _iwl_trans_pcie_gen2_stop_device()
195 clear_bit(STATUS_INT_ENABLED, &trans->status); in _iwl_trans_pcie_gen2_stop_device()
196 clear_bit(STATUS_TPOWER_PMI, &trans->status); in _iwl_trans_pcie_gen2_stop_device()
202 iwl_enable_rfkill_int(trans); in _iwl_trans_pcie_gen2_stop_device()
205 void iwl_trans_pcie_gen2_stop_device(struct iwl_trans *trans) in iwl_trans_pcie_gen2_stop_device() argument
207 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_trans_pcie_gen2_stop_device()
210 iwl_op_mode_time_point(trans->op_mode, in iwl_trans_pcie_gen2_stop_device()
216 was_in_rfkill = test_bit(STATUS_RFKILL_OPMODE, &trans->status); in iwl_trans_pcie_gen2_stop_device()
217 _iwl_trans_pcie_gen2_stop_device(trans); in iwl_trans_pcie_gen2_stop_device()
218 iwl_trans_pcie_handle_stop_rfkill(trans, was_in_rfkill); in iwl_trans_pcie_gen2_stop_device()
222 static int iwl_pcie_gen2_nic_init(struct iwl_trans *trans) in iwl_pcie_gen2_nic_init() argument
224 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_pcie_gen2_nic_init()
226 trans->cfg->min_txq_size); in iwl_pcie_gen2_nic_init()
230 iwl_pcie_gen2_apm_init(trans); in iwl_pcie_gen2_nic_init()
233 iwl_op_mode_nic_config(trans->op_mode); in iwl_pcie_gen2_nic_init()
236 if (iwl_pcie_gen2_rx_init(trans)) in iwl_pcie_gen2_nic_init()
240 if (iwl_txq_gen2_init(trans, trans->txqs.cmd.q_id, queue_size)) in iwl_pcie_gen2_nic_init()
244 iwl_set_bit(trans, CSR_MAC_SHADOW_REG_CTRL, 0x800FFFFF); in iwl_pcie_gen2_nic_init()
245 IWL_DEBUG_INFO(trans, "Enabling shadow registers in device\n"); in iwl_pcie_gen2_nic_init()
250 static void iwl_pcie_get_rf_name(struct iwl_trans *trans) in iwl_pcie_get_rf_name() argument
252 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_pcie_get_rf_name()
261 switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) { in iwl_pcie_get_rf_name()
284 switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) { in iwl_pcie_get_rf_name()
288 version = iwl_read_prph(trans, CNVI_MBOX_C); in iwl_pcie_get_rf_name()
307 trans->hw_rf_id); in iwl_pcie_get_rf_name()
309 IWL_INFO(trans, "Detected RF %s\n", buf); in iwl_pcie_get_rf_name()
319 void iwl_trans_pcie_gen2_fw_alive(struct iwl_trans *trans, u32 scd_addr) in iwl_trans_pcie_gen2_fw_alive() argument
321 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_trans_pcie_gen2_fw_alive()
323 iwl_pcie_reset_ict(trans); in iwl_trans_pcie_gen2_fw_alive()
326 memset(trans->txqs.queue_stopped, 0, in iwl_trans_pcie_gen2_fw_alive()
327 sizeof(trans->txqs.queue_stopped)); in iwl_trans_pcie_gen2_fw_alive()
328 memset(trans->txqs.queue_used, 0, sizeof(trans->txqs.queue_used)); in iwl_trans_pcie_gen2_fw_alive()
333 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_trans_pcie_gen2_fw_alive()
334 iwl_pcie_ctxt_info_gen3_free(trans, true); in iwl_trans_pcie_gen2_fw_alive()
336 iwl_pcie_ctxt_info_free(trans); in iwl_trans_pcie_gen2_fw_alive()
342 iwl_enable_interrupts(trans); in iwl_trans_pcie_gen2_fw_alive()
344 iwl_pcie_check_hw_rf_kill(trans); in iwl_trans_pcie_gen2_fw_alive()
346 iwl_pcie_get_rf_name(trans); in iwl_trans_pcie_gen2_fw_alive()
350 static void iwl_pcie_set_ltr(struct iwl_trans *trans) in iwl_pcie_set_ltr() argument
367 if ((trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_AX210 || in iwl_pcie_set_ltr()
368 trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) && in iwl_pcie_set_ltr()
369 !trans->trans_cfg->integrated) { in iwl_pcie_set_ltr()
370 iwl_write32(trans, CSR_LTR_LONG_VAL_AD, ltr_val); in iwl_pcie_set_ltr()
371 } else if (trans->trans_cfg->integrated && in iwl_pcie_set_ltr()
372 trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000) { in iwl_pcie_set_ltr()
373 iwl_write_prph(trans, HPM_MAC_LTR_CSR, HPM_MAC_LRT_ENABLE_ALL); in iwl_pcie_set_ltr()
374 iwl_write_prph(trans, HPM_UMAC_LTR, ltr_val); in iwl_pcie_set_ltr()
378 int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, in iwl_trans_pcie_gen2_start_fw() argument
381 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); in iwl_trans_pcie_gen2_start_fw()
386 if (iwl_pcie_prepare_card_hw(trans)) { in iwl_trans_pcie_gen2_start_fw()
387 IWL_WARN(trans, "Exit HW not ready\n"); in iwl_trans_pcie_gen2_start_fw()
391 iwl_enable_rfkill_int(trans); in iwl_trans_pcie_gen2_start_fw()
393 iwl_write32(trans, CSR_INT, 0xFFFFFFFF); in iwl_trans_pcie_gen2_start_fw()
400 iwl_disable_interrupts(trans); in iwl_trans_pcie_gen2_start_fw()
403 iwl_pcie_synchronize_irqs(trans); in iwl_trans_pcie_gen2_start_fw()
408 hw_rfkill = iwl_pcie_check_hw_rf_kill(trans); in iwl_trans_pcie_gen2_start_fw()
416 IWL_WARN(trans, in iwl_trans_pcie_gen2_start_fw()
423 iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); in iwl_trans_pcie_gen2_start_fw()
424 iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, in iwl_trans_pcie_gen2_start_fw()
428 iwl_write32(trans, CSR_INT, 0xFFFFFFFF); in iwl_trans_pcie_gen2_start_fw()
430 ret = iwl_pcie_gen2_nic_init(trans); in iwl_trans_pcie_gen2_start_fw()
432 IWL_ERR(trans, "Unable to init nic\n"); in iwl_trans_pcie_gen2_start_fw()
436 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_trans_pcie_gen2_start_fw()
437 ret = iwl_pcie_ctxt_info_gen3_init(trans, fw); in iwl_trans_pcie_gen2_start_fw()
439 ret = iwl_pcie_ctxt_info_init(trans, fw); in iwl_trans_pcie_gen2_start_fw()
443 iwl_pcie_set_ltr(trans); in iwl_trans_pcie_gen2_start_fw()
445 if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_BZ) { in iwl_trans_pcie_gen2_start_fw()
446 iwl_write32(trans, CSR_FUNC_SCRATCH, CSR_FUNC_SCRATCH_INIT_VALUE); in iwl_trans_pcie_gen2_start_fw()
447 iwl_set_bit(trans, CSR_GP_CNTRL, in iwl_trans_pcie_gen2_start_fw()
449 } else if (trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) { in iwl_trans_pcie_gen2_start_fw()
450 iwl_write_umac_prph(trans, UREG_CPU_INIT_RUN, 1); in iwl_trans_pcie_gen2_start_fw()
452 iwl_write_prph(trans, UREG_CPU_INIT_RUN, 1); in iwl_trans_pcie_gen2_start_fw()
456 hw_rfkill = iwl_pcie_check_hw_rf_kill(trans); in iwl_trans_pcie_gen2_start_fw()