Commit 53c02284 authored by Ben Greear's avatar Ben Greear Committed by Kalle Valo

ath10k: better firmware loading error messages

Let user know the name of the board file if it is not
found, and make it easier to determine the firmware
api being used.
Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent be6546fc
...@@ -398,8 +398,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ...@@ -398,8 +398,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
/* first fetch the firmware file (firmware-*.bin) */ /* first fetch the firmware file (firmware-*.bin) */
ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name); ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name);
if (IS_ERR(ar->firmware)) { if (IS_ERR(ar->firmware)) {
ath10k_err("Could not fetch firmware file '%s': %ld\n", ath10k_err("could not fetch firmware file '%s/%s': %ld\n",
name, PTR_ERR(ar->firmware)); ar->hw_params.fw.dir, name, PTR_ERR(ar->firmware));
return PTR_ERR(ar->firmware); return PTR_ERR(ar->firmware);
} }
...@@ -410,14 +410,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ...@@ -410,14 +410,14 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1; magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
if (len < magic_len) { if (len < magic_len) {
ath10k_err("firmware image too small to contain magic: %zu\n", ath10k_err("firmware file '%s/%s' too small to contain magic: %zu\n",
len); ar->hw_params.fw.dir, name, len);
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) { if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
ath10k_err("Invalid firmware magic\n"); ath10k_err("invalid firmware magic\n");
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
...@@ -439,7 +439,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ...@@ -439,7 +439,7 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
data += sizeof(*hdr); data += sizeof(*hdr);
if (len < ie_len) { if (len < ie_len) {
ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n", ath10k_err("invalid length for FW IE %d (%zu < %zu)\n",
ie_id, len, ie_len); ie_id, len, ie_len);
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
...@@ -522,8 +522,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ...@@ -522,8 +522,8 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
} }
if (!ar->firmware_data || !ar->firmware_len) { if (!ar->firmware_data || !ar->firmware_len) {
ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from %s, skipping\n", ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from '%s/%s', skipping\n",
name); ar->hw_params.fw.dir, name);
ret = -ENOMEDIUM; ret = -ENOMEDIUM;
goto err; goto err;
} }
...@@ -540,7 +540,9 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name) ...@@ -540,7 +540,9 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
ar->hw_params.fw.board); ar->hw_params.fw.board);
if (IS_ERR(ar->board)) { if (IS_ERR(ar->board)) {
ret = PTR_ERR(ar->board); ret = PTR_ERR(ar->board);
ath10k_err("could not fetch board data (%d)\n", ret); ath10k_err("could not fetch board data '%s/%s' (%d)\n",
ar->hw_params.fw.dir, ar->hw_params.fw.board,
ret);
goto err; goto err;
} }
...@@ -558,19 +560,21 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar) ...@@ -558,19 +560,21 @@ static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
{ {
int ret; int ret;
ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE);
if (ret == 0) {
ar->fw_api = 2; ar->fw_api = 2;
goto out; ath10k_dbg(ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
}
ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE);
if (ret == 0)
goto success;
ar->fw_api = 1;
ath10k_dbg(ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
ret = ath10k_core_fetch_firmware_api_1(ar); ret = ath10k_core_fetch_firmware_api_1(ar);
if (ret) if (ret)
return ret; return ret;
ar->fw_api = 1; success:
out:
ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api); ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment