diff options
author | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-01-24 06:50:16 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-01-30 14:08:45 -0500 |
commit | 5f1127ffbae3029fde5dc1464ec3c26cdf34cb80 (patch) | |
tree | 9509a7ecde4beae63629036a94e4a2eb2de768da | |
parent | 1d2a4456de20db73362c86c88fe9c02169f29d0a (diff) |
ath6kl: fix testmode when fw-2.bin or fw-3.bin is used
Testmode (TCMD and ART) was not enabled when fw-2.bin or fw-3.bin files
were available, fix that by fetching testmode file just after the
board file but before rest of the firmware files are fetched.
I also added testmode field to struct ath6kl and moved the module parameter
to core.c. Now all module parameters are grouped in one place.
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 74 |
3 files changed, 51 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c index 0d92e7179f8a..2a5198185d57 100644 --- a/drivers/net/wireless/ath/ath6kl/core.c +++ b/drivers/net/wireless/ath/ath6kl/core.c | |||
@@ -28,11 +28,13 @@ unsigned int debug_mask; | |||
28 | static bool suspend_cutpower; | 28 | static bool suspend_cutpower; |
29 | static unsigned int uart_debug; | 29 | static unsigned int uart_debug; |
30 | static unsigned int ath6kl_p2p; | 30 | static unsigned int ath6kl_p2p; |
31 | static unsigned int testmode; | ||
31 | 32 | ||
32 | module_param(debug_mask, uint, 0644); | 33 | module_param(debug_mask, uint, 0644); |
33 | module_param(suspend_cutpower, bool, 0444); | 34 | module_param(suspend_cutpower, bool, 0444); |
34 | module_param(uart_debug, uint, 0644); | 35 | module_param(uart_debug, uint, 0644); |
35 | module_param(ath6kl_p2p, uint, 0644); | 36 | module_param(ath6kl_p2p, uint, 0644); |
37 | module_param(testmode, uint, 0644); | ||
36 | 38 | ||
37 | int ath6kl_core_init(struct ath6kl *ar) | 39 | int ath6kl_core_init(struct ath6kl *ar) |
38 | { | 40 | { |
@@ -76,6 +78,8 @@ int ath6kl_core_init(struct ath6kl *ar) | |||
76 | goto err_power_off; | 78 | goto err_power_off; |
77 | } | 79 | } |
78 | 80 | ||
81 | ar->testmode = testmode; | ||
82 | |||
79 | ret = ath6kl_init_fetch_firmwares(ar); | 83 | ret = ath6kl_init_fetch_firmwares(ar); |
80 | if (ret) | 84 | if (ret) |
81 | goto err_htc_cleanup; | 85 | goto err_htc_cleanup; |
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index ed9fcc11b5fc..7f1869d00d70 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -532,6 +532,7 @@ struct ath6kl { | |||
532 | struct wiphy *wiphy; | 532 | struct wiphy *wiphy; |
533 | 533 | ||
534 | enum ath6kl_state state; | 534 | enum ath6kl_state state; |
535 | unsigned int testmode; | ||
535 | 536 | ||
536 | struct ath6kl_bmi bmi; | 537 | struct ath6kl_bmi bmi; |
537 | const struct ath6kl_hif_ops *hif_ops; | 538 | const struct ath6kl_hif_ops *hif_ops; |
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 4d8eb1cca6e9..bf56e5f17618 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -27,10 +27,6 @@ | |||
27 | #include "debug.h" | 27 | #include "debug.h" |
28 | #include "hif-ops.h" | 28 | #include "hif-ops.h" |
29 | 29 | ||
30 | static unsigned int testmode; | ||
31 | |||
32 | module_param(testmode, uint, 0644); | ||
33 | |||
34 | static const struct ath6kl_hw hw_list[] = { | 30 | static const struct ath6kl_hw hw_list[] = { |
35 | { | 31 | { |
36 | .id = AR6003_HW_2_0_VERSION, | 32 | .id = AR6003_HW_2_0_VERSION, |
@@ -731,39 +727,54 @@ static int ath6kl_fetch_otp_file(struct ath6kl *ar) | |||
731 | return 0; | 727 | return 0; |
732 | } | 728 | } |
733 | 729 | ||
734 | static int ath6kl_fetch_fw_file(struct ath6kl *ar) | 730 | static int ath6kl_fetch_testmode_file(struct ath6kl *ar) |
735 | { | 731 | { |
736 | char filename[100]; | 732 | char filename[100]; |
737 | int ret; | 733 | int ret; |
738 | 734 | ||
739 | if (ar->fw != NULL) | 735 | if (ar->testmode == 0) |
740 | return 0; | 736 | return 0; |
741 | 737 | ||
742 | if (testmode) { | 738 | ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", ar->testmode); |
743 | ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", | ||
744 | testmode); | ||
745 | if (testmode == 2) { | ||
746 | if (ar->hw.fw.utf == NULL) { | ||
747 | ath6kl_warn("testmode 2 not supported\n"); | ||
748 | return -EOPNOTSUPP; | ||
749 | } | ||
750 | 739 | ||
751 | snprintf(filename, sizeof(filename), "%s/%s", | 740 | if (ar->testmode == 2) { |
752 | ar->hw.fw.dir, ar->hw.fw.utf); | 741 | if (ar->hw.fw.utf == NULL) { |
753 | } else { | 742 | ath6kl_warn("testmode 2 not supported\n"); |
754 | if (ar->hw.fw.tcmd == NULL) { | 743 | return -EOPNOTSUPP; |
755 | ath6kl_warn("testmode 1 not supported\n"); | 744 | } |
756 | return -EOPNOTSUPP; | ||
757 | } | ||
758 | 745 | ||
759 | snprintf(filename, sizeof(filename), "%s/%s", | 746 | snprintf(filename, sizeof(filename), "%s/%s", |
760 | ar->hw.fw.dir, ar->hw.fw.tcmd); | 747 | ar->hw.fw.dir, ar->hw.fw.utf); |
748 | } else { | ||
749 | if (ar->hw.fw.tcmd == NULL) { | ||
750 | ath6kl_warn("testmode 1 not supported\n"); | ||
751 | return -EOPNOTSUPP; | ||
761 | } | 752 | } |
762 | set_bit(TESTMODE, &ar->flag); | ||
763 | 753 | ||
764 | goto get_fw; | 754 | snprintf(filename, sizeof(filename), "%s/%s", |
755 | ar->hw.fw.dir, ar->hw.fw.tcmd); | ||
765 | } | 756 | } |
766 | 757 | ||
758 | set_bit(TESTMODE, &ar->flag); | ||
759 | |||
760 | ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); | ||
761 | if (ret) { | ||
762 | ath6kl_err("Failed to get testmode %d firmware file %s: %d\n", | ||
763 | ar->testmode, filename, ret); | ||
764 | return ret; | ||
765 | } | ||
766 | |||
767 | return 0; | ||
768 | } | ||
769 | |||
770 | static int ath6kl_fetch_fw_file(struct ath6kl *ar) | ||
771 | { | ||
772 | char filename[100]; | ||
773 | int ret; | ||
774 | |||
775 | if (ar->fw != NULL) | ||
776 | return 0; | ||
777 | |||
767 | /* FIXME: remove WARN_ON() as we won't support FW API 1 for long */ | 778 | /* FIXME: remove WARN_ON() as we won't support FW API 1 for long */ |
768 | if (WARN_ON(ar->hw.fw.fw == NULL)) | 779 | if (WARN_ON(ar->hw.fw.fw == NULL)) |
769 | return -EINVAL; | 780 | return -EINVAL; |
@@ -771,7 +782,6 @@ static int ath6kl_fetch_fw_file(struct ath6kl *ar) | |||
771 | snprintf(filename, sizeof(filename), "%s/%s", | 782 | snprintf(filename, sizeof(filename), "%s/%s", |
772 | ar->hw.fw.dir, ar->hw.fw.fw); | 783 | ar->hw.fw.dir, ar->hw.fw.fw); |
773 | 784 | ||
774 | get_fw: | ||
775 | ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); | 785 | ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); |
776 | if (ret) { | 786 | if (ret) { |
777 | ath6kl_err("Failed to get firmware file %s: %d\n", | 787 | ath6kl_err("Failed to get firmware file %s: %d\n", |
@@ -812,7 +822,7 @@ static int ath6kl_fetch_testscript_file(struct ath6kl *ar) | |||
812 | char filename[100]; | 822 | char filename[100]; |
813 | int ret; | 823 | int ret; |
814 | 824 | ||
815 | if (testmode != 2) | 825 | if (ar->testmode != 2) |
816 | return 0; | 826 | return 0; |
817 | 827 | ||
818 | if (ar->fw_testscript != NULL) | 828 | if (ar->fw_testscript != NULL) |
@@ -927,6 +937,10 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name) | |||
927 | ath6kl_dbg(ATH6KL_DBG_BOOT, "found fw image ie (%zd B)\n", | 937 | ath6kl_dbg(ATH6KL_DBG_BOOT, "found fw image ie (%zd B)\n", |
928 | ie_len); | 938 | ie_len); |
929 | 939 | ||
940 | /* in testmode we already might have a fw file */ | ||
941 | if (ar->fw != NULL) | ||
942 | break; | ||
943 | |||
930 | ar->fw = kmemdup(data, ie_len, GFP_KERNEL); | 944 | ar->fw = kmemdup(data, ie_len, GFP_KERNEL); |
931 | 945 | ||
932 | if (ar->fw == NULL) { | 946 | if (ar->fw == NULL) { |
@@ -1038,6 +1052,10 @@ int ath6kl_init_fetch_firmwares(struct ath6kl *ar) | |||
1038 | if (ret) | 1052 | if (ret) |
1039 | return ret; | 1053 | return ret; |
1040 | 1054 | ||
1055 | ret = ath6kl_fetch_testmode_file(ar); | ||
1056 | if (ret) | ||
1057 | return ret; | ||
1058 | |||
1041 | ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API3_FILE); | 1059 | ret = ath6kl_fetch_fw_apin(ar, ATH6KL_FW_API3_FILE); |
1042 | if (ret == 0) { | 1060 | if (ret == 0) { |
1043 | ar->fw_api = 3; | 1061 | ar->fw_api = 3; |
@@ -1283,7 +1301,7 @@ static int ath6kl_upload_testscript(struct ath6kl *ar) | |||
1283 | u32 address, param; | 1301 | u32 address, param; |
1284 | int ret; | 1302 | int ret; |
1285 | 1303 | ||
1286 | if (testmode != 2) | 1304 | if (ar->testmode != 2) |
1287 | return 0; | 1305 | return 0; |
1288 | 1306 | ||
1289 | if (ar->fw_testscript == NULL) | 1307 | if (ar->fw_testscript == NULL) |