Lines Matching refs:ar

251 static int ath6kl_set_host_app_area(struct ath6kl *ar)  in ath6kl_set_host_app_area()  argument
258 address = ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_app_host_interest)); in ath6kl_set_host_app_area()
259 address = TARG_VTOP(ar->target_type, address); in ath6kl_set_host_app_area()
261 if (ath6kl_diag_read32(ar, address, &data)) in ath6kl_set_host_app_area()
264 address = TARG_VTOP(ar->target_type, data); in ath6kl_set_host_app_area()
266 if (ath6kl_diag_write(ar, address, (u8 *) &host_app_area, in ath6kl_set_host_app_area()
273 static inline void set_ac2_ep_map(struct ath6kl *ar, in set_ac2_ep_map() argument
277 ar->ac2ep_map[ac] = ep; in set_ac2_ep_map()
278 ar->ep2ac_map[ep] = ac; in set_ac2_ep_map()
282 static int ath6kl_connectservice(struct ath6kl *ar, in ath6kl_connectservice() argument
291 status = ath6kl_htc_conn_service(ar->htc_target, con_req, &response); in ath6kl_connectservice()
300 if (test_bit(WMI_ENABLED, &ar->flag)) in ath6kl_connectservice()
301 ath6kl_wmi_set_control_ep(ar->wmi, response.endpoint); in ath6kl_connectservice()
302 ar->ctrl_ep = response.endpoint; in ath6kl_connectservice()
305 set_ac2_ep_map(ar, WMM_AC_BE, response.endpoint); in ath6kl_connectservice()
308 set_ac2_ep_map(ar, WMM_AC_BK, response.endpoint); in ath6kl_connectservice()
311 set_ac2_ep_map(ar, WMM_AC_VI, response.endpoint); in ath6kl_connectservice()
314 set_ac2_ep_map(ar, WMM_AC_VO, response.endpoint); in ath6kl_connectservice()
324 static int ath6kl_init_service_ep(struct ath6kl *ar) in ath6kl_init_service_ep() argument
347 if (ath6kl_connectservice(ar, &connect, "WMI CONTROL")) in ath6kl_init_service_ep()
377 if (ath6kl_connectservice(ar, &connect, "WMI DATA BE")) in ath6kl_init_service_ep()
382 if (ath6kl_connectservice(ar, &connect, "WMI DATA BK")) in ath6kl_init_service_ep()
387 if (ath6kl_connectservice(ar, &connect, "WMI DATA VI")) in ath6kl_init_service_ep()
398 if (ath6kl_connectservice(ar, &connect, "WMI DATA VO")) in ath6kl_init_service_ep()
416 static int ath6kl_set_htc_params(struct ath6kl *ar, u32 mbox_isr_yield_val, in ath6kl_set_htc_params() argument
422 blk_size = ar->mbox_info.block_size; in ath6kl_set_htc_params()
428 status = ath6kl_bmi_write_hi32(ar, hi_mbox_io_block_sz, blk_size); in ath6kl_set_htc_params()
436 ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_mbox_io_block_sz))); in ath6kl_set_htc_params()
440 status = ath6kl_bmi_write_hi32(ar, hi_mbox_isr_yield_limit, in ath6kl_set_htc_params()
452 static int ath6kl_target_config_wlan_params(struct ath6kl *ar, int idx) in ath6kl_target_config_wlan_params() argument
461 ret = ath6kl_wmi_set_rx_frame_format_cmd(ar->wmi, idx, in ath6kl_target_config_wlan_params()
462 ar->rx_meta_ver, 0, 0); in ath6kl_target_config_wlan_params()
468 if (ar->conf_flags & ATH6KL_CONF_IGNORE_PS_FAIL_EVT_IN_SCAN) { in ath6kl_target_config_wlan_params()
469 ret = ath6kl_wmi_pmparams_cmd(ar->wmi, idx, 0, 1, 0, 0, 1, in ath6kl_target_config_wlan_params()
478 if (!(ar->conf_flags & ATH6KL_CONF_IGNORE_ERP_BARKER)) { in ath6kl_target_config_wlan_params()
479 ret = ath6kl_wmi_set_lpreamble_cmd(ar->wmi, idx, 0, in ath6kl_target_config_wlan_params()
488 ret = ath6kl_wmi_set_keepalive_cmd(ar->wmi, idx, in ath6kl_target_config_wlan_params()
495 ret = ath6kl_wmi_disctimeout_cmd(ar->wmi, idx, in ath6kl_target_config_wlan_params()
502 if (!(ar->conf_flags & ATH6KL_CONF_ENABLE_TX_BURST)) { in ath6kl_target_config_wlan_params()
503 ret = ath6kl_wmi_set_wmm_txop(ar->wmi, idx, WMI_TXOP_DISABLED); in ath6kl_target_config_wlan_params()
510 if (ar->p2p && (ar->vif_max == 1 || idx)) { in ath6kl_target_config_wlan_params()
511 ret = ath6kl_wmi_info_req_cmd(ar->wmi, idx, in ath6kl_target_config_wlan_params()
519 ar->p2p = false; in ath6kl_target_config_wlan_params()
523 if (ar->p2p && (ar->vif_max == 1 || idx)) { in ath6kl_target_config_wlan_params()
525 ret = ath6kl_wmi_probe_report_req_cmd(ar->wmi, idx, true); in ath6kl_target_config_wlan_params()
536 int ath6kl_configure_target(struct ath6kl *ar) in ath6kl_configure_target() argument
542 param = !!(ar->conf_flags & ATH6KL_CONF_UART_DEBUG); in ath6kl_configure_target()
543 if (ath6kl_bmi_write_hi32(ar, hi_serial_enable, param)) { in ath6kl_configure_target()
558 for (i = 0; i < ar->vif_max; i++) in ath6kl_configure_target()
571 ar->fw_capabilities)) { in ath6kl_configure_target()
572 for (i = 0; i < ar->vif_max; i++) in ath6kl_configure_target()
576 for (i = 0; i < ar->max_norm_iface; i++) in ath6kl_configure_target()
580 for (i = ar->max_norm_iface; i < ar->vif_max; i++) in ath6kl_configure_target()
584 if (ar->p2p && ar->vif_max == 1) in ath6kl_configure_target()
588 if (ath6kl_bmi_write_hi32(ar, hi_app_host_interest, in ath6kl_configure_target()
597 if (ath6kl_bmi_read_hi32(ar, hi_option_flag, &param) != 0) { in ath6kl_configure_target()
602 param |= (ar->vif_max << HI_OPTION_NUM_DEV_SHIFT); in ath6kl_configure_target()
609 if (ath6kl_bmi_write_hi32(ar, hi_option_flag, param) != 0) { in ath6kl_configure_target()
625 if ((ar->target_type == TARGET_TYPE_AR6003) || in ath6kl_configure_target()
626 (ar->version.target_ver == AR6004_HW_1_3_VERSION) || in ath6kl_configure_target()
627 (ar->version.target_ver == AR6004_HW_3_0_VERSION)) { in ath6kl_configure_target()
628 param = ar->hw.board_ext_data_addr; in ath6kl_configure_target()
629 ram_reserved_size = ar->hw.reserved_ram_size; in ath6kl_configure_target()
631 if (ath6kl_bmi_write_hi32(ar, hi_board_ext_data, param) != 0) { in ath6kl_configure_target()
636 if (ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, in ath6kl_configure_target()
644 if (ath6kl_set_htc_params(ar, MBOX_YIELD_LIMIT, 0)) in ath6kl_configure_target()
649 status = ath6kl_bmi_write_hi32(ar, hi_dbg_uart_txpin, in ath6kl_configure_target()
650 ar->hw.uarttx_pin); in ath6kl_configure_target()
655 if (ar->conf_flags & ATH6KL_CONF_UART_DEBUG) { in ath6kl_configure_target()
656 status = ath6kl_bmi_write_hi32(ar, hi_desired_baud_rate, in ath6kl_configure_target()
657 ar->hw.uarttx_rate); in ath6kl_configure_target()
663 if (ar->hw.refclk_hz != 0) { in ath6kl_configure_target()
664 status = ath6kl_bmi_write_hi32(ar, hi_refclk_hz, in ath6kl_configure_target()
665 ar->hw.refclk_hz); in ath6kl_configure_target()
674 static int ath6kl_get_fw(struct ath6kl *ar, const char *filename, in ath6kl_get_fw() argument
680 ret = request_firmware(&fw_entry, filename, ar->dev); in ath6kl_get_fw()
702 static bool check_device_tree(struct ath6kl *ar) in check_device_tree() argument
718 "%s/bdata.%s.bin", ar->hw.fw.dir, board_id); in check_device_tree()
720 ret = ath6kl_get_fw(ar, board_filename, &ar->fw_board, in check_device_tree()
721 &ar->fw_board_len); in check_device_tree()
733 static bool check_device_tree(struct ath6kl *ar) in check_device_tree() argument
739 static int ath6kl_fetch_board_file(struct ath6kl *ar) in ath6kl_fetch_board_file() argument
744 if (ar->fw_board != NULL) in ath6kl_fetch_board_file()
747 if (WARN_ON(ar->hw.fw_board == NULL)) in ath6kl_fetch_board_file()
750 filename = ar->hw.fw_board; in ath6kl_fetch_board_file()
752 ret = ath6kl_get_fw(ar, filename, &ar->fw_board, in ath6kl_fetch_board_file()
753 &ar->fw_board_len); in ath6kl_fetch_board_file()
759 if (check_device_tree(ar)) { in ath6kl_fetch_board_file()
768 filename = ar->hw.fw_default_board; in ath6kl_fetch_board_file()
770 ret = ath6kl_get_fw(ar, filename, &ar->fw_board, in ath6kl_fetch_board_file()
771 &ar->fw_board_len); in ath6kl_fetch_board_file()
784 static int ath6kl_fetch_otp_file(struct ath6kl *ar) in ath6kl_fetch_otp_file() argument
789 if (ar->fw_otp != NULL) in ath6kl_fetch_otp_file()
792 if (ar->hw.fw.otp == NULL) { in ath6kl_fetch_otp_file()
799 ar->hw.fw.dir, ar->hw.fw.otp); in ath6kl_fetch_otp_file()
801 ret = ath6kl_get_fw(ar, filename, &ar->fw_otp, in ath6kl_fetch_otp_file()
802 &ar->fw_otp_len); in ath6kl_fetch_otp_file()
812 static int ath6kl_fetch_testmode_file(struct ath6kl *ar) in ath6kl_fetch_testmode_file() argument
817 if (ar->testmode == 0) in ath6kl_fetch_testmode_file()
820 ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", ar->testmode); in ath6kl_fetch_testmode_file()
822 if (ar->testmode == 2) { in ath6kl_fetch_testmode_file()
823 if (ar->hw.fw.utf == NULL) { in ath6kl_fetch_testmode_file()
829 ar->hw.fw.dir, ar->hw.fw.utf); in ath6kl_fetch_testmode_file()
831 if (ar->hw.fw.tcmd == NULL) { in ath6kl_fetch_testmode_file()
837 ar->hw.fw.dir, ar->hw.fw.tcmd); in ath6kl_fetch_testmode_file()
840 set_bit(TESTMODE, &ar->flag); in ath6kl_fetch_testmode_file()
842 ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); in ath6kl_fetch_testmode_file()
845 ar->testmode, filename, ret); in ath6kl_fetch_testmode_file()
852 static int ath6kl_fetch_fw_file(struct ath6kl *ar) in ath6kl_fetch_fw_file() argument
857 if (ar->fw != NULL) in ath6kl_fetch_fw_file()
861 if (WARN_ON(ar->hw.fw.fw == NULL)) in ath6kl_fetch_fw_file()
865 ar->hw.fw.dir, ar->hw.fw.fw); in ath6kl_fetch_fw_file()
867 ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); in ath6kl_fetch_fw_file()
877 static int ath6kl_fetch_patch_file(struct ath6kl *ar) in ath6kl_fetch_patch_file() argument
882 if (ar->fw_patch != NULL) in ath6kl_fetch_patch_file()
885 if (ar->hw.fw.patch == NULL) in ath6kl_fetch_patch_file()
889 ar->hw.fw.dir, ar->hw.fw.patch); in ath6kl_fetch_patch_file()
891 ret = ath6kl_get_fw(ar, filename, &ar->fw_patch, in ath6kl_fetch_patch_file()
892 &ar->fw_patch_len); in ath6kl_fetch_patch_file()
902 static int ath6kl_fetch_testscript_file(struct ath6kl *ar) in ath6kl_fetch_testscript_file() argument
907 if (ar->testmode != 2) in ath6kl_fetch_testscript_file()
910 if (ar->fw_testscript != NULL) in ath6kl_fetch_testscript_file()
913 if (ar->hw.fw.testscript == NULL) in ath6kl_fetch_testscript_file()
917 ar->hw.fw.dir, ar->hw.fw.testscript); in ath6kl_fetch_testscript_file()
919 ret = ath6kl_get_fw(ar, filename, &ar->fw_testscript, in ath6kl_fetch_testscript_file()
920 &ar->fw_testscript_len); in ath6kl_fetch_testscript_file()
930 static int ath6kl_fetch_fw_api1(struct ath6kl *ar) in ath6kl_fetch_fw_api1() argument
934 ret = ath6kl_fetch_otp_file(ar); in ath6kl_fetch_fw_api1()
938 ret = ath6kl_fetch_fw_file(ar); in ath6kl_fetch_fw_api1()
942 ret = ath6kl_fetch_patch_file(ar); in ath6kl_fetch_fw_api1()
946 ret = ath6kl_fetch_testscript_file(ar); in ath6kl_fetch_fw_api1()
953 static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) in ath6kl_fetch_fw_apin() argument
963 snprintf(filename, sizeof(filename), "%s/%s", ar->hw.fw.dir, name); in ath6kl_fetch_fw_apin()
965 ret = request_firmware(&fw, filename, ar->dev); in ath6kl_fetch_fw_apin()
1017 strscpy(ar->wiphy->fw_version, data, in ath6kl_fetch_fw_apin()
1018 min(sizeof(ar->wiphy->fw_version), ie_len+1)); in ath6kl_fetch_fw_apin()
1022 ar->wiphy->fw_version); in ath6kl_fetch_fw_apin()
1028 ar->fw_otp = kmemdup(data, ie_len, GFP_KERNEL); in ath6kl_fetch_fw_apin()
1030 if (ar->fw_otp == NULL) { in ath6kl_fetch_fw_apin()
1036 ar->fw_otp_len = ie_len; in ath6kl_fetch_fw_apin()
1043 if (ar->fw != NULL) in ath6kl_fetch_fw_apin()
1046 ar->fw = vmalloc(ie_len); in ath6kl_fetch_fw_apin()
1048 if (ar->fw == NULL) { in ath6kl_fetch_fw_apin()
1054 memcpy(ar->fw, data, ie_len); in ath6kl_fetch_fw_apin()
1055 ar->fw_len = ie_len; in ath6kl_fetch_fw_apin()
1061 ar->fw_patch = kmemdup(data, ie_len, GFP_KERNEL); in ath6kl_fetch_fw_apin()
1063 if (ar->fw_patch == NULL) { in ath6kl_fetch_fw_apin()
1069 ar->fw_patch_len = ie_len; in ath6kl_fetch_fw_apin()
1073 ar->hw.reserved_ram_size = le32_to_cpup(val); in ath6kl_fetch_fw_apin()
1077 ar->hw.reserved_ram_size); in ath6kl_fetch_fw_apin()
1092 __set_bit(i, ar->fw_capabilities); in ath6kl_fetch_fw_apin()
1096 ar->fw_capabilities, in ath6kl_fetch_fw_apin()
1097 sizeof(ar->fw_capabilities)); in ath6kl_fetch_fw_apin()
1104 ar->hw.dataset_patch_addr = le32_to_cpup(val); in ath6kl_fetch_fw_apin()
1108 ar->hw.dataset_patch_addr); in ath6kl_fetch_fw_apin()
1115 ar->hw.board_addr = le32_to_cpup(val); in ath6kl_fetch_fw_apin()
1119 ar->hw.board_addr); in ath6kl_fetch_fw_apin()
1126 ar->vif_max = min_t(unsigned int, le32_to_cpup(val), in ath6kl_fetch_fw_apin()
1129 if (ar->vif_max > 1 && !ar->p2p) in ath6kl_fetch_fw_apin()
1130 ar->max_norm_iface = 2; in ath6kl_fetch_fw_apin()
1133 "found vif max ie %d\n", ar->vif_max); in ath6kl_fetch_fw_apin()
1152 int ath6kl_init_fetch_firmwares(struct ath6kl *ar) in ath6kl_init_fetch_firmwares() argument
1156 ret = ath6kl_fetch_board_file(ar); in ath6kl_init_fetch_firmwares()
1160 ret = ath6kl_fetch_testmode_file(ar); in ath6kl_init_fetch_firmwares()
1164 ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API5_FILE); in ath6kl_init_fetch_firmwares()
1166 ar->fw_api = 5; in ath6kl_init_fetch_firmwares()
1170 ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API4_FILE); in ath6kl_init_fetch_firmwares()
1172 ar->fw_api = 4; in ath6kl_init_fetch_firmwares()
1176 ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API3_FILE); in ath6kl_init_fetch_firmwares()
1178 ar->fw_api = 3; in ath6kl_init_fetch_firmwares()
1182 ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API2_FILE); in ath6kl_init_fetch_firmwares()
1184 ar->fw_api = 2; in ath6kl_init_fetch_firmwares()
1188 ret = ath6kl_fetch_fw_api1(ar); in ath6kl_init_fetch_firmwares()
1192 ar->fw_api = 1; in ath6kl_init_fetch_firmwares()
1195 ath6kl_dbg(ATH6KL_DBG_BOOT, "using fw api %d\n", ar->fw_api); in ath6kl_init_fetch_firmwares()
1200 static int ath6kl_upload_board_file(struct ath6kl *ar) in ath6kl_upload_board_file() argument
1206 if (WARN_ON(ar->fw_board == NULL)) in ath6kl_upload_board_file()
1214 if (ar->hw.board_addr != 0) { in ath6kl_upload_board_file()
1215 board_address = ar->hw.board_addr; in ath6kl_upload_board_file()
1216 ath6kl_bmi_write_hi32(ar, hi_board_data, in ath6kl_upload_board_file()
1219 ret = ath6kl_bmi_read_hi32(ar, hi_board_data, &board_address); in ath6kl_upload_board_file()
1227 ret = ath6kl_bmi_read_hi32(ar, hi_board_ext_data, &board_ext_address); in ath6kl_upload_board_file()
1233 if (ar->target_type == TARGET_TYPE_AR6003 && in ath6kl_upload_board_file()
1239 switch (ar->target_type) { in ath6kl_upload_board_file()
1243 if (ar->fw_board_len > (board_data_size + board_ext_data_size)) in ath6kl_upload_board_file()
1256 ar->fw_board_len == (board_data_size + board_ext_data_size)) { in ath6kl_upload_board_file()
1262 ret = ath6kl_bmi_write(ar, board_ext_address, in ath6kl_upload_board_file()
1263 ar->fw_board + board_data_size, in ath6kl_upload_board_file()
1274 ath6kl_bmi_write_hi32(ar, hi_board_ext_data_config, param); in ath6kl_upload_board_file()
1277 if (ar->fw_board_len < board_data_size) { in ath6kl_upload_board_file()
1278 ath6kl_err("Too small board file: %zu\n", ar->fw_board_len); in ath6kl_upload_board_file()
1286 ret = ath6kl_bmi_write(ar, board_address, ar->fw_board, in ath6kl_upload_board_file()
1295 if ((ar->version.target_ver == AR6004_HW_1_3_VERSION) || in ath6kl_upload_board_file()
1296 (ar->version.target_ver == AR6004_HW_3_0_VERSION)) in ath6kl_upload_board_file()
1301 ath6kl_bmi_write_hi32(ar, hi_board_data_initialized, param); in ath6kl_upload_board_file()
1306 static int ath6kl_upload_otp(struct ath6kl *ar) in ath6kl_upload_otp() argument
1312 if (ar->fw_otp == NULL) in ath6kl_upload_otp()
1315 address = ar->hw.app_load_addr; in ath6kl_upload_otp()
1318 ar->fw_otp_len); in ath6kl_upload_otp()
1320 ret = ath6kl_bmi_fast_download(ar, address, ar->fw_otp, in ath6kl_upload_otp()
1321 ar->fw_otp_len); in ath6kl_upload_otp()
1328 ret = ath6kl_bmi_read_hi32(ar, hi_app_start, &address); in ath6kl_upload_otp()
1335 if (ar->hw.app_start_override_addr == 0) { in ath6kl_upload_otp()
1336 ar->hw.app_start_override_addr = address; in ath6kl_upload_otp()
1342 ar->hw.app_start_override_addr); in ath6kl_upload_otp()
1346 ar->hw.app_start_override_addr); in ath6kl_upload_otp()
1348 ath6kl_bmi_execute(ar, ar->hw.app_start_override_addr, &param); in ath6kl_upload_otp()
1353 static int ath6kl_upload_firmware(struct ath6kl *ar) in ath6kl_upload_firmware() argument
1358 if (WARN_ON(ar->fw == NULL)) in ath6kl_upload_firmware()
1361 address = ar->hw.app_load_addr; in ath6kl_upload_firmware()
1364 address, ar->fw_len); in ath6kl_upload_firmware()
1366 ret = ath6kl_bmi_fast_download(ar, address, ar->fw, ar->fw_len); in ath6kl_upload_firmware()
1377 if (ar->target_type != TARGET_TYPE_AR6004) { in ath6kl_upload_firmware()
1378 address = ar->hw.app_start_override_addr; in ath6kl_upload_firmware()
1379 ath6kl_bmi_set_app_start(ar, address); in ath6kl_upload_firmware()
1384 static int ath6kl_upload_patch(struct ath6kl *ar) in ath6kl_upload_patch() argument
1389 if (ar->fw_patch == NULL) in ath6kl_upload_patch()
1392 address = ar->hw.dataset_patch_addr; in ath6kl_upload_patch()
1395 address, ar->fw_patch_len); in ath6kl_upload_patch()
1397 ret = ath6kl_bmi_write(ar, address, ar->fw_patch, ar->fw_patch_len); in ath6kl_upload_patch()
1403 ath6kl_bmi_write_hi32(ar, hi_dset_list_head, address); in ath6kl_upload_patch()
1408 static int ath6kl_upload_testscript(struct ath6kl *ar) in ath6kl_upload_testscript() argument
1413 if (ar->testmode != 2) in ath6kl_upload_testscript()
1416 if (ar->fw_testscript == NULL) in ath6kl_upload_testscript()
1419 address = ar->hw.testscript_addr; in ath6kl_upload_testscript()
1422 address, ar->fw_testscript_len); in ath6kl_upload_testscript()
1424 ret = ath6kl_bmi_write(ar, address, ar->fw_testscript, in ath6kl_upload_testscript()
1425 ar->fw_testscript_len); in ath6kl_upload_testscript()
1431 ath6kl_bmi_write_hi32(ar, hi_ota_testscript, address); in ath6kl_upload_testscript()
1433 if ((ar->version.target_ver != AR6004_HW_1_3_VERSION) && in ath6kl_upload_testscript()
1434 (ar->version.target_ver != AR6004_HW_3_0_VERSION)) in ath6kl_upload_testscript()
1435 ath6kl_bmi_write_hi32(ar, hi_end_ram_reserve_sz, 4096); in ath6kl_upload_testscript()
1437 ath6kl_bmi_write_hi32(ar, hi_test_apps_related, 1); in ath6kl_upload_testscript()
1442 static int ath6kl_init_upload(struct ath6kl *ar) in ath6kl_init_upload() argument
1447 if (ar->target_type != TARGET_TYPE_AR6003 && in ath6kl_init_upload()
1448 ar->target_type != TARGET_TYPE_AR6004) in ath6kl_init_upload()
1453 status = ath6kl_bmi_reg_read(ar, address, &param); in ath6kl_init_upload()
1460 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1465 status = ath6kl_bmi_reg_read(ar, address, &param); in ath6kl_init_upload()
1472 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1481 if (ar->target_type != TARGET_TYPE_AR6004) { in ath6kl_init_upload()
1482 status = ath6kl_bmi_reg_write(ar, ATH6KL_ANALOG_PLL_REGISTER, in ath6kl_init_upload()
1492 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1500 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1505 if (ar->hw.flags & ATH6KL_HW_SDIO_CRC_ERROR_WAR) { in ath6kl_init_upload()
1510 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1517 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1522 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1527 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1532 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1538 status = ath6kl_upload_board_file(ar); in ath6kl_init_upload()
1543 status = ath6kl_upload_otp(ar); in ath6kl_init_upload()
1548 status = ath6kl_upload_firmware(ar); in ath6kl_init_upload()
1552 status = ath6kl_upload_patch(ar); in ath6kl_init_upload()
1557 status = ath6kl_upload_testscript(ar); in ath6kl_init_upload()
1563 status = ath6kl_bmi_reg_write(ar, address, sleep); in ath6kl_init_upload()
1569 status = ath6kl_bmi_reg_write(ar, address, param); in ath6kl_init_upload()
1576 int ath6kl_init_hw_params(struct ath6kl *ar) in ath6kl_init_hw_params() argument
1584 if (hw->id == ar->version.target_ver) in ath6kl_init_hw_params()
1590 ar->version.target_ver); in ath6kl_init_hw_params()
1594 ar->hw = *hw; in ath6kl_init_hw_params()
1598 ar->version.target_ver, ar->target_type, in ath6kl_init_hw_params()
1599 ar->hw.dataset_patch_addr, ar->hw.app_load_addr); in ath6kl_init_hw_params()
1602 ar->hw.app_start_override_addr, ar->hw.board_ext_data_addr, in ath6kl_init_hw_params()
1603 ar->hw.reserved_ram_size); in ath6kl_init_hw_params()
1606 ar->hw.refclk_hz, ar->hw.uarttx_pin); in ath6kl_init_hw_params()
1661 static void ath6kl_init_get_fwcaps(struct ath6kl *ar, char *buf, size_t buf_len) in ath6kl_init_get_fwcaps() argument
1663 u8 *data = (u8 *) ar->fw_capabilities; in ath6kl_init_get_fwcaps()
1672 if (index >= sizeof(ar->fw_capabilities) * 4) in ath6kl_init_get_fwcaps()
1698 static int ath6kl_init_hw_reset(struct ath6kl *ar) in ath6kl_init_hw_reset() argument
1702 return ath6kl_diag_write32(ar, RESET_CONTROL_ADDRESS, in ath6kl_init_hw_reset()
1706 static int __ath6kl_init_hw_start(struct ath6kl *ar) in __ath6kl_init_hw_start() argument
1714 ret = ath6kl_hif_power_on(ar); in __ath6kl_init_hw_start()
1718 ret = ath6kl_configure_target(ar); in __ath6kl_init_hw_start()
1722 ret = ath6kl_init_upload(ar); in __ath6kl_init_hw_start()
1727 ret = ath6kl_bmi_done(ar); in __ath6kl_init_hw_start()
1736 ret = ath6kl_htc_wait_target(ar->htc_target); in __ath6kl_init_hw_start()
1746 ath6kl_init_hw_reset(ar); in __ath6kl_init_hw_start()
1753 ret = ath6kl_init_service_ep(ar); in __ath6kl_init_hw_start()
1760 ath6kl_htc_credit_setup(ar->htc_target, &ar->credit_state_info); in __ath6kl_init_hw_start()
1763 ret = ath6kl_htc_start(ar->htc_target); in __ath6kl_init_hw_start()
1766 ath6kl_cookie_cleanup(ar); in __ath6kl_init_hw_start()
1771 timeleft = wait_event_interruptible_timeout(ar->event_wq, in __ath6kl_init_hw_start()
1773 &ar->flag), in __ath6kl_init_hw_start()
1776 clear_bit(WMI_READY, &ar->flag); in __ath6kl_init_hw_start()
1785 if (test_and_clear_bit(FIRST_BOOT, &ar->flag)) { in __ath6kl_init_hw_start()
1787 ar->hw.name, in __ath6kl_init_hw_start()
1788 ath6kl_init_get_hif_name(ar->hif_type), in __ath6kl_init_hw_start()
1789 ar->wiphy->fw_version, in __ath6kl_init_hw_start()
1790 ar->fw_api, in __ath6kl_init_hw_start()
1791 test_bit(TESTMODE, &ar->flag) ? " testmode" : ""); in __ath6kl_init_hw_start()
1792 ath6kl_init_get_fwcaps(ar, buf, sizeof(buf)); in __ath6kl_init_hw_start()
1796 if (ar->version.abi_ver != ATH6KL_ABI_VERSION) { in __ath6kl_init_hw_start()
1798 ATH6KL_ABI_VERSION, ar->version.abi_ver); in __ath6kl_init_hw_start()
1807 if ((ath6kl_set_host_app_area(ar)) != 0) in __ath6kl_init_hw_start()
1810 for (i = 0; i < ar->vif_max; i++) { in __ath6kl_init_hw_start()
1811 ret = ath6kl_target_config_wlan_params(ar, i); in __ath6kl_init_hw_start()
1819 ath6kl_htc_stop(ar->htc_target); in __ath6kl_init_hw_start()
1821 ath6kl_hif_cleanup_scatter(ar); in __ath6kl_init_hw_start()
1823 ath6kl_hif_power_off(ar); in __ath6kl_init_hw_start()
1828 int ath6kl_init_hw_start(struct ath6kl *ar) in ath6kl_init_hw_start() argument
1832 err = __ath6kl_init_hw_start(ar); in ath6kl_init_hw_start()
1835 ar->state = ATH6KL_STATE_ON; in ath6kl_init_hw_start()
1839 static int __ath6kl_init_hw_stop(struct ath6kl *ar) in __ath6kl_init_hw_stop() argument
1845 ath6kl_htc_stop(ar->htc_target); in __ath6kl_init_hw_stop()
1847 ath6kl_hif_stop(ar); in __ath6kl_init_hw_stop()
1849 ath6kl_bmi_reset(ar); in __ath6kl_init_hw_stop()
1851 ret = ath6kl_hif_power_off(ar); in __ath6kl_init_hw_stop()
1858 int ath6kl_init_hw_stop(struct ath6kl *ar) in ath6kl_init_hw_stop() argument
1862 err = __ath6kl_init_hw_stop(ar); in ath6kl_init_hw_stop()
1865 ar->state = ATH6KL_STATE_OFF; in ath6kl_init_hw_stop()
1869 void ath6kl_init_hw_restart(struct ath6kl *ar) in ath6kl_init_hw_restart() argument
1871 clear_bit(WMI_READY, &ar->flag); in ath6kl_init_hw_restart()
1873 ath6kl_cfg80211_stop_all(ar); in ath6kl_init_hw_restart()
1875 if (__ath6kl_init_hw_stop(ar)) { in ath6kl_init_hw_restart()
1880 if (__ath6kl_init_hw_start(ar)) { in ath6kl_init_hw_restart()
1886 void ath6kl_stop_txrx(struct ath6kl *ar) in ath6kl_stop_txrx() argument
1891 set_bit(DESTROY_IN_PROGRESS, &ar->flag); in ath6kl_stop_txrx()
1893 if (down_interruptible(&ar->sem)) { in ath6kl_stop_txrx()
1899 aggr_reset_state(ar->sta_list[i].aggr_conn); in ath6kl_stop_txrx()
1901 spin_lock_bh(&ar->list_lock); in ath6kl_stop_txrx()
1902 list_for_each_entry_safe(vif, tmp_vif, &ar->vif_list, list) { in ath6kl_stop_txrx()
1904 spin_unlock_bh(&ar->list_lock); in ath6kl_stop_txrx()
1905 ath6kl_cfg80211_vif_stop(vif, test_bit(WMI_READY, &ar->flag)); in ath6kl_stop_txrx()
1907 wiphy_lock(ar->wiphy); in ath6kl_stop_txrx()
1909 wiphy_unlock(ar->wiphy); in ath6kl_stop_txrx()
1911 spin_lock_bh(&ar->list_lock); in ath6kl_stop_txrx()
1913 spin_unlock_bh(&ar->list_lock); in ath6kl_stop_txrx()
1915 clear_bit(WMI_READY, &ar->flag); in ath6kl_stop_txrx()
1917 if (ar->fw_recovery.enable) in ath6kl_stop_txrx()
1918 del_timer_sync(&ar->fw_recovery.hb_timer); in ath6kl_stop_txrx()
1929 ath6kl_wmi_shutdown(ar->wmi); in ath6kl_stop_txrx()
1931 clear_bit(WMI_ENABLED, &ar->flag); in ath6kl_stop_txrx()
1932 if (ar->htc_target) { in ath6kl_stop_txrx()
1934 ath6kl_htc_stop(ar->htc_target); in ath6kl_stop_txrx()
1941 ath6kl_init_hw_reset(ar); in ath6kl_stop_txrx()
1943 up(&ar->sem); in ath6kl_stop_txrx()