diff options
author | Alex Yang <xiaojuny@qca.qualcomm.com> | 2012-01-17 08:32:29 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2012-01-18 06:47:31 -0500 |
commit | cd23c1c9b8a2de64477a795ab5a9cd5278397f24 (patch) | |
tree | 19f15daac456fef7b4fb95f4eaef7cc58c569726 | |
parent | e572602884c4f979cbba4fed413af24797fd01d9 (diff) |
ath6kl: add testmode 2 for 6003 ART
Add testmode 2 for 6003 ART. When you insmod ath6kl_sdio.ko testmode=2, ath6kl
will load ART firmware utf.bin and testscript nullTestFlow.bin. These files
should be put in the firmware folder.
kvalo: add "ath6kl:" to the title, word wrap the commit log and remove
extra line in the code
Signed-off-by: Alex Yang <xiaojuny@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 108 |
2 files changed, 110 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index ba3953918e4c..f53594f2e537 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -125,6 +125,8 @@ struct ath6kl_fw_ie { | |||
125 | #define AR6003_HW_2_1_1_OTP_FILE "otp.bin" | 125 | #define AR6003_HW_2_1_1_OTP_FILE "otp.bin" |
126 | #define AR6003_HW_2_1_1_FIRMWARE_FILE "athwlan.bin" | 126 | #define AR6003_HW_2_1_1_FIRMWARE_FILE "athwlan.bin" |
127 | #define AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE "athtcmd_ram.bin" | 127 | #define AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE "athtcmd_ram.bin" |
128 | #define AR6003_HW_2_1_1_UTF_FIRMWARE_FILE "utf.bin" | ||
129 | #define AR6003_HW_2_1_1_TESTSCRIPT_FILE "nullTestFlow.bin" | ||
128 | #define AR6003_HW_2_1_1_PATCH_FILE "data.patch.bin" | 130 | #define AR6003_HW_2_1_1_PATCH_FILE "data.patch.bin" |
129 | #define AR6003_HW_2_1_1_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.bin" | 131 | #define AR6003_HW_2_1_1_BOARD_DATA_FILE "ath6k/AR6003/hw2.1.1/bdata.bin" |
130 | #define AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE \ | 132 | #define AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE \ |
@@ -592,6 +594,7 @@ struct ath6kl { | |||
592 | u32 board_addr; | 594 | u32 board_addr; |
593 | u32 refclk_hz; | 595 | u32 refclk_hz; |
594 | u32 uarttx_pin; | 596 | u32 uarttx_pin; |
597 | u32 testscript_addr; | ||
595 | 598 | ||
596 | struct ath6kl_hw_fw { | 599 | struct ath6kl_hw_fw { |
597 | const char *dir; | 600 | const char *dir; |
@@ -599,6 +602,8 @@ struct ath6kl { | |||
599 | const char *fw; | 602 | const char *fw; |
600 | const char *tcmd; | 603 | const char *tcmd; |
601 | const char *patch; | 604 | const char *patch; |
605 | const char *utf; | ||
606 | const char *testscript; | ||
602 | } fw; | 607 | } fw; |
603 | 608 | ||
604 | const char *fw_board; | 609 | const char *fw_board; |
@@ -624,6 +629,9 @@ struct ath6kl { | |||
624 | u8 *fw_patch; | 629 | u8 *fw_patch; |
625 | size_t fw_patch_len; | 630 | size_t fw_patch_len; |
626 | 631 | ||
632 | u8 *fw_testscript; | ||
633 | size_t fw_testscript_len; | ||
634 | |||
627 | unsigned int fw_api; | 635 | unsigned int fw_api; |
628 | unsigned long fw_capabilities[ATH6KL_CAPABILITY_LEN]; | 636 | unsigned long fw_capabilities[ATH6KL_CAPABILITY_LEN]; |
629 | 637 | ||
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index e5969c146302..b88f41dc3dfa 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -69,6 +69,7 @@ static const struct ath6kl_hw hw_list[] = { | |||
69 | .reserved_ram_size = 512, | 69 | .reserved_ram_size = 512, |
70 | .refclk_hz = 26000000, | 70 | .refclk_hz = 26000000, |
71 | .uarttx_pin = 8, | 71 | .uarttx_pin = 8, |
72 | .testscript_addr = 0x57ef74, | ||
72 | 73 | ||
73 | .fw = { | 74 | .fw = { |
74 | .dir = AR6003_HW_2_1_1_FW_DIR, | 75 | .dir = AR6003_HW_2_1_1_FW_DIR, |
@@ -76,6 +77,8 @@ static const struct ath6kl_hw hw_list[] = { | |||
76 | .fw = AR6003_HW_2_1_1_FIRMWARE_FILE, | 77 | .fw = AR6003_HW_2_1_1_FIRMWARE_FILE, |
77 | .tcmd = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE, | 78 | .tcmd = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE, |
78 | .patch = AR6003_HW_2_1_1_PATCH_FILE, | 79 | .patch = AR6003_HW_2_1_1_PATCH_FILE, |
80 | .utf = AR6003_HW_2_1_1_UTF_FIRMWARE_FILE, | ||
81 | .testscript = AR6003_HW_2_1_1_TESTSCRIPT_FILE, | ||
79 | }, | 82 | }, |
80 | 83 | ||
81 | .fw_board = AR6003_HW_2_1_1_BOARD_DATA_FILE, | 84 | .fw_board = AR6003_HW_2_1_1_BOARD_DATA_FILE, |
@@ -620,6 +623,7 @@ void ath6kl_core_cleanup(struct ath6kl *ar) | |||
620 | kfree(ar->fw_otp); | 623 | kfree(ar->fw_otp); |
621 | kfree(ar->fw); | 624 | kfree(ar->fw); |
622 | kfree(ar->fw_patch); | 625 | kfree(ar->fw_patch); |
626 | kfree(ar->fw_testscript); | ||
623 | 627 | ||
624 | ath6kl_deinit_ieee80211_hw(ar); | 628 | ath6kl_deinit_ieee80211_hw(ar); |
625 | } | 629 | } |
@@ -771,14 +775,25 @@ static int ath6kl_fetch_fw_file(struct ath6kl *ar) | |||
771 | return 0; | 775 | return 0; |
772 | 776 | ||
773 | if (testmode) { | 777 | if (testmode) { |
774 | if (ar->hw.fw.tcmd == NULL) { | 778 | ath6kl_dbg(ATH6KL_DBG_BOOT, "testmode %d\n", |
775 | ath6kl_warn("testmode not supported\n"); | 779 | testmode); |
776 | return -EOPNOTSUPP; | 780 | if (testmode == 2) { |
777 | } | 781 | if (ar->hw.fw.utf == NULL) { |
782 | ath6kl_warn("testmode 2 not supported\n"); | ||
783 | return -EOPNOTSUPP; | ||
784 | } | ||
778 | 785 | ||
779 | snprintf(filename, sizeof(filename), "%s/%s", | 786 | snprintf(filename, sizeof(filename), "%s/%s", |
780 | ar->hw.fw.dir, ar->hw.fw.tcmd); | 787 | ar->hw.fw.dir, ar->hw.fw.utf); |
788 | } else { | ||
789 | if (ar->hw.fw.tcmd == NULL) { | ||
790 | ath6kl_warn("testmode 1 not supported\n"); | ||
791 | return -EOPNOTSUPP; | ||
792 | } | ||
781 | 793 | ||
794 | snprintf(filename, sizeof(filename), "%s/%s", | ||
795 | ar->hw.fw.dir, ar->hw.fw.tcmd); | ||
796 | } | ||
782 | set_bit(TESTMODE, &ar->flag); | 797 | set_bit(TESTMODE, &ar->flag); |
783 | 798 | ||
784 | goto get_fw; | 799 | goto get_fw; |
@@ -827,6 +842,34 @@ static int ath6kl_fetch_patch_file(struct ath6kl *ar) | |||
827 | return 0; | 842 | return 0; |
828 | } | 843 | } |
829 | 844 | ||
845 | static int ath6kl_fetch_testscript_file(struct ath6kl *ar) | ||
846 | { | ||
847 | char filename[100]; | ||
848 | int ret; | ||
849 | |||
850 | if (testmode != 2) | ||
851 | return 0; | ||
852 | |||
853 | if (ar->fw_testscript != NULL) | ||
854 | return 0; | ||
855 | |||
856 | if (ar->hw.fw.testscript == NULL) | ||
857 | return 0; | ||
858 | |||
859 | snprintf(filename, sizeof(filename), "%s/%s", | ||
860 | ar->hw.fw.dir, ar->hw.fw.testscript); | ||
861 | |||
862 | ret = ath6kl_get_fw(ar, filename, &ar->fw_testscript, | ||
863 | &ar->fw_testscript_len); | ||
864 | if (ret) { | ||
865 | ath6kl_err("Failed to get testscript file %s: %d\n", | ||
866 | filename, ret); | ||
867 | return ret; | ||
868 | } | ||
869 | |||
870 | return 0; | ||
871 | } | ||
872 | |||
830 | static int ath6kl_fetch_fw_api1(struct ath6kl *ar) | 873 | static int ath6kl_fetch_fw_api1(struct ath6kl *ar) |
831 | { | 874 | { |
832 | int ret; | 875 | int ret; |
@@ -843,6 +886,10 @@ static int ath6kl_fetch_fw_api1(struct ath6kl *ar) | |||
843 | if (ret) | 886 | if (ret) |
844 | return ret; | 887 | return ret; |
845 | 888 | ||
889 | ret = ath6kl_fetch_testscript_file(ar); | ||
890 | if (ret) | ||
891 | return ret; | ||
892 | |||
846 | return 0; | 893 | return 0; |
847 | } | 894 | } |
848 | 895 | ||
@@ -1266,6 +1313,50 @@ static int ath6kl_upload_patch(struct ath6kl *ar) | |||
1266 | return 0; | 1313 | return 0; |
1267 | } | 1314 | } |
1268 | 1315 | ||
1316 | static int ath6kl_upload_testscript(struct ath6kl *ar) | ||
1317 | { | ||
1318 | u32 address, param; | ||
1319 | int ret; | ||
1320 | |||
1321 | if (testmode != 2) | ||
1322 | return 0; | ||
1323 | |||
1324 | if (ar->fw_testscript == NULL) | ||
1325 | return 0; | ||
1326 | |||
1327 | address = ar->hw.testscript_addr; | ||
1328 | |||
1329 | ath6kl_dbg(ATH6KL_DBG_BOOT, "writing testscript to 0x%x (%zd B)\n", | ||
1330 | address, ar->fw_testscript_len); | ||
1331 | |||
1332 | ret = ath6kl_bmi_write(ar, address, ar->fw_testscript, | ||
1333 | ar->fw_testscript_len); | ||
1334 | if (ret) { | ||
1335 | ath6kl_err("Failed to write testscript file: %d\n", ret); | ||
1336 | return ret; | ||
1337 | } | ||
1338 | |||
1339 | param = address; | ||
1340 | ath6kl_bmi_write(ar, | ||
1341 | ath6kl_get_hi_item_addr(ar, | ||
1342 | HI_ITEM(hi_ota_testscript)), | ||
1343 | (unsigned char *) ¶m, 4); | ||
1344 | |||
1345 | param = 4096; | ||
1346 | ath6kl_bmi_write(ar, | ||
1347 | ath6kl_get_hi_item_addr(ar, | ||
1348 | HI_ITEM(hi_end_ram_reserve_sz)), | ||
1349 | (unsigned char *) ¶m, 4); | ||
1350 | |||
1351 | param = 1; | ||
1352 | ath6kl_bmi_write(ar, | ||
1353 | ath6kl_get_hi_item_addr(ar, | ||
1354 | HI_ITEM(hi_test_apps_related)), | ||
1355 | (unsigned char *) ¶m, 4); | ||
1356 | |||
1357 | return 0; | ||
1358 | } | ||
1359 | |||
1269 | static int ath6kl_init_upload(struct ath6kl *ar) | 1360 | static int ath6kl_init_upload(struct ath6kl *ar) |
1270 | { | 1361 | { |
1271 | u32 param, options, sleep, address; | 1362 | u32 param, options, sleep, address; |
@@ -1374,6 +1465,11 @@ static int ath6kl_init_upload(struct ath6kl *ar) | |||
1374 | if (status) | 1465 | if (status) |
1375 | return status; | 1466 | return status; |
1376 | 1467 | ||
1468 | /* Download the test script */ | ||
1469 | status = ath6kl_upload_testscript(ar); | ||
1470 | if (status) | ||
1471 | return status; | ||
1472 | |||
1377 | /* Restore system sleep */ | 1473 | /* Restore system sleep */ |
1378 | address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; | 1474 | address = RTC_BASE_ADDRESS + SYSTEM_SLEEP_ADDRESS; |
1379 | status = ath6kl_bmi_reg_write(ar, address, sleep); | 1475 | status = ath6kl_bmi_reg_write(ar, address, sleep); |