22 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
55 static const struct ath5k_ini ar5210_ini[] = {
267 static const struct ath5k_ini ar5211_ini[] = {
398 { 0x00000015, 0x0000001d, 0x00000015 } },
400 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
402 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
404 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
406 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
408 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
410 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
412 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
414 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
416 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
418 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
420 { 0x00000168, 0x000001b8, 0x00000168 } },
422 { 0x00000230, 0x000000b0, 0x00000230 } },
424 { 0x00000d98, 0x00001f48, 0x00000d98 } },
426 { 0x0000a0e0, 0x00005880, 0x0000a0e0 } },
428 { 0x04000400, 0x20003000, 0x04000400 } },
430 { 0x0e8d8fa7, 0x01608f95, 0x0e8d8fa7 } },
432 { 0x02020200, 0x02010200, 0x02020200 } },
434 { 0x00000e0e, 0x00000707, 0x00000e0e } },
436 { 0x0a020001, 0x05010000, 0x0a020001 } },
438 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
440 { 0x00000007, 0x0000000b, 0x0000000b } },
442 { 0x1372169c, 0x137216a8, 0x1372169c } },
444 { 0x0018ba67, 0x0018ba69, 0x0018ba69 } },
446 { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
448 { 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } },
450 { 0x31375d5e, 0x313a5d5e, 0x31375d5e } },
452 { 0x0000bd10, 0x0000bd38, 0x0000bd10 } },
454 { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
456 { 0x00002710, 0x0000157c, 0x00002710 } },
458 { 0x00000190, 0x00000084, 0x00000190 } },
460 { 0x6fe01020, 0x6fe00920, 0x6fe01020 } },
462 { 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } },
464 { 0x00000010, 0x00000010, 0x00000010 } },
468 static const struct ath5k_ini ar5212_ini_common_start[] = {
682 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
684 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
686 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
688 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
690 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
692 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
694 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
696 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
698 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
700 { 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
702 { 0x00000230, 0x000000b0, 0x00000160 } },
704 { 0x00000168, 0x000001b8, 0x0000018c } },
706 { 0x00000e60, 0x00001f1c, 0x00003e38 } },
708 { 0x0000a0e0, 0x00005880, 0x0000b0e0 } },
710 { 0x03e803e8, 0x04200420, 0x08400840 } },
712 { 0x02020200, 0x02010200, 0x02020200 } },
714 { 0x00000e0e, 0x00000707, 0x00000e0e } },
716 { 0x1372161c, 0x13721722, 0x137216a2 } },
718 { 0x00009d10, 0x00009d18, 0x00009d18 } },
720 { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
722 { 0x409a4190, 0x409a4190, 0x409a4190 } },
724 { 0x000001b8, 0x00000084, 0x00000108 } },
726 { 0x10058a05, 0x10058a05, 0x10058a05 } },
728 { 0x00000000, 0x00000000, 0x00000108 } },
736 { 0x00008015, 0x00008015, 0x00008015 } },
738 { 0x128d8fa7, 0x04e00f95, 0x12e00fab } },
740 { 0x0a020001, 0x05010100, 0x0a020001 } },
742 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
744 { 0x00000007, 0x0000000b, 0x0000000b } },
746 { 0x0018da5a, 0x0018ca69, 0x0018ca69 } },
748 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
750 { 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e } },
752 { 0x3137665e, 0x3137665e, 0x3137665e } },
754 { 0x050cb081, 0x050cb081, 0x050cb080 } },
756 { 0x00002710, 0x0000157c, 0x00002af8 } },
758 { 0xf7b81020, 0xf7b80d20, 0xf7b81020 } },
760 { 0x642c416a, 0x6440416a, 0x6440416a } },
762 { 0x1883800a, 0x1873800a, 0x1883800a } },
766 static const struct ath5k_ini rf5111_ini_common_end[] = {
770 { 0x983c, 0x00020100 },
773 { 0x9940, 0x00000004 },
774 { 0x9958, 0x000000ff },
775 { 0x9974, 0x00000000 },
780 { 0xa23c, 0x13c889af },
789 { 0x00008015, 0x00008015, 0x00008015 } },
791 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
793 { 0x0a020001, 0x05020100, 0x0a020001 } },
795 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
797 { 0x00000007, 0x0000000b, 0x0000000b } },
799 { 0x0018da6d, 0x0018ca75, 0x0018ca75 } },
801 { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
803 { 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e } },
805 { 0x3137665e, 0x3137665e, 0x3137665e } },
807 { 0x050cb081, 0x050cb081, 0x050cb081 } },
809 { 0x000007d0, 0x0000044c, 0x00000898 } },
811 { 0xf7b81020, 0xf7b80d10, 0xf7b81010 } },
813 { 0x00000000, 0x00000008, 0x00000008 } },
815 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
817 { 0x642c0140, 0x6442c160, 0x6442c160 } },
819 { 0x1883800a, 0x1873800a, 0x1883800a } },
822 static const struct ath5k_ini rf5112_ini_common_end[] = {
826 { 0x983c, 0x00020100 },
829 { 0x9940, 0x00000004 },
830 { 0x9958, 0x000000ff },
831 { 0x9974, 0x00000000 },
833 { 0xa23c, 0x13c889af },
842 { 0x00000015, 0x00000015, 0x00000015 } },
844 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
846 { 0x0a020001, 0x05020100, 0x0a020001 } },
848 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
850 { 0x00000007, 0x0000000b, 0x0000000b } },
852 { 0x0018fa61, 0x001a1a63, 0x001a1a63 } },
854 { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
856 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
858 { 0x3139605e, 0x3139605e, 0x3139605e } },
860 { 0x050cb081, 0x050cb081, 0x050cb081 } },
862 { 0x000007d0, 0x0000044c, 0x00000898 } },
864 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
866 { 0x00000000, 0x00000000, 0x00000000 } },
868 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
870 { 0x002ec1e0, 0x002ac120, 0x002ac120 } },
872 { 0x1883800a, 0x1863800a, 0x1883800a } },
874 { 0x18010000, 0x18010000, 0x18010000 } },
876 { 0x30032602, 0x30032602, 0x30032602 } },
878 { 0x48073e06, 0x48073e06, 0x48073e06 } },
880 { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
882 { 0x641a600f, 0x641a600f, 0x641a600f } },
884 { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
886 { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
888 { 0x90cf865b, 0x8ecf865b, 0x8ecf865b } },
890 { 0x9d4f970f, 0x9b4f970f, 0x9b4f970f } },
892 { 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f } },
894 { 0xb55faf1f, 0xb35faf1f, 0xb35faf1f } },
896 { 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f } },
898 { 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f } },
900 { 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
903 static const struct ath5k_ini rf5413_ini_common_end[] = {
907 { 0x809c, 0x00000000 },
908 { 0x80a0, 0x00000000 },
919 { 0x8140, 0x800003f9 },
920 { 0x8144, 0x00000000 },
923 { 0x983c, 0x00200400 },
928 { 0x9958, 0x00081fff },
933 { 0x99e4, 0xaaaaaaaa },
934 { 0x99e8, 0x3c466478 },
935 { 0x99ec, 0x000000aa },
940 { 0xa23c, 0x93c889af },
942 { 0xa250, 0x0000a000 },
945 { 0xa25c, 0x0f0f0f01 },
946 { 0xa260, 0x5f690f01 },
947 { 0xa264, 0x00418a11 },
948 { 0xa268, 0x00000000 },
950 { 0xa270, 0x00820820 },
951 { 0xa274, 0x081b7caa },
952 { 0xa278, 0x1ce739ce },
953 { 0xa27c, 0x051701ce },
954 { 0xa338, 0x00000000 },
955 { 0xa33c, 0x00000000 },
956 { 0xa340, 0x00000000 },
957 { 0xa344, 0x00000000 },
958 { 0xa348, 0x3fffffff },
959 { 0xa34c, 0x3fffffff },
960 { 0xa350, 0x3fffffff },
961 { 0xa354, 0x0003ffff },
962 { 0xa358, 0x79a8aa1f },
963 { 0xa35c, 0x066c420f },
964 { 0xa360, 0x0f282207 },
965 { 0xa364, 0x17601685 },
966 { 0xa368, 0x1f801104 },
967 { 0xa36c, 0x37a00c03 },
968 { 0xa370, 0x3fc40883 },
969 { 0xa374, 0x57c00803 },
970 { 0xa378, 0x5fd80682 },
971 { 0xa37c, 0x7fe00482 },
972 { 0xa380, 0x7f3c7bba },
973 { 0xa384, 0xf3307ff0 },
982 { 0x00000015, 0x00000015, 0x00000015 } },
984 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
986 { 0x0a020001, 0x05020000, 0x0a020001 } },
988 { 0x00000e00, 0x00000e00, 0x00000e00 } },
990 { 0x00000002, 0x0000000a, 0x0000000a } },
992 { 0x0018da6d, 0x001a6a64, 0x001a6a64 } },
994 { 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da } },
996 { 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e } },
998 { 0x3137665e, 0x3137665e, 0x3139605e } },
1000 { 0x050cb081, 0x050cb081, 0x050cb081 } },
1002 { 0x000007d0, 0x0000044c, 0x00000898 } },
1004 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
1006 { 0x00000000, 0x00000000, 0x00000000 } },
1008 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
1010 { 0x002c0140, 0x0042c140, 0x0042c140 } },
1012 { 0x1883800a, 0x1863800a, 0x1883800a } },
1015 static const struct ath5k_ini rf2413_ini_common_end[] = {
1028 { 0x8140, 0x800000a8 },
1029 { 0x8144, 0x00000000 },
1032 { 0x983c, 0x00200400 },
1037 { 0x9958, 0x000000ff },
1042 { 0x99e4, 0xaaaaaaaa },
1043 { 0x99e8, 0x3c466478 },
1044 { 0x99ec, 0x000000aa },
1049 { 0xa23c, 0x93c889af },
1051 { 0xa250, 0x0000a000 },
1054 { 0xa25c, 0x0f0f0f01 },
1055 { 0xa260, 0x5f690f01 },
1056 { 0xa264, 0x00418a11 },
1057 { 0xa268, 0x00000000 },
1059 { 0xa270, 0x00820820 },
1060 { 0xa274, 0x001b7caa },
1061 { 0xa278, 0x1ce739ce },
1062 { 0xa27c, 0x051701ce },
1063 { 0xa300, 0x18010000 },
1064 { 0xa304, 0x30032602 },
1065 { 0xa308, 0x48073e06 },
1066 { 0xa30c, 0x560b4c0a },
1067 { 0xa310, 0x641a600f },
1068 { 0xa314, 0x784f6e1b },
1069 { 0xa318, 0x868f7c5a },
1070 { 0xa31c, 0x8ecf865b },
1071 { 0xa320, 0x9d4f970f },
1072 { 0xa324, 0xa5cfa18f },
1073 { 0xa328, 0xb55faf1f },
1074 { 0xa32c, 0xbddfb99f },
1075 { 0xa330, 0xcd7fc73f },
1076 { 0xa334, 0xd5ffd1bf },
1077 { 0xa338, 0x00000000 },
1078 { 0xa33c, 0x00000000 },
1079 { 0xa340, 0x00000000 },
1080 { 0xa344, 0x00000000 },
1081 { 0xa348, 0x3fffffff },
1082 { 0xa34c, 0x3fffffff },
1083 { 0xa350, 0x3fffffff },
1084 { 0xa354, 0x0003ffff },
1085 { 0xa358, 0x79a8aa1f },
1086 { 0xa35c, 0x066c420f },
1087 { 0xa360, 0x0f282207 },
1088 { 0xa364, 0x17601685 },
1089 { 0xa368, 0x1f801104 },
1090 { 0xa36c, 0x37a00c03 },
1091 { 0xa370, 0x3fc40883 },
1092 { 0xa374, 0x57c00803 },
1093 { 0xa378, 0x5fd80682 },
1094 { 0xa37c, 0x7fe00482 },
1095 { 0xa380, 0x7f3c7bba },
1096 { 0xa384, 0xf3307ff0 },
1105 { 0x00000015, 0x00000015, 0x00000015 } },
1107 { 0x128d93a7, 0x04e01395, 0x12e013ab } },
1109 { 0x0a020001, 0x05020100, 0x0a020001 } },
1111 { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
1113 { 0x00000003, 0x0000000b, 0x0000000b } },
1115 { 0x1372161c, 0x13721722, 0x13721422 } },
1117 { 0x0018fa61, 0x00199a65, 0x00199a65 } },
1119 { 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da } },
1121 { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
1123 { 0x3139605e, 0x3139605e, 0x3139605e } },
1125 { 0x050cb081, 0x050cb081, 0x050cb081 } },
1127 { 0x000007d0, 0x0000044c, 0x00000898 } },
1129 { 0xf7b81000, 0xf7b80d00, 0xf7b81000 } },
1131 { 0x00000000, 0x00000000, 0x00000000 } },
1133 { 0xd6be6788, 0xd03e6788, 0xd03e6788 } },
1135 { 0x00000140, 0x0052c140, 0x0052c140 } },
1137 { 0x1883800a, 0x1863800a, 0x1883800a } },
1139 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1141 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1143 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1145 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1147 { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
1150 static const struct ath5k_ini rf2425_ini_common_end[] = {
1153 { 0x809c, 0x00000000 },
1154 { 0x80a0, 0x00000000 },
1165 { 0x8140, 0x800003f9 },
1166 { 0x8144, 0x00000000 },
1169 { 0x983c, 0x00200400 },
1174 { 0x9958, 0x00081fff },
1178 { 0x99dc, 0xfebadbe8 },
1180 { 0x99e4, 0xaaaaaaaa },
1181 { 0x99e8, 0x3c466478 },
1182 { 0x99ec, 0x000000aa },
1189 { 0xa23c, 0x93c889af },
1191 { 0xa250, 0x0000a000 },
1194 { 0xa25c, 0x0f0f0f01 },
1195 { 0xa260, 0x5f690f01 },
1196 { 0xa264, 0x00418a11 },
1197 { 0xa268, 0x00000000 },
1199 { 0xa270, 0x00820820 },
1200 { 0xa274, 0x081a3caa },
1201 { 0xa278, 0x1ce739ce },
1202 { 0xa27c, 0x051701ce },
1203 { 0xa300, 0x16010000 },
1204 { 0xa304, 0x2c032402 },
1205 { 0xa308, 0x48433e42 },
1206 { 0xa30c, 0x5a0f500b },
1207 { 0xa310, 0x6c4b624a },
1208 { 0xa314, 0x7e8b748a },
1209 { 0xa318, 0x96cf8ccb },
1210 { 0xa31c, 0xa34f9d0f },
1211 { 0xa320, 0xa7cfa58f },
1212 { 0xa348, 0x3fffffff },
1213 { 0xa34c, 0x3fffffff },
1214 { 0xa350, 0x3fffffff },
1215 { 0xa354, 0x0003ffff },
1216 { 0xa358, 0x79a8aa1f },
1217 { 0xa35c, 0x066c420f },
1218 { 0xa360, 0x0f282207 },
1219 { 0xa364, 0x17601685 },
1220 { 0xa368, 0x1f801104 },
1221 { 0xa36c, 0x37a00c03 },
1222 { 0xa370, 0x3fc40883 },
1223 { 0xa374, 0x57c00803 },
1224 { 0xa378, 0x5fd80682 },
1225 { 0xa37c, 0x7fe00482 },
1226 { 0xa380, 0x7f3c7bba },
1227 { 0xa384, 0xf3307ff0 },
1236 static const struct ath5k_ini rf5111_ini_bbgain[] = {
1304 static const struct ath5k_ini rf5112_ini_bbgain[] = {
1381 const struct ath5k_ini *ini_regs,
bool skip_pcu)
1386 for (i = 0; i <
size; i++) {
1402 ath5k_hw_reg_write(ah, ini_regs[i].
ini_value,
1416 ath5k_hw_ini_mode_registers(
struct ath5k_hw *ah,
1422 for (i = 0; i <
size; i++) {
1424 ath5k_hw_reg_write(ah, ini_mode[i].mode_value[mode],
1425 (
u32)ini_mode[i].mode_register);
1450 ath5k_hw_ini_mode_registers(ah,
1452 ar5212_ini_mode_start, mode);
1457 ath5k_hw_ini_registers(ah,
ARRAY_SIZE(ar5212_ini_common_start),
1458 ar5212_ini_common_start, skip_pcu);
1464 ath5k_hw_ini_mode_registers(ah,
1466 rf5111_ini_mode_end, mode);
1468 ath5k_hw_ini_registers(ah,
1470 rf5111_ini_common_end, skip_pcu);
1473 ath5k_hw_ini_registers(ah,
1475 rf5111_ini_bbgain, skip_pcu);
1480 ath5k_hw_ini_mode_registers(ah,
1482 rf5112_ini_mode_end, mode);
1484 ath5k_hw_ini_registers(ah,
1486 rf5112_ini_common_end, skip_pcu);
1488 ath5k_hw_ini_registers(ah,
1490 rf5112_ini_bbgain, skip_pcu);
1495 ath5k_hw_ini_mode_registers(ah,
1497 rf5413_ini_mode_end, mode);
1499 ath5k_hw_ini_registers(ah,
1501 rf5413_ini_common_end, skip_pcu);
1503 ath5k_hw_ini_registers(ah,
1505 rf5112_ini_bbgain, skip_pcu);
1511 ath5k_hw_ini_mode_registers(ah,
1513 rf2413_ini_mode_end, mode);
1515 ath5k_hw_ini_registers(ah,
1517 rf2413_ini_common_end, skip_pcu);
1521 ath5k_hw_reg_write(ah, 0x00004000,
1523 ath5k_hw_reg_write(ah, 0x081b7caa,
1527 ath5k_hw_ini_registers(ah,
1529 rf5112_ini_bbgain, skip_pcu);
1533 ath5k_hw_ini_mode_registers(ah,
1535 rf2413_ini_mode_end, mode);
1537 ath5k_hw_ini_registers(ah,
1539 rf2425_ini_common_end, skip_pcu);
1548 ath5k_hw_reg_write(ah, 0x800000a8, 0x8140);
1549 ath5k_hw_reg_write(ah, 0x000000ff, 0x9958);
1551 ath5k_hw_ini_registers(ah,
1553 rf5112_ini_bbgain, skip_pcu);
1557 ath5k_hw_ini_mode_registers(ah,
1559 rf2425_ini_mode_end, mode);
1561 ath5k_hw_ini_registers(ah,
1563 rf2425_ini_common_end, skip_pcu);
1565 ath5k_hw_ini_registers(ah,
1567 rf5112_ini_bbgain, skip_pcu);
1579 ATH5K_ERR(ah,
"unsupported channel mode: %d\n", mode);
1584 ath5k_hw_ini_mode_registers(ah,
ARRAY_SIZE(ar5211_ini_mode),
1585 ar5211_ini_mode, mode);
1590 ath5k_hw_ini_registers(ah,
ARRAY_SIZE(ar5211_ini),
1591 ar5211_ini, skip_pcu);
1596 ath5k_hw_ini_registers(ah,
ARRAY_SIZE(rf5111_ini_bbgain),
1597 rf5111_ini_bbgain, skip_pcu);
1600 ath5k_hw_ini_registers(ah,
ARRAY_SIZE(ar5210_ini),
1601 ar5210_ini, skip_pcu);