• Home
  • Raw
  • Download

Lines Matching refs:ab

144 static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,  in ath11k_core_create_board_name()  argument
149 ath11k_bus_str(ab->hif.bus), in ath11k_core_create_board_name()
150 ab->qmi.target.chip_id, in ath11k_core_create_board_name()
151 ab->qmi.target.board_id); in ath11k_core_create_board_name()
153 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot using board name '%s'\n", name); in ath11k_core_create_board_name()
158 const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, in ath11k_core_firmware_request() argument
168 ath11k_core_create_firmware_path(ab, file, path, sizeof(path)); in ath11k_core_firmware_request()
170 ret = firmware_request_nowarn(&fw, path, ab->dev); in ath11k_core_firmware_request()
174 ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot firmware request %s size %zu\n", in ath11k_core_firmware_request()
180 void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) in ath11k_core_free_bdf() argument
188 static int ath11k_core_parse_bd_ie_board(struct ath11k_base *ab, in ath11k_core_parse_bd_ie_board() argument
213 ath11k_err(ab, "invalid ATH11K_BD_IE_BOARD length: %zu < %zu\n", in ath11k_core_parse_bd_ie_board()
221 ath11k_dbg_dump(ab, ATH11K_DBG_BOOT, "board name", "", in ath11k_core_parse_bd_ie_board()
232 ath11k_dbg(ab, ATH11K_DBG_BOOT, in ath11k_core_parse_bd_ie_board()
241 ath11k_dbg(ab, ATH11K_DBG_BOOT, in ath11k_core_parse_bd_ie_board()
250 ath11k_warn(ab, "unknown ATH11K_BD_IE_BOARD found: %d\n", in ath11k_core_parse_bd_ie_board()
269 static int ath11k_core_fetch_board_data_api_n(struct ath11k_base *ab, in ath11k_core_fetch_board_data_api_n() argument
283 bd->fw = ath11k_core_firmware_request(ab, filename); in ath11k_core_fetch_board_data_api_n()
291 ath11k_core_create_firmware_path(ab, filename, in ath11k_core_fetch_board_data_api_n()
297 ath11k_err(ab, "failed to find magic value in %s, file too short: %zu\n", in ath11k_core_fetch_board_data_api_n()
304 ath11k_err(ab, "found invalid board magic\n"); in ath11k_core_fetch_board_data_api_n()
312 ath11k_err(ab, "failed: %s too small to contain board data, len: %zu\n", in ath11k_core_fetch_board_data_api_n()
330 ath11k_err(ab, "invalid length for board ie_id %d ie_len %zu len %zu\n", in ath11k_core_fetch_board_data_api_n()
338 ret = ath11k_core_parse_bd_ie_board(ab, bd, data, in ath11k_core_fetch_board_data_api_n()
361 ath11k_err(ab, in ath11k_core_fetch_board_data_api_n()
371 ath11k_core_free_bdf(ab, bd); in ath11k_core_fetch_board_data_api_n()
375 static int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab, in ath11k_core_fetch_board_data_api_1() argument
378 bd->fw = ath11k_core_firmware_request(ab, ATH11K_DEFAULT_BOARD_FILE); in ath11k_core_fetch_board_data_api_1()
389 int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) in ath11k_core_fetch_bdf() argument
394 ret = ath11k_core_create_board_name(ab, boardname, BOARD_NAME_SIZE); in ath11k_core_fetch_bdf()
396 ath11k_err(ab, "failed to create board name: %d", ret); in ath11k_core_fetch_bdf()
400 ab->bd_api = 2; in ath11k_core_fetch_bdf()
401 ret = ath11k_core_fetch_board_data_api_n(ab, bd, boardname); in ath11k_core_fetch_bdf()
405 ab->bd_api = 1; in ath11k_core_fetch_bdf()
406 ret = ath11k_core_fetch_board_data_api_1(ab, bd); in ath11k_core_fetch_bdf()
408 ath11k_err(ab, "failed to fetch board-2.bin or board.bin from %s\n", in ath11k_core_fetch_bdf()
409 ab->hw_params.fw.dir); in ath11k_core_fetch_bdf()
414 ath11k_dbg(ab, ATH11K_DBG_BOOT, "using board api %d\n", ab->bd_api); in ath11k_core_fetch_bdf()
418 static void ath11k_core_stop(struct ath11k_base *ab) in ath11k_core_stop() argument
420 if (!test_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags)) in ath11k_core_stop()
421 ath11k_qmi_firmware_stop(ab); in ath11k_core_stop()
423 ath11k_hif_stop(ab); in ath11k_core_stop()
424 ath11k_wmi_detach(ab); in ath11k_core_stop()
425 ath11k_dp_pdev_reo_cleanup(ab); in ath11k_core_stop()
430 static int ath11k_core_soc_create(struct ath11k_base *ab) in ath11k_core_soc_create() argument
434 ret = ath11k_qmi_init_service(ab); in ath11k_core_soc_create()
436 ath11k_err(ab, "failed to initialize qmi :%d\n", ret); in ath11k_core_soc_create()
440 ret = ath11k_debugfs_soc_create(ab); in ath11k_core_soc_create()
442 ath11k_err(ab, "failed to create ath11k debugfs\n"); in ath11k_core_soc_create()
446 ret = ath11k_hif_power_up(ab); in ath11k_core_soc_create()
448 ath11k_err(ab, "failed to power up :%d\n", ret); in ath11k_core_soc_create()
455 ath11k_debugfs_soc_destroy(ab); in ath11k_core_soc_create()
457 ath11k_qmi_deinit_service(ab); in ath11k_core_soc_create()
461 static void ath11k_core_soc_destroy(struct ath11k_base *ab) in ath11k_core_soc_destroy() argument
463 ath11k_debugfs_soc_destroy(ab); in ath11k_core_soc_destroy()
464 ath11k_dp_free(ab); in ath11k_core_soc_destroy()
465 ath11k_reg_free(ab); in ath11k_core_soc_destroy()
466 ath11k_qmi_deinit_service(ab); in ath11k_core_soc_destroy()
469 static int ath11k_core_pdev_create(struct ath11k_base *ab) in ath11k_core_pdev_create() argument
473 ret = ath11k_debugfs_pdev_create(ab); in ath11k_core_pdev_create()
475 ath11k_err(ab, "failed to create core pdev debugfs: %d\n", ret); in ath11k_core_pdev_create()
479 ret = ath11k_dp_pdev_alloc(ab); in ath11k_core_pdev_create()
481 ath11k_err(ab, "failed to attach DP pdev: %d\n", ret); in ath11k_core_pdev_create()
485 ret = ath11k_mac_register(ab); in ath11k_core_pdev_create()
487 ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret); in ath11k_core_pdev_create()
491 ret = ath11k_thermal_register(ab); in ath11k_core_pdev_create()
493 ath11k_err(ab, "could not register thermal device: %d\n", in ath11k_core_pdev_create()
498 ret = ath11k_spectral_init(ab); in ath11k_core_pdev_create()
500 ath11k_err(ab, "failed to init spectral %d\n", ret); in ath11k_core_pdev_create()
507 ath11k_thermal_unregister(ab); in ath11k_core_pdev_create()
509 ath11k_mac_unregister(ab); in ath11k_core_pdev_create()
511 ath11k_dp_pdev_free(ab); in ath11k_core_pdev_create()
513 ath11k_debugfs_pdev_destroy(ab); in ath11k_core_pdev_create()
518 static void ath11k_core_pdev_destroy(struct ath11k_base *ab) in ath11k_core_pdev_destroy() argument
520 ath11k_spectral_deinit(ab); in ath11k_core_pdev_destroy()
521 ath11k_thermal_unregister(ab); in ath11k_core_pdev_destroy()
522 ath11k_mac_unregister(ab); in ath11k_core_pdev_destroy()
523 ath11k_hif_irq_disable(ab); in ath11k_core_pdev_destroy()
524 ath11k_dp_pdev_free(ab); in ath11k_core_pdev_destroy()
525 ath11k_debugfs_pdev_destroy(ab); in ath11k_core_pdev_destroy()
528 static int ath11k_core_start(struct ath11k_base *ab, in ath11k_core_start() argument
533 ret = ath11k_qmi_firmware_start(ab, mode); in ath11k_core_start()
535 ath11k_err(ab, "failed to attach wmi: %d\n", ret); in ath11k_core_start()
539 ret = ath11k_wmi_attach(ab); in ath11k_core_start()
541 ath11k_err(ab, "failed to attach wmi: %d\n", ret); in ath11k_core_start()
545 ret = ath11k_htc_init(ab); in ath11k_core_start()
547 ath11k_err(ab, "failed to init htc: %d\n", ret); in ath11k_core_start()
551 ret = ath11k_hif_start(ab); in ath11k_core_start()
553 ath11k_err(ab, "failed to start HIF: %d\n", ret); in ath11k_core_start()
557 ret = ath11k_htc_wait_target(&ab->htc); in ath11k_core_start()
559 ath11k_err(ab, "failed to connect to HTC: %d\n", ret); in ath11k_core_start()
563 ret = ath11k_dp_htt_connect(&ab->dp); in ath11k_core_start()
565 ath11k_err(ab, "failed to connect to HTT: %d\n", ret); in ath11k_core_start()
569 ret = ath11k_wmi_connect(ab); in ath11k_core_start()
571 ath11k_err(ab, "failed to connect wmi: %d\n", ret); in ath11k_core_start()
575 ret = ath11k_htc_start(&ab->htc); in ath11k_core_start()
577 ath11k_err(ab, "failed to start HTC: %d\n", ret); in ath11k_core_start()
581 ret = ath11k_wmi_wait_for_service_ready(ab); in ath11k_core_start()
583 ath11k_err(ab, "failed to receive wmi service ready event: %d\n", in ath11k_core_start()
588 ret = ath11k_mac_allocate(ab); in ath11k_core_start()
590 ath11k_err(ab, "failed to create new hw device with mac80211 :%d\n", in ath11k_core_start()
595 ath11k_dp_pdev_pre_alloc(ab); in ath11k_core_start()
597 ret = ath11k_dp_pdev_reo_setup(ab); in ath11k_core_start()
599 ath11k_err(ab, "failed to initialize reo destination rings: %d\n", ret); in ath11k_core_start()
603 ret = ath11k_wmi_cmd_init(ab); in ath11k_core_start()
605 ath11k_err(ab, "failed to send wmi init cmd: %d\n", ret); in ath11k_core_start()
609 ret = ath11k_wmi_wait_for_unified_ready(ab); in ath11k_core_start()
611 ath11k_err(ab, "failed to receive wmi unified ready event: %d\n", in ath11k_core_start()
616 ret = ath11k_dp_tx_htt_h2t_ver_req_msg(ab); in ath11k_core_start()
618 ath11k_err(ab, "failed to send htt version request message: %d\n", in ath11k_core_start()
626 ath11k_dp_pdev_reo_cleanup(ab); in ath11k_core_start()
628 ath11k_mac_destroy(ab); in ath11k_core_start()
630 ath11k_hif_stop(ab); in ath11k_core_start()
632 ath11k_wmi_detach(ab); in ath11k_core_start()
634 ath11k_qmi_firmware_stop(ab); in ath11k_core_start()
639 int ath11k_core_qmi_firmware_ready(struct ath11k_base *ab) in ath11k_core_qmi_firmware_ready() argument
643 ret = ath11k_ce_init_pipes(ab); in ath11k_core_qmi_firmware_ready()
645 ath11k_err(ab, "failed to initialize CE: %d\n", ret); in ath11k_core_qmi_firmware_ready()
649 ret = ath11k_dp_alloc(ab); in ath11k_core_qmi_firmware_ready()
651 ath11k_err(ab, "failed to init DP: %d\n", ret); in ath11k_core_qmi_firmware_ready()
657 set_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags); in ath11k_core_qmi_firmware_ready()
658 set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags); in ath11k_core_qmi_firmware_ready()
661 clear_bit(ATH11K_FLAG_HW_CRYPTO_DISABLED, &ab->dev_flags); in ath11k_core_qmi_firmware_ready()
662 clear_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags); in ath11k_core_qmi_firmware_ready()
665 ath11k_info(ab, "invalid crypto_mode: %d\n", ath11k_crypto_mode); in ath11k_core_qmi_firmware_ready()
670 set_bit(ATH11K_FLAG_RAW_MODE, &ab->dev_flags); in ath11k_core_qmi_firmware_ready()
672 mutex_lock(&ab->core_lock); in ath11k_core_qmi_firmware_ready()
673 ret = ath11k_core_start(ab, ATH11K_FIRMWARE_MODE_NORMAL); in ath11k_core_qmi_firmware_ready()
675 ath11k_err(ab, "failed to start core: %d\n", ret); in ath11k_core_qmi_firmware_ready()
679 ret = ath11k_core_pdev_create(ab); in ath11k_core_qmi_firmware_ready()
681 ath11k_err(ab, "failed to create pdev core: %d\n", ret); in ath11k_core_qmi_firmware_ready()
684 ath11k_hif_irq_enable(ab); in ath11k_core_qmi_firmware_ready()
685 mutex_unlock(&ab->core_lock); in ath11k_core_qmi_firmware_ready()
690 ath11k_core_stop(ab); in ath11k_core_qmi_firmware_ready()
691 ath11k_mac_destroy(ab); in ath11k_core_qmi_firmware_ready()
693 ath11k_dp_free(ab); in ath11k_core_qmi_firmware_ready()
694 mutex_unlock(&ab->core_lock); in ath11k_core_qmi_firmware_ready()
698 static int ath11k_core_reconfigure_on_crash(struct ath11k_base *ab) in ath11k_core_reconfigure_on_crash() argument
702 mutex_lock(&ab->core_lock); in ath11k_core_reconfigure_on_crash()
703 ath11k_thermal_unregister(ab); in ath11k_core_reconfigure_on_crash()
704 ath11k_hif_irq_disable(ab); in ath11k_core_reconfigure_on_crash()
705 ath11k_dp_pdev_free(ab); in ath11k_core_reconfigure_on_crash()
706 ath11k_spectral_deinit(ab); in ath11k_core_reconfigure_on_crash()
707 ath11k_hif_stop(ab); in ath11k_core_reconfigure_on_crash()
708 ath11k_wmi_detach(ab); in ath11k_core_reconfigure_on_crash()
709 ath11k_dp_pdev_reo_cleanup(ab); in ath11k_core_reconfigure_on_crash()
710 mutex_unlock(&ab->core_lock); in ath11k_core_reconfigure_on_crash()
712 ath11k_dp_free(ab); in ath11k_core_reconfigure_on_crash()
713 ath11k_hal_srng_deinit(ab); in ath11k_core_reconfigure_on_crash()
715 ab->free_vdev_map = (1LL << (ab->num_radios * TARGET_NUM_VDEVS)) - 1; in ath11k_core_reconfigure_on_crash()
717 ret = ath11k_hal_srng_init(ab); in ath11k_core_reconfigure_on_crash()
721 clear_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); in ath11k_core_reconfigure_on_crash()
723 ret = ath11k_core_qmi_firmware_ready(ab); in ath11k_core_reconfigure_on_crash()
727 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_core_reconfigure_on_crash()
732 ath11k_hal_srng_deinit(ab); in ath11k_core_reconfigure_on_crash()
738 struct ath11k_base *ab = ar->ab; in ath11k_core_halt() local
750 rcu_assign_pointer(ab->pdevs_active[ar->pdev_idx], NULL); in ath11k_core_halt()
758 struct ath11k_base *ab = container_of(work, struct ath11k_base, restart_work); in ath11k_core_restart() local
763 spin_lock_bh(&ab->base_lock); in ath11k_core_restart()
764 ab->stats.fw_crash_counter++; in ath11k_core_restart()
765 spin_unlock_bh(&ab->base_lock); in ath11k_core_restart()
767 for (i = 0; i < ab->num_radios; i++) { in ath11k_core_restart()
768 pdev = &ab->pdevs[i]; in ath11k_core_restart()
790 wake_up(&ab->wmi_ab.tx_credits_wq); in ath11k_core_restart()
791 wake_up(&ab->peer_mapping_wq); in ath11k_core_restart()
793 ret = ath11k_core_reconfigure_on_crash(ab); in ath11k_core_restart()
795 ath11k_err(ab, "failed to reconfigure driver on crash recovery\n"); in ath11k_core_restart()
799 for (i = 0; i < ab->num_radios; i++) { in ath11k_core_restart()
800 pdev = &ab->pdevs[i]; in ath11k_core_restart()
814 ath11k_warn(ab, in ath11k_core_restart()
824 ath11k_warn(ab, in ath11k_core_restart()
830 complete(&ab->driver_recovery); in ath11k_core_restart()
833 static int ath11k_init_hw_params(struct ath11k_base *ab) in ath11k_init_hw_params() argument
841 if (hw_params->hw_rev == ab->hw_rev) in ath11k_init_hw_params()
846 ath11k_err(ab, "Unsupported hardware version: 0x%x\n", ab->hw_rev); in ath11k_init_hw_params()
850 ab->hw_params = *hw_params; in ath11k_init_hw_params()
852 ath11k_dbg(ab, ATH11K_DBG_BOOT, "Hardware name %s\n", ab->hw_params.name); in ath11k_init_hw_params()
857 int ath11k_core_pre_init(struct ath11k_base *ab) in ath11k_core_pre_init() argument
861 ret = ath11k_init_hw_params(ab); in ath11k_core_pre_init()
863 ath11k_err(ab, "failed to get hw params: %d\n", ret); in ath11k_core_pre_init()
871 int ath11k_core_init(struct ath11k_base *ab) in ath11k_core_init() argument
875 ret = ath11k_core_soc_create(ab); in ath11k_core_init()
877 ath11k_err(ab, "failed to create soc core: %d\n", ret); in ath11k_core_init()
885 void ath11k_core_deinit(struct ath11k_base *ab) in ath11k_core_deinit() argument
887 mutex_lock(&ab->core_lock); in ath11k_core_deinit()
889 ath11k_core_pdev_destroy(ab); in ath11k_core_deinit()
890 ath11k_core_stop(ab); in ath11k_core_deinit()
892 mutex_unlock(&ab->core_lock); in ath11k_core_deinit()
894 ath11k_hif_power_down(ab); in ath11k_core_deinit()
895 ath11k_mac_destroy(ab); in ath11k_core_deinit()
896 ath11k_core_soc_destroy(ab); in ath11k_core_deinit()
900 void ath11k_core_free(struct ath11k_base *ab) in ath11k_core_free() argument
902 kfree(ab); in ath11k_core_free()
910 struct ath11k_base *ab; in ath11k_core_alloc() local
912 ab = kzalloc(sizeof(*ab) + priv_size, GFP_KERNEL); in ath11k_core_alloc()
913 if (!ab) in ath11k_core_alloc()
916 init_completion(&ab->driver_recovery); in ath11k_core_alloc()
918 ab->workqueue = create_singlethread_workqueue("ath11k_wq"); in ath11k_core_alloc()
919 if (!ab->workqueue) in ath11k_core_alloc()
922 mutex_init(&ab->core_lock); in ath11k_core_alloc()
923 spin_lock_init(&ab->base_lock); in ath11k_core_alloc()
925 INIT_LIST_HEAD(&ab->peers); in ath11k_core_alloc()
926 init_waitqueue_head(&ab->peer_mapping_wq); in ath11k_core_alloc()
927 init_waitqueue_head(&ab->wmi_ab.tx_credits_wq); in ath11k_core_alloc()
928 INIT_WORK(&ab->restart_work, ath11k_core_restart); in ath11k_core_alloc()
929 timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0); in ath11k_core_alloc()
930 ab->dev = dev; in ath11k_core_alloc()
931 ab->bus_params = *bus_params; in ath11k_core_alloc()
932 ab->hif.bus = bus; in ath11k_core_alloc()
934 return ab; in ath11k_core_alloc()
937 kfree(ab); in ath11k_core_alloc()