Commit d6d4a58d authored by Kalle Valo's avatar Kalle Valo

ath10k: separate result parameter in ath10k_bmi_execute()

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: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent b5a63788
...@@ -175,7 +175,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, ...@@ -175,7 +175,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar,
return 0; 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; struct bmi_cmd cmd;
union bmi_resp resp; union bmi_resp resp;
...@@ -184,7 +184,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) ...@@ -184,7 +184,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
int ret; int ret;
ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n", ath10k_dbg(ATH10K_DBG_BMI, "bmi execute address 0x%x param 0x%x\n",
address, *param); address, param);
if (ar->bmi.done_sent) { if (ar->bmi.done_sent) {
ath10k_warn("command disallowed\n"); ath10k_warn("command disallowed\n");
...@@ -193,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) ...@@ -193,7 +193,7 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
cmd.id = __cpu_to_le32(BMI_EXECUTE); cmd.id = __cpu_to_le32(BMI_EXECUTE);
cmd.execute.addr = __cpu_to_le32(address); 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); ret = ath10k_hif_exchange_bmi_msg(ar, &cmd, cmdlen, &resp, &resplen);
if (ret) { if (ret) {
...@@ -204,10 +204,13 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param) ...@@ -204,10 +204,13 @@ int ath10k_bmi_execute(struct ath10k *ar, u32 address, u32 *param)
if (resplen < sizeof(resp.execute)) { if (resplen < sizeof(resp.execute)) {
ath10k_warn("invalid execute response length (%d)\n", ath10k_warn("invalid execute response length (%d)\n",
resplen); 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; return 0;
} }
......
...@@ -217,7 +217,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address, ...@@ -217,7 +217,7 @@ int ath10k_bmi_write_memory(struct ath10k *ar, u32 address,
ret; \ 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_stream_start(struct ath10k *ar, u32 address);
int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length); int ath10k_bmi_lz_data(struct ath10k *ar, const void *buffer, u32 length);
int ath10k_bmi_fast_download(struct ath10k *ar, u32 address, int ath10k_bmi_fast_download(struct ath10k *ar, u32 address,
......
...@@ -249,8 +249,7 @@ static int ath10k_download_board_data(struct ath10k *ar) ...@@ -249,8 +249,7 @@ static int ath10k_download_board_data(struct ath10k *ar)
static int ath10k_download_and_run_otp(struct ath10k *ar) static int ath10k_download_and_run_otp(struct ath10k *ar)
{ {
u32 address = ar->hw_params.patch_load_addr; u32 result, address = ar->hw_params.patch_load_addr;
u32 exec_param;
int ret; int ret;
/* OTP is optional */ /* OTP is optional */
...@@ -264,8 +263,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar) ...@@ -264,8 +263,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
goto exit; goto exit;
} }
exec_param = 0; ret = ath10k_bmi_execute(ar, address, 0, &result);
ret = ath10k_bmi_execute(ar, address, &exec_param);
if (ret) { if (ret) {
ath10k_err("could not execute otp (%d)\n", ret); ath10k_err("could not execute otp (%d)\n", ret);
goto exit; goto exit;
......
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