diff options
author | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-14 12:31:23 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-16 03:22:34 -0500 |
commit | d1a9421ddc63c2b81f9b05ea7ba6082c13b933b5 (patch) | |
tree | fa3aabb5f229a6cb683b4546ed7d63643e975119 /drivers/net/wireless/ath/ath6kl/init.c | |
parent | f0ea5d588a50f080dd0738bab651f967c4d0020e (diff) |
ath6kl: add firmware filename info to struct ath6kl_hw
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 149 |
1 files changed, 59 insertions, 90 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 208e77e3a90d..9d6e50d5c90a 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -44,6 +44,14 @@ static const struct ath6kl_hw hw_list[] = { | |||
44 | 44 | ||
45 | /* hw2.0 needs override address hardcoded */ | 45 | /* hw2.0 needs override address hardcoded */ |
46 | .app_start_override_addr = 0x944C00, | 46 | .app_start_override_addr = 0x944C00, |
47 | |||
48 | .fw_otp = AR6003_HW_2_0_OTP_FILE, | ||
49 | .fw = AR6003_HW_2_0_FIRMWARE_FILE, | ||
50 | .fw_tcmd = AR6003_HW_2_0_TCMD_FIRMWARE_FILE, | ||
51 | .fw_patch = AR6003_HW_2_0_PATCH_FILE, | ||
52 | .fw_api2 = AR6003_HW_2_0_FIRMWARE_2_FILE, | ||
53 | .fw_board = AR6003_HW_2_0_BOARD_DATA_FILE, | ||
54 | .fw_default_board = AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE, | ||
47 | }, | 55 | }, |
48 | { | 56 | { |
49 | .id = AR6003_HW_2_1_1_VERSION, | 57 | .id = AR6003_HW_2_1_1_VERSION, |
@@ -52,6 +60,14 @@ static const struct ath6kl_hw hw_list[] = { | |||
52 | .app_load_addr = 0x1234, | 60 | .app_load_addr = 0x1234, |
53 | .board_ext_data_addr = 0x542330, | 61 | .board_ext_data_addr = 0x542330, |
54 | .reserved_ram_size = 512, | 62 | .reserved_ram_size = 512, |
63 | |||
64 | .fw_otp = AR6003_HW_2_1_1_OTP_FILE, | ||
65 | .fw = AR6003_HW_2_1_1_FIRMWARE_FILE, | ||
66 | .fw_tcmd = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE, | ||
67 | .fw_patch = AR6003_HW_2_1_1_PATCH_FILE, | ||
68 | .fw_api2 = AR6003_HW_2_1_1_FIRMWARE_2_FILE, | ||
69 | .fw_board = AR6003_HW_2_1_1_BOARD_DATA_FILE, | ||
70 | .fw_default_board = AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE, | ||
55 | }, | 71 | }, |
56 | { | 72 | { |
57 | .id = AR6004_HW_1_0_VERSION, | 73 | .id = AR6004_HW_1_0_VERSION, |
@@ -61,6 +77,11 @@ static const struct ath6kl_hw hw_list[] = { | |||
61 | .board_ext_data_addr = 0x437000, | 77 | .board_ext_data_addr = 0x437000, |
62 | .reserved_ram_size = 19456, | 78 | .reserved_ram_size = 19456, |
63 | .board_addr = 0x433900, | 79 | .board_addr = 0x433900, |
80 | |||
81 | .fw = AR6004_HW_1_0_FIRMWARE_FILE, | ||
82 | .fw_api2 = AR6004_HW_1_0_FIRMWARE_2_FILE, | ||
83 | .fw_board = AR6004_HW_1_0_BOARD_DATA_FILE, | ||
84 | .fw_default_board = AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE, | ||
64 | }, | 85 | }, |
65 | { | 86 | { |
66 | .id = AR6004_HW_1_1_VERSION, | 87 | .id = AR6004_HW_1_1_VERSION, |
@@ -70,6 +91,11 @@ static const struct ath6kl_hw hw_list[] = { | |||
70 | .board_ext_data_addr = 0x437000, | 91 | .board_ext_data_addr = 0x437000, |
71 | .reserved_ram_size = 11264, | 92 | .reserved_ram_size = 11264, |
72 | .board_addr = 0x43d400, | 93 | .board_addr = 0x43d400, |
94 | |||
95 | .fw = AR6004_HW_1_1_FIRMWARE_FILE, | ||
96 | .fw_api2 = AR6004_HW_1_1_FIRMWARE_2_FILE, | ||
97 | .fw_board = AR6004_HW_1_1_BOARD_DATA_FILE, | ||
98 | .fw_default_board = AR6004_HW_1_1_DEFAULT_BOARD_DATA_FILE, | ||
73 | }, | 99 | }, |
74 | }; | 100 | }; |
75 | 101 | ||
@@ -652,17 +678,10 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar) | |||
652 | if (ar->fw_board != NULL) | 678 | if (ar->fw_board != NULL) |
653 | return 0; | 679 | return 0; |
654 | 680 | ||
655 | switch (ar->version.target_ver) { | 681 | if (WARN_ON(ar->hw.fw_board == NULL)) |
656 | case AR6003_HW_2_0_VERSION: | 682 | return -EINVAL; |
657 | filename = AR6003_HW_2_0_BOARD_DATA_FILE; | 683 | |
658 | break; | 684 | filename = ar->hw.fw_board; |
659 | case AR6004_HW_1_0_VERSION: | ||
660 | filename = AR6004_HW_1_0_BOARD_DATA_FILE; | ||
661 | break; | ||
662 | default: | ||
663 | filename = AR6003_HW_2_1_1_BOARD_DATA_FILE; | ||
664 | break; | ||
665 | } | ||
666 | 685 | ||
667 | ret = ath6kl_get_fw(ar, filename, &ar->fw_board, | 686 | ret = ath6kl_get_fw(ar, filename, &ar->fw_board, |
668 | &ar->fw_board_len); | 687 | &ar->fw_board_len); |
@@ -680,17 +699,7 @@ static int ath6kl_fetch_board_file(struct ath6kl *ar) | |||
680 | ath6kl_warn("Failed to get board file %s (%d), trying to find default board file.\n", | 699 | ath6kl_warn("Failed to get board file %s (%d), trying to find default board file.\n", |
681 | filename, ret); | 700 | filename, ret); |
682 | 701 | ||
683 | switch (ar->version.target_ver) { | 702 | filename = ar->hw.fw_default_board; |
684 | case AR6003_HW_2_0_VERSION: | ||
685 | filename = AR6003_HW_2_0_DEFAULT_BOARD_DATA_FILE; | ||
686 | break; | ||
687 | case AR6004_HW_1_0_VERSION: | ||
688 | filename = AR6004_HW_1_0_DEFAULT_BOARD_DATA_FILE; | ||
689 | break; | ||
690 | default: | ||
691 | filename = AR6003_HW_2_1_1_DEFAULT_BOARD_DATA_FILE; | ||
692 | break; | ||
693 | } | ||
694 | 703 | ||
695 | ret = ath6kl_get_fw(ar, filename, &ar->fw_board, | 704 | ret = ath6kl_get_fw(ar, filename, &ar->fw_board, |
696 | &ar->fw_board_len); | 705 | &ar->fw_board_len); |
@@ -714,19 +723,14 @@ static int ath6kl_fetch_otp_file(struct ath6kl *ar) | |||
714 | if (ar->fw_otp != NULL) | 723 | if (ar->fw_otp != NULL) |
715 | return 0; | 724 | return 0; |
716 | 725 | ||
717 | switch (ar->version.target_ver) { | 726 | if (ar->hw.fw_otp == NULL) { |
718 | case AR6003_HW_2_0_VERSION: | 727 | ath6kl_dbg(ATH6KL_DBG_BOOT, |
719 | filename = AR6003_HW_2_0_OTP_FILE; | 728 | "no OTP file configured for this hw\n"); |
720 | break; | ||
721 | case AR6004_HW_1_0_VERSION: | ||
722 | ath6kl_dbg(ATH6KL_DBG_TRC, "AR6004 doesn't need OTP file\n"); | ||
723 | return 0; | 729 | return 0; |
724 | break; | ||
725 | default: | ||
726 | filename = AR6003_HW_2_1_1_OTP_FILE; | ||
727 | break; | ||
728 | } | 730 | } |
729 | 731 | ||
732 | filename = ar->hw.fw_otp; | ||
733 | |||
730 | ret = ath6kl_get_fw(ar, filename, &ar->fw_otp, | 734 | ret = ath6kl_get_fw(ar, filename, &ar->fw_otp, |
731 | &ar->fw_otp_len); | 735 | &ar->fw_otp_len); |
732 | if (ret) { | 736 | if (ret) { |
@@ -747,38 +751,22 @@ static int ath6kl_fetch_fw_file(struct ath6kl *ar) | |||
747 | return 0; | 751 | return 0; |
748 | 752 | ||
749 | if (testmode) { | 753 | if (testmode) { |
750 | switch (ar->version.target_ver) { | 754 | if (ar->hw.fw_tcmd == NULL) { |
751 | case AR6003_HW_2_0_VERSION: | 755 | ath6kl_warn("testmode not supported\n"); |
752 | filename = AR6003_HW_2_0_TCMD_FIRMWARE_FILE; | ||
753 | break; | ||
754 | case AR6003_HW_2_1_1_VERSION: | ||
755 | filename = AR6003_HW_2_1_1_TCMD_FIRMWARE_FILE; | ||
756 | break; | ||
757 | case AR6004_HW_1_0_VERSION: | ||
758 | ath6kl_warn("testmode not supported with ar6004\n"); | ||
759 | return -EOPNOTSUPP; | 756 | return -EOPNOTSUPP; |
760 | default: | ||
761 | ath6kl_warn("unknown target version: 0x%x\n", | ||
762 | ar->version.target_ver); | ||
763 | return -EINVAL; | ||
764 | } | 757 | } |
765 | 758 | ||
759 | filename = ar->hw.fw_tcmd; | ||
760 | |||
766 | set_bit(TESTMODE, &ar->flag); | 761 | set_bit(TESTMODE, &ar->flag); |
767 | 762 | ||
768 | goto get_fw; | 763 | goto get_fw; |
769 | } | 764 | } |
770 | 765 | ||
771 | switch (ar->version.target_ver) { | 766 | if (WARN_ON(ar->hw.fw == NULL)) |
772 | case AR6003_HW_2_0_VERSION: | 767 | return -EINVAL; |
773 | filename = AR6003_HW_2_0_FIRMWARE_FILE; | 768 | |
774 | break; | 769 | filename = ar->hw.fw; |
775 | case AR6004_HW_1_0_VERSION: | ||
776 | filename = AR6004_HW_1_0_FIRMWARE_FILE; | ||
777 | break; | ||
778 | default: | ||
779 | filename = AR6003_HW_2_1_1_FIRMWARE_FILE; | ||
780 | break; | ||
781 | } | ||
782 | 770 | ||
783 | get_fw: | 771 | get_fw: |
784 | ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); | 772 | ret = ath6kl_get_fw(ar, filename, &ar->fw, &ar->fw_len); |
@@ -796,27 +784,20 @@ static int ath6kl_fetch_patch_file(struct ath6kl *ar) | |||
796 | const char *filename; | 784 | const char *filename; |
797 | int ret; | 785 | int ret; |
798 | 786 | ||
799 | switch (ar->version.target_ver) { | 787 | if (ar->fw_patch != NULL) |
800 | case AR6003_HW_2_0_VERSION: | ||
801 | filename = AR6003_HW_2_0_PATCH_FILE; | ||
802 | break; | ||
803 | case AR6004_HW_1_0_VERSION: | ||
804 | /* FIXME: implement for AR6004 */ | ||
805 | return 0; | 788 | return 0; |
806 | break; | ||
807 | default: | ||
808 | filename = AR6003_HW_2_1_1_PATCH_FILE; | ||
809 | break; | ||
810 | } | ||
811 | 789 | ||
812 | if (ar->fw_patch == NULL) { | 790 | if (ar->hw.fw_patch == NULL) |
813 | ret = ath6kl_get_fw(ar, filename, &ar->fw_patch, | 791 | return 0; |
814 | &ar->fw_patch_len); | 792 | |
815 | if (ret) { | 793 | filename = ar->hw.fw_patch; |
816 | ath6kl_err("Failed to get patch file %s: %d\n", | 794 | |
817 | filename, ret); | 795 | ret = ath6kl_get_fw(ar, filename, &ar->fw_patch, |
818 | return ret; | 796 | &ar->fw_patch_len); |
819 | } | 797 | if (ret) { |
798 | ath6kl_err("Failed to get patch file %s: %d\n", | ||
799 | filename, ret); | ||
800 | return ret; | ||
820 | } | 801 | } |
821 | 802 | ||
822 | return 0; | 803 | return 0; |
@@ -851,22 +832,10 @@ static int ath6kl_fetch_fw_api2(struct ath6kl *ar) | |||
851 | int ret, ie_id, i, index, bit; | 832 | int ret, ie_id, i, index, bit; |
852 | __le32 *val; | 833 | __le32 *val; |
853 | 834 | ||
854 | switch (ar->version.target_ver) { | 835 | if (ar->hw.fw_api2 == NULL) |
855 | case AR6003_HW_2_0_VERSION: | ||
856 | filename = AR6003_HW_2_0_FIRMWARE_2_FILE; | ||
857 | break; | ||
858 | case AR6003_HW_2_1_1_VERSION: | ||
859 | filename = AR6003_HW_2_1_1_FIRMWARE_2_FILE; | ||
860 | break; | ||
861 | case AR6004_HW_1_0_VERSION: | ||
862 | filename = AR6004_HW_1_0_FIRMWARE_2_FILE; | ||
863 | break; | ||
864 | case AR6004_HW_1_1_VERSION: | ||
865 | filename = AR6004_HW_1_1_FIRMWARE_2_FILE; | ||
866 | break; | ||
867 | default: | ||
868 | return -EOPNOTSUPP; | 836 | return -EOPNOTSUPP; |
869 | } | 837 | |
838 | filename = ar->hw.fw_api2; | ||
870 | 839 | ||
871 | ret = request_firmware(&fw, filename, ar->dev); | 840 | ret = request_firmware(&fw, filename, ar->dev); |
872 | if (ret) | 841 | if (ret) |