* [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute()
@ 2014-03-11 15:33 Kalle Valo
2014-03-11 15:33 ` [PATCH 2/2] ath10k: check otp.bin result Kalle Valo
2014-03-21 14:49 ` [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Kalle Valo @ 2014-03-11 15:33 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
It's just cleaner to have separate argument for the parameter and result. Also
fix returned error value if response length is invalid.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath10k/bmi.c | 13 ++++++++-----
drivers/net/wireless/ath/ath10k/bmi.h | 2 +-
drivers/net/wireless/ath/ath10k/core.c | 6 ++----
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/bmi.c b/drivers/net/wireless/ath/ath10k/bmi.c
index a1f099628850..17d221abd58c 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -175,7 +175,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar,
return 0;
}
-int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
+int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result)
{
struct bmi_cmd cmd;
union bmi_resp resp;
@@ -184,7 +184,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
int ret;
ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n",
- address, *param);
+ address, param);
if (ar->bmi.done_sent) {
ath10k_warn("command disallowed\n");
@@ -193,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
cmd.id = __cpu_to_le32(BMI_EXECUTE);
cmd.execute.addr = __cpu_to_le32(address);
- cmd.execute.param = __cpu_to_le32(*param);
+ cmd.execute.param = __cpu_to_le32(param);
ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen);
if (ret) {
@@ -204,10 +204,13 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
if (resplen < sizeof(resp.execute)) {
ath10k_warn("invalid execute response length (%d)\n",
resplen);
- return ret;
+ return -EIO;
}
- *param = __le32_to_cpu(resp.execute.result);
+ *result = __le32_to_cpu(resp.execute.result);
+
+ ath10k_dbg(ATH10K_DBG_BMI, "bmi execute result 0x%x\n", *result);
+
return 0;
}
diff --git a/drivers/net/wireless/ath/ath10k/bmi.h b/drivers/net/wireless/ath/ath10k/bmi.h
index 8d81ce1cec21..3a9bdf51c96a 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.h
+++ b/drivers/net/wireless/ath/ath10k/bmi.h
@@ -217,7 +217,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
ret; \
})
-int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param);
+int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 param, u32 *result);
int ath10k_bmi_lz_stream_start(struct ath10k *ar, u32 address);
int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
int ath10k_bmi_fast_download(struct ath10k *ar, u32 address,
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index ebc5fc2ede75..602fb9644cbf 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -249,8 +249,7 @@ exit:
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
- u32 address = ar->hw_params.patch_load_addr;
- u32 exec_param;
+ u32 result, address = ar->hw_params.patch_load_addr;
int ret;
/* OTP is optional */
@@ -264,8 +263,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
goto exit;
}
- exec_param = 0;
- ret = ath10k_bmi_execute(ar, address, &exec_param);
+ ret = ath10k_bmi_execute(ar, address, 0, &result);
if (ret) {
ath10k_err("could not execute otp (%d)\n", ret);
goto exit;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ath10k: check otp.bin result
2014-03-11 15:33 [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
@ 2014-03-11 15:33 ` Kalle Valo
2014-03-11 17:10 ` Kalle Valo
2014-03-21 14:49 ` [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2014-03-11 15:33 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
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>
---
drivers/net/wireless/ath/ath10k/core.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 602fb9644cbf..e8f419144db6 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -254,23 +254,34 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
/* 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;
+ }
+
+ ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %d\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);
- goto exit;
+ return ret;
}
ret = ath10k_bmi_execute(ar, address, 0, &result);
if (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)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ath10k: check otp.bin result
2014-03-11 15:33 ` [PATCH 2/2] ath10k: check otp.bin result Kalle Valo
@ 2014-03-11 17:10 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2014-03-11 17:10 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> 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>
> ---
> drivers/net/wireless/ath/ath10k/core.c | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index 602fb9644cbf..e8f419144db6 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -254,23 +254,34 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
>
> /* 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;
> + }
> +
> + ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %d\n",
> + address, ar->otp_len);
This one introduces a warning:
>> drivers/net/wireless/ath/ath10k/core.c:263:6: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=]
address, ar->otp_len);
I fixed it to this:
ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n",
address, ar->otp_len);
--
Kalle Valo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute()
2014-03-11 15:33 [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
2014-03-11 15:33 ` [PATCH 2/2] ath10k: check otp.bin result Kalle Valo
@ 2014-03-21 14:49 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2014-03-21 14:49 UTC (permalink / raw)
To: ath10k; +Cc: linux-wireless
Kalle Valo <kvalo@qca.qualcomm.com> writes:
> It's just cleaner to have separate argument for the parameter and result. Also
> fix returned error value if response length is invalid.
>
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Both patches applied.
--
Kalle Valo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-21 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 15:33 [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
2014-03-11 15:33 ` [PATCH 2/2] ath10k: check otp.bin result Kalle Valo
2014-03-11 17:10 ` Kalle Valo
2014-03-21 14:49 ` [PATCH 1/2] ath10k: separate result parameter in ath10k_bmi_execute() Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).