aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRakesh Pillai <pillair@qti.qualcomm.com>2017-12-21 11:16:49 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2017-12-27 05:08:55 -0500
commit71e9c29fbd28ec14bb8f920c7afd515a75c00234 (patch)
treee9da0f78e3e2b9b3eedb49e38f83bda7c6789b00
parentb796240409b3f576ae8ebbad9b5679ff2fb5a39c (diff)
ath10k: Add fw feature flag for non-bmi firmware load
HL1.0 firmware is not loaded via bmi. The bmi specific code should not be executed for HL1.0 Add fw feature flag for non bmi targets and skip the bmi specific code for non bmi targets. Signed-off-by: Rakesh Pillai <pillair@qti.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/core.c180
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h3
2 files changed, 108 insertions, 75 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 3c530d9ae9c7..e5e78a4cacde 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -471,6 +471,7 @@ static const char *const ath10k_core_fw_feature_str[] = {
471 [ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST] = "allows-mesh-bcast", 471 [ATH10K_FW_FEATURE_ALLOWS_MESH_BCAST] = "allows-mesh-bcast",
472 [ATH10K_FW_FEATURE_NO_PS] = "no-ps", 472 [ATH10K_FW_FEATURE_NO_PS] = "no-ps",
473 [ATH10K_FW_FEATURE_MGMT_TX_BY_REF] = "mgmt-tx-by-reference", 473 [ATH10K_FW_FEATURE_MGMT_TX_BY_REF] = "mgmt-tx-by-reference",
474 [ATH10K_FW_FEATURE_NON_BMI] = "non-bmi",
474}; 475};
475 476
476static unsigned int ath10k_core_get_fw_feature_str(char *buf, 477static unsigned int ath10k_core_get_fw_feature_str(char *buf,
@@ -1550,8 +1551,8 @@ int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
1550 data += ie_len; 1551 data += ie_len;
1551 } 1552 }
1552 1553
1553 if (!fw_file->firmware_data || 1554 if (!test_bit(ATH10K_FW_FEATURE_NON_BMI, fw_file->fw_features) &&
1554 !fw_file->firmware_len) { 1555 (!fw_file->firmware_data || !fw_file->firmware_len)) {
1555 ath10k_warn(ar, "No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n", 1556 ath10k_warn(ar, "No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n",
1556 ar->hw_params.fw.dir, name); 1557 ar->hw_params.fw.dir, name);
1557 ret = -ENOMEDIUM; 1558 ret = -ENOMEDIUM;
@@ -2105,43 +2106,47 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2105 2106
2106 ar->running_fw = fw; 2107 ar->running_fw = fw;
2107 2108
2108 ath10k_bmi_start(ar); 2109 if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
2110 ar->running_fw->fw_file.fw_features)) {
2111 ath10k_bmi_start(ar);
2109 2112
2110 if (ath10k_init_configure_target(ar)) { 2113 if (ath10k_init_configure_target(ar)) {
2111 status = -EINVAL; 2114 status = -EINVAL;
2112 goto err; 2115 goto err;
2113 } 2116 }
2114
2115 status = ath10k_download_cal_data(ar);
2116 if (status)
2117 goto err;
2118 2117
2119 /* Some of of qca988x solutions are having global reset issue 2118 status = ath10k_download_cal_data(ar);
2120 * during target initialization. Bypassing PLL setting before 2119 if (status)
2121 * downloading firmware and letting the SoC run on REF_CLK is
2122 * fixing the problem. Corresponding firmware change is also needed
2123 * to set the clock source once the target is initialized.
2124 */
2125 if (test_bit(ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT,
2126 ar->running_fw->fw_file.fw_features)) {
2127 status = ath10k_bmi_write32(ar, hi_skip_clock_init, 1);
2128 if (status) {
2129 ath10k_err(ar, "could not write to skip_clock_init: %d\n",
2130 status);
2131 goto err; 2120 goto err;
2121
2122 /* Some of of qca988x solutions are having global reset issue
2123 * during target initialization. Bypassing PLL setting before
2124 * downloading firmware and letting the SoC run on REF_CLK is
2125 * fixing the problem. Corresponding firmware change is also
2126 * needed to set the clock source once the target is
2127 * initialized.
2128 */
2129 if (test_bit(ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT,
2130 ar->running_fw->fw_file.fw_features)) {
2131 status = ath10k_bmi_write32(ar, hi_skip_clock_init, 1);
2132 if (status) {
2133 ath10k_err(ar, "could not write to skip_clock_init: %d\n",
2134 status);
2135 goto err;
2136 }
2132 } 2137 }
2133 }
2134 2138
2135 status = ath10k_download_fw(ar); 2139 status = ath10k_download_fw(ar);
2136 if (status) 2140 if (status)
2137 goto err; 2141 goto err;
2138 2142
2139 status = ath10k_init_uart(ar); 2143 status = ath10k_init_uart(ar);
2140 if (status) 2144 if (status)
2141 goto err; 2145 goto err;
2142 2146
2143 if (ar->hif.bus == ATH10K_BUS_SDIO) 2147 if (ar->hif.bus == ATH10K_BUS_SDIO)
2144 ath10k_init_sdio(ar); 2148 ath10k_init_sdio(ar);
2149 }
2145 2150
2146 ar->htc.htc_ops.target_send_suspend_complete = 2151 ar->htc.htc_ops.target_send_suspend_complete =
2147 ath10k_send_suspend_complete; 2152 ath10k_send_suspend_complete;
@@ -2152,9 +2157,12 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
2152 goto err; 2157 goto err;
2153 } 2158 }
2154 2159
2155 status = ath10k_bmi_done(ar); 2160 if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
2156 if (status) 2161 ar->running_fw->fw_file.fw_features)) {
2157 goto err; 2162 status = ath10k_bmi_done(ar);
2163 if (status)
2164 goto err;
2165 }
2158 2166
2159 status = ath10k_wmi_attach(ar); 2167 status = ath10k_wmi_attach(ar);
2160 if (status) { 2168 if (status) {
@@ -2397,19 +2405,34 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
2397 return ret; 2405 return ret;
2398 } 2406 }
2399 2407
2400 memset(&target_info, 0, sizeof(target_info)); 2408 switch (ar->hif.bus) {
2401 if (ar->hif.bus == ATH10K_BUS_SDIO) 2409 case ATH10K_BUS_SDIO:
2410 memset(&target_info, 0, sizeof(target_info));
2402 ret = ath10k_bmi_get_target_info_sdio(ar, &target_info); 2411 ret = ath10k_bmi_get_target_info_sdio(ar, &target_info);
2403 else 2412 if (ret) {
2413 ath10k_err(ar, "could not get target info (%d)\n", ret);
2414 goto err_power_down;
2415 }
2416 ar->target_version = target_info.version;
2417 ar->hw->wiphy->hw_version = target_info.version;
2418 break;
2419 case ATH10K_BUS_PCI:
2420 case ATH10K_BUS_AHB:
2421 memset(&target_info, 0, sizeof(target_info));
2404 ret = ath10k_bmi_get_target_info(ar, &target_info); 2422 ret = ath10k_bmi_get_target_info(ar, &target_info);
2405 if (ret) { 2423 if (ret) {
2406 ath10k_err(ar, "could not get target info (%d)\n", ret); 2424 ath10k_err(ar, "could not get target info (%d)\n", ret);
2407 goto err_power_down; 2425 goto err_power_down;
2426 }
2427 ar->target_version = target_info.version;
2428 ar->hw->wiphy->hw_version = target_info.version;
2429 break;
2430 case ATH10K_BUS_SNOC:
2431 break;
2432 default:
2433 ath10k_err(ar, "incorrect hif bus type: %d\n", ar->hif.bus);
2408 } 2434 }
2409 2435
2410 ar->target_version = target_info.version;
2411 ar->hw->wiphy->hw_version = target_info.version;
2412
2413 ret = ath10k_init_hw_params(ar); 2436 ret = ath10k_init_hw_params(ar);
2414 if (ret) { 2437 if (ret) {
2415 ath10k_err(ar, "could not get hw params (%d)\n", ret); 2438 ath10k_err(ar, "could not get hw params (%d)\n", ret);
@@ -2429,37 +2452,40 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
2429 2452
2430 ath10k_debug_print_hwfw_info(ar); 2453 ath10k_debug_print_hwfw_info(ar);
2431 2454
2432 ret = ath10k_core_pre_cal_download(ar); 2455 if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
2433 if (ret) { 2456 ar->normal_mode_fw.fw_file.fw_features)) {
2434 /* pre calibration data download is not necessary 2457 ret = ath10k_core_pre_cal_download(ar);
2435 * for all the chipsets. Ignore failures and continue. 2458 if (ret) {
2436 */ 2459 /* pre calibration data download is not necessary
2437 ath10k_dbg(ar, ATH10K_DBG_BOOT, 2460 * for all the chipsets. Ignore failures and continue.
2438 "could not load pre cal data: %d\n", ret); 2461 */
2439 } 2462 ath10k_dbg(ar, ATH10K_DBG_BOOT,
2463 "could not load pre cal data: %d\n", ret);
2464 }
2440 2465
2441 ret = ath10k_core_get_board_id_from_otp(ar); 2466 ret = ath10k_core_get_board_id_from_otp(ar);
2442 if (ret && ret != -EOPNOTSUPP) { 2467 if (ret && ret != -EOPNOTSUPP) {
2443 ath10k_err(ar, "failed to get board id from otp: %d\n", 2468 ath10k_err(ar, "failed to get board id from otp: %d\n",
2444 ret); 2469 ret);
2445 goto err_free_firmware_files; 2470 goto err_free_firmware_files;
2446 } 2471 }
2447 2472
2448 ret = ath10k_core_check_smbios(ar); 2473 ret = ath10k_core_check_smbios(ar);
2449 if (ret) 2474 if (ret)
2450 ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); 2475 ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n");
2451 2476
2452 ret = ath10k_core_check_dt(ar); 2477 ret = ath10k_core_check_dt(ar);
2453 if (ret) 2478 if (ret)
2454 ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); 2479 ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n");
2455 2480
2456 ret = ath10k_core_fetch_board_file(ar); 2481 ret = ath10k_core_fetch_board_file(ar);
2457 if (ret) { 2482 if (ret) {
2458 ath10k_err(ar, "failed to fetch board file: %d\n", ret); 2483 ath10k_err(ar, "failed to fetch board file: %d\n", ret);
2459 goto err_free_firmware_files; 2484 goto err_free_firmware_files;
2460 } 2485 }
2461 2486
2462 ath10k_debug_print_board_info(ar); 2487 ath10k_debug_print_board_info(ar);
2488 }
2463 2489
2464 ret = ath10k_core_init_firmware_features(ar); 2490 ret = ath10k_core_init_firmware_features(ar);
2465 if (ret) { 2491 if (ret) {
@@ -2468,11 +2494,15 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
2468 goto err_free_firmware_files; 2494 goto err_free_firmware_files;
2469 } 2495 }
2470 2496
2471 ret = ath10k_swap_code_seg_init(ar, &ar->normal_mode_fw.fw_file); 2497 if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
2472 if (ret) { 2498 ar->normal_mode_fw.fw_file.fw_features)) {
2473 ath10k_err(ar, "failed to initialize code swap segment: %d\n", 2499 ret = ath10k_swap_code_seg_init(ar,
2474 ret); 2500 &ar->normal_mode_fw.fw_file);
2475 goto err_free_firmware_files; 2501 if (ret) {
2502 ath10k_err(ar, "failed to initialize code swap segment: %d\n",
2503 ret);
2504 goto err_free_firmware_files;
2505 }
2476 } 2506 }
2477 2507
2478 mutex_lock(&ar->conf_mutex); 2508 mutex_lock(&ar->conf_mutex);
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 86d8f44237a6..6ed40f341461 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -619,6 +619,9 @@ enum ath10k_fw_features {
619 /* Firmware allows management tx by reference instead of by value. */ 619 /* Firmware allows management tx by reference instead of by value. */
620 ATH10K_FW_FEATURE_MGMT_TX_BY_REF = 18, 620 ATH10K_FW_FEATURE_MGMT_TX_BY_REF = 18,
621 621
622 /* Firmware load is done externally, not by bmi */
623 ATH10K_FW_FEATURE_NON_BMI = 19,
624
622 /* keep last */ 625 /* keep last */
623 ATH10K_FW_FEATURE_COUNT, 626 ATH10K_FW_FEATURE_COUNT,
624}; 627};