Răsfoiți Sursa

ath10k: check otp.bin result

When we execute otp.bin in the target check that the result it returns doesn't
contain an error. This is to make sure that we don't accidentally use invalid
calibration data.

While at it, remove the useless label in the function and add few debug messages.

Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Kalle Valo 11 ani în urmă
părinte
comite
7f06ea1e79
1 a modificat fișierele cu 16 adăugiri și 5 ștergeri
  1. 16 5
      drivers/net/wireless/ath/ath10k/core.c

+ 16 - 5
drivers/net/wireless/ath/ath10k/core.c

@@ -254,23 +254,34 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
 
 
 	/* OTP is optional */
 	/* OTP is optional */
 
 
-	if (!ar->otp_data || !ar->otp_len)
+	if (!ar->otp_data || !ar->otp_len) {
+		ath10k_warn("Not running otp, calibration will be incorrect!\n");
 		return 0;
 		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);
 	ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
 	if (ret) {
 	if (ret) {
 		ath10k_err("could not write otp (%d)\n", ret);
 		ath10k_err("could not write otp (%d)\n", ret);
-		goto exit;
+		return ret;
 	}
 	}
 
 
 	ret = ath10k_bmi_execute(ar, address, 0, &result);
 	ret = ath10k_bmi_execute(ar, address, 0, &result);
 	if (ret) {
 	if (ret) {
 		ath10k_err("could not execute otp (%d)\n", ret);
 		ath10k_err("could not execute otp (%d)\n", ret);
-		goto exit;
+		return ret;
 	}
 	}
 
 
-exit:
-	return ret;
+	ath10k_dbg(ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
+
+	if (result != 0) {
+		ath10k_err("otp calibration failed: %d", result);
+		return -EINVAL;
+	}
+
+	return 0;
 }
 }
 
 
 static int ath10k_download_fw(struct ath10k *ar)
 static int ath10k_download_fw(struct ath10k *ar)