Ejemplo n.º 1
0
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
	u32 address = ar->hw_params.patch_load_addr;
	u32 exec_param;
	int ret;

	/* OTP is optional */

	if (!ar->otp_data || !ar->otp_len)
		return 0;

	ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
	if (ret) {
		ath10k_err("could not write otp (%d)\n", ret);
		goto exit;
	}

	exec_param = 0;
	ret = ath10k_bmi_execute(ar, address, &exec_param);
	if (ret) {
		ath10k_err("could not execute otp (%d)\n", ret);
		goto exit;
	}

exit:
	return ret;
}
Ejemplo n.º 2
0
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
	u32 result, address = ar->hw_params.patch_load_addr;
	u32 bmi_otp_exe_param = ar->hw_params.otp_exe_param;
	int ret;

	ret = ath10k_download_board_data(ar, ar->board_data, ar->board_len);
	if (ret) {
		ath10k_err(ar, "failed to download board data: %d\n", ret);
		return ret;
	}

	/* OTP is optional */

	if (!ar->otp_data || !ar->otp_len) {
		ath10k_warn(ar, "Not running otp, calibration will be incorrect (otp-data %p otp_len %zd)!\n",
			    ar->otp_data, ar->otp_len);
		return 0;
	}

	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n",
		   address, ar->otp_len);

	ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
	if (ret) {
		ath10k_err(ar, "could not write otp (%d)\n", ret);
		return ret;
	}

	ret = ath10k_bmi_execute(ar, address, bmi_otp_exe_param, &result);
	if (ret) {
		ath10k_err(ar, "could not execute otp (%d)\n", ret);
		return ret;
	}

	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);

	if (!(skip_otp || test_bit(ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
				   ar->fw_features))
	    && result != 0) {
		ath10k_err(ar, "otp calibration failed: %d", result);
		return -EINVAL;
	}

	return 0;
}
Ejemplo n.º 3
0
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
    u32 result, address = ar->hw_params.patch_load_addr;
    int ret;

    /* OTP is optional */

    if (!ar->otp_data || !ar->otp_len) {
        ath10k_warn("Not running otp, calibration will be incorrect (otp-data %p otp_len %zd)!\n",
                    ar->otp_data, ar->otp_len);
        return 0;
    }

    ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n",
               address, ar->otp_len);

    ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
    if (ret) {
        ath10k_err("could not write otp (%d)\n", ret);
        return ret;
    }

    ret = ath10k_bmi_execute(ar, address, 0, &result);
    if (ret) {
        ath10k_err("could not execute otp (%d)\n", ret);
        return ret;
    }

    ath10k_dbg(ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);

    if (result == 2) {
        ath10k_warn("otp stream is empty, using board.bin contents");
        return 0;
    } else if (result != 0) {
        ath10k_err("otp calibration failed: %d", result);
        return -EINVAL;
    }

    return 0;
}
Ejemplo n.º 4
0
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
	const struct firmware *fw;
	u32 address;
	u32 exec_param;
	int ret;

	/* OTP is optional */

	if (ar->hw_params.fw.otp == NULL) {
		ath10k_info("otp file not defined\n");
		return 0;
	}

	address = ar->hw_params.patch_load_addr;

	fw = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir,
				  ar->hw_params.fw.otp);
	if (IS_ERR(fw)) {
		ath10k_warn("could not fetch otp (%ld)\n", PTR_ERR(fw));
		return 0;
	}

	ret = ath10k_bmi_fast_download(ar, address, fw->data, fw->size);
	if (ret) {
		ath10k_err("could not write otp (%d)\n", ret);
		goto exit;
	}

	exec_param = 0;
	ret = ath10k_bmi_execute(ar, address, &exec_param);
	if (ret) {
		ath10k_err("could not execute otp (%d)\n", ret);
		goto exit;
	}

exit:
	release_firmware(fw);
	return ret;
}