static bool suspend_cutpower;
static unsigned int uart_debug;
static unsigned int ath6kl_p2p;
+static unsigned int testmode;
module_param(debug_mask, uint, 0644);
module_param(suspend_cutpower, bool, 0444);
module_param(uart_debug, uint, 0644);
module_param(ath6kl_p2p, uint, 0644);
+module_param(testmode, uint, 0644);
int ath6kl_core_init(struct ath6kl *ar)
{
goto err_power_off;
}
+ ar->testmode = testmode;
+
ret = ath6kl_init_fetch_firmwares(ar);
if (ret)
goto err_htc_cleanup;
#include "debug.h"
#include "hif-ops.h"
-static unsigned int testmode;
-
-module_param(testmode, uint, 0644);
-
static const struct ath6kl_hw hw_list[] = {
{
.id = AR6003_HW_2_0_VERSION,
return 0;
}
-static int ath6kl_fetch_fw_file(struct ath6kl *ar)
+static int ath6kl_fetch_testmode_file(struct ath6kl *ar)
{
char filename[100];
int ret;
- if (ar->fw != NULL)
+ if (ar->testmode == 0)
return 0;
- if (testmode) {
- ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n",
- testmode);
- if (testmode == 2) {
- if (ar->hw.fw.utf == NULL) {
- ath6kl_warn("testmode 2 not supported\n");
- return -EOPNOTSUPP;
- }
+ ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", ar->testmode);
- snprintf(filename, sizeof(filename), "%s/%s",
- ar->hw.fw.dir, ar->hw.fw.utf);
- } else {
- if (ar->hw.fw.tcmd == NULL) {
- ath6kl_warn("testmode 1 not supported\n");
- return -EOPNOTSUPP;
- }
+ if (ar->testmode == 2) {
+ if (ar->hw.fw.utf == NULL) {
+ ath6kl_warn("testmode 2 not supported\n");
+ return -EOPNOTSUPP;
+ }
- snprintf(filename, sizeof(filename), "%s/%s",
- ar->hw.fw.dir, ar->hw.fw.tcmd);
+ snprintf(filename, sizeof(filename), "%s/%s",
+ ar->hw.fw.dir, ar->hw.fw.utf);
+ } else {
+ if (ar->hw.fw.tcmd == NULL) {
+ ath6kl_warn("testmode 1 not supported\n");
+ return -EOPNOTSUPP;
}
- set_bit(TESTMODE, &ar->flag);
- goto get_fw;
+ snprintf(filename, sizeof(filename), "%s/%s",
+ ar->hw.fw.dir, ar->hw.fw.tcmd);
}
+ set_bit(TESTMODE, &ar->flag);
+
+ ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len);
+ if (ret) {
+ ath6kl_err("Failed to get testmode %d firmware file %s: %d\n",
+ ar->testmode, filename, ret);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int ath6kl_fetch_fw_file(struct ath6kl *ar)
+{
+ char filename[100];
+ int ret;
+
+ if (ar->fw != NULL)
+ return 0;
+
/* FIXME: remove WARN_ON() as we won't support FW API 1 for long */
if (WARN_ON(ar->hw.fw.fw == NULL))
return -EINVAL;
snprintf(filename, sizeof(filename), "%s/%s",
ar->hw.fw.dir, ar->hw.fw.fw);
-get_fw:
ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len);
if (ret) {
ath6kl_err("Failed to get firmware file %s: %d\n",
char filename[100];
int ret;
- if (testmode != 2)
+ if (ar->testmode != 2)
return 0;
if (ar->fw_testscript != NULL)
ath6kl_dbg(ATH6KL_DBG_BOOT, "found fw image ie (%zd B)\n",
ie_len);
+ /* in testmode we already might have a fw file */
+ if (ar->fw != NULL)
+ break;
+
ar->fw = kmemdup(data, ie_len, GFP_KERNEL);
if (ar->fw == NULL) {
if (ret)
return ret;
+ ret = ath6kl_fetch_testmode_file(ar);
+ if (ret)
+ return ret;
+
ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API3_FILE);
if (ret == 0) {
ar->fw_api = 3;
u32 address, param;
int ret;
- if (testmode != 2)
+ if (ar->testmode != 2)
return 0;
if (ar->fw_testscript == NULL)