aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSenthil Balasubramanian <senthilb@qca.qualcomm.com>2011-09-13 13:08:18 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-16 16:45:33 -0400
commit2577c6e8f2320f1d2f09be122efef5b9118efee4 (patch)
tree7579057ce794fd093344a8ac24d6f37e136f881e /drivers/net/wireless/ath
parent4d0707e66d82f46998d49be98adea0e705647be1 (diff)
ath9k_hw: Add support for AR946/8x chipsets.
This patch adds support for AR946/8x chipets. Signed-off-by: Senthil Balasubramanian <senthilb@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.c109
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_eeprom.h3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_hw.c191
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_paprd.c11
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c10
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c73
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c1
7 files changed, 362 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index cb4c32eaef61..0fc0595c59e1 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -22,11 +22,13 @@
22#define COMP_HDR_LEN 4 22#define COMP_HDR_LEN 4
23#define COMP_CKSUM_LEN 2 23#define COMP_CKSUM_LEN 2
24 24
25#define AR_CH0_TOP (0x00016288) 25#define AR_CH0_TOP (AR_SREV_9300(ah) ? 0x16288 : \
26 ((AR_SREV_9480(ah) ? 0x1628c : 0x16280)))
26#define AR_CH0_TOP_XPABIASLVL (0x300) 27#define AR_CH0_TOP_XPABIASLVL (0x300)
27#define AR_CH0_TOP_XPABIASLVL_S (8) 28#define AR_CH0_TOP_XPABIASLVL_S (8)
28 29
29#define AR_CH0_THERM (0x00016290) 30#define AR_CH0_THERM (AR_SREV_9300(ah) ? 0x16290 : \
31 ((AR_SREV_9485(ah) ? 0x1628c : 0x16294)))
30#define AR_CH0_THERM_XPABIASLVL_MSB 0x3 32#define AR_CH0_THERM_XPABIASLVL_MSB 0x3
31#define AR_CH0_THERM_XPABIASLVL_MSB_S 0 33#define AR_CH0_THERM_XPABIASLVL_MSB_S 0
32#define AR_CH0_THERM_XPASHORT2GND 0x4 34#define AR_CH0_THERM_XPASHORT2GND 0x4
@@ -34,6 +36,11 @@
34 36
35#define AR_SWITCH_TABLE_COM_ALL (0xffff) 37#define AR_SWITCH_TABLE_COM_ALL (0xffff)
36#define AR_SWITCH_TABLE_COM_ALL_S (0) 38#define AR_SWITCH_TABLE_COM_ALL_S (0)
39#define AR_SWITCH_TABLE_COM_AR9480_ALL (0xffffff)
40#define AR_SWITCH_TABLE_COM_AR9480_ALL_S (0)
41#define AR_SWITCH_TABLE_COM_SPDT (0x00f00000)
42#define AR_SWITCH_TABLE_COM_SPDT_ALL (0x0000fff0)
43#define AR_SWITCH_TABLE_COM_SPDT_ALL_S (4)
37 44
38#define AR_SWITCH_TABLE_COM2_ALL (0xffffff) 45#define AR_SWITCH_TABLE_COM2_ALL (0xffffff)
39#define AR_SWITCH_TABLE_COM2_ALL_S (0) 46#define AR_SWITCH_TABLE_COM2_ALL_S (0)
@@ -158,7 +165,7 @@ static const struct ar9300_eeprom ar9300_default = {
158 .papdRateMaskHt20 = LE32(0x0cf0e0e0), 165 .papdRateMaskHt20 = LE32(0x0cf0e0e0),
159 .papdRateMaskHt40 = LE32(0x6cf0e0e0), 166 .papdRateMaskHt40 = LE32(0x6cf0e0e0),
160 .futureModal = { 167 .futureModal = {
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168 0, 0, 0, 0, 0, 0, 0, 0,
162 }, 169 },
163 }, 170 },
164 .base_ext1 = { 171 .base_ext1 = {
@@ -360,7 +367,7 @@ static const struct ar9300_eeprom ar9300_default = {
360 .papdRateMaskHt20 = LE32(0x0c80c080), 367 .papdRateMaskHt20 = LE32(0x0c80c080),
361 .papdRateMaskHt40 = LE32(0x0080c080), 368 .papdRateMaskHt40 = LE32(0x0080c080),
362 .futureModal = { 369 .futureModal = {
363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 370 0, 0, 0, 0, 0, 0, 0, 0,
364 }, 371 },
365 }, 372 },
366 .base_ext2 = { 373 .base_ext2 = {
@@ -735,7 +742,7 @@ static const struct ar9300_eeprom ar9300_x113 = {
735 .papdRateMaskHt20 = LE32(0x0c80c080), 742 .papdRateMaskHt20 = LE32(0x0c80c080),
736 .papdRateMaskHt40 = LE32(0x0080c080), 743 .papdRateMaskHt40 = LE32(0x0080c080),
737 .futureModal = { 744 .futureModal = {
738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 745 0, 0, 0, 0, 0, 0, 0, 0,
739 }, 746 },
740 }, 747 },
741 .base_ext1 = { 748 .base_ext1 = {
@@ -937,7 +944,7 @@ static const struct ar9300_eeprom ar9300_x113 = {
937 .papdRateMaskHt20 = LE32(0x0cf0e0e0), 944 .papdRateMaskHt20 = LE32(0x0cf0e0e0),
938 .papdRateMaskHt40 = LE32(0x6cf0e0e0), 945 .papdRateMaskHt40 = LE32(0x6cf0e0e0),
939 .futureModal = { 946 .futureModal = {
940 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 947 0, 0, 0, 0, 0, 0, 0, 0,
941 }, 948 },
942 }, 949 },
943 .base_ext2 = { 950 .base_ext2 = {
@@ -1313,7 +1320,7 @@ static const struct ar9300_eeprom ar9300_h112 = {
1313 .papdRateMaskHt20 = LE32(0x80c080), 1320 .papdRateMaskHt20 = LE32(0x80c080),
1314 .papdRateMaskHt40 = LE32(0x80c080), 1321 .papdRateMaskHt40 = LE32(0x80c080),
1315 .futureModal = { 1322 .futureModal = {
1316 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1323 0, 0, 0, 0, 0, 0, 0, 0,
1317 }, 1324 },
1318 }, 1325 },
1319 .base_ext1 = { 1326 .base_ext1 = {
@@ -1515,7 +1522,7 @@ static const struct ar9300_eeprom ar9300_h112 = {
1515 .papdRateMaskHt20 = LE32(0x0cf0e0e0), 1522 .papdRateMaskHt20 = LE32(0x0cf0e0e0),
1516 .papdRateMaskHt40 = LE32(0x6cf0e0e0), 1523 .papdRateMaskHt40 = LE32(0x6cf0e0e0),
1517 .futureModal = { 1524 .futureModal = {
1518 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1525 0, 0, 0, 0, 0, 0, 0, 0,
1519 }, 1526 },
1520 }, 1527 },
1521 .base_ext2 = { 1528 .base_ext2 = {
@@ -1891,7 +1898,7 @@ static const struct ar9300_eeprom ar9300_x112 = {
1891 .papdRateMaskHt20 = LE32(0x0c80c080), 1898 .papdRateMaskHt20 = LE32(0x0c80c080),
1892 .papdRateMaskHt40 = LE32(0x0080c080), 1899 .papdRateMaskHt40 = LE32(0x0080c080),
1893 .futureModal = { 1900 .futureModal = {
1894 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1901 0, 0, 0, 0, 0, 0, 0, 0,
1895 }, 1902 },
1896 }, 1903 },
1897 .base_ext1 = { 1904 .base_ext1 = {
@@ -2093,7 +2100,7 @@ static const struct ar9300_eeprom ar9300_x112 = {
2093 .papdRateMaskHt20 = LE32(0x0cf0e0e0), 2100 .papdRateMaskHt20 = LE32(0x0cf0e0e0),
2094 .papdRateMaskHt40 = LE32(0x6cf0e0e0), 2101 .papdRateMaskHt40 = LE32(0x6cf0e0e0),
2095 .futureModal = { 2102 .futureModal = {
2096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2103 0, 0, 0, 0, 0, 0, 0, 0,
2097 }, 2104 },
2098 }, 2105 },
2099 .base_ext2 = { 2106 .base_ext2 = {
@@ -2468,7 +2475,7 @@ static const struct ar9300_eeprom ar9300_h116 = {
2468 .papdRateMaskHt20 = LE32(0x0c80C080), 2475 .papdRateMaskHt20 = LE32(0x0c80C080),
2469 .papdRateMaskHt40 = LE32(0x0080C080), 2476 .papdRateMaskHt40 = LE32(0x0080C080),
2470 .futureModal = { 2477 .futureModal = {
2471 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2478 0, 0, 0, 0, 0, 0, 0, 0,
2472 }, 2479 },
2473 }, 2480 },
2474 .base_ext1 = { 2481 .base_ext1 = {
@@ -2670,7 +2677,7 @@ static const struct ar9300_eeprom ar9300_h116 = {
2670 .papdRateMaskHt20 = LE32(0x0cf0e0e0), 2677 .papdRateMaskHt20 = LE32(0x0cf0e0e0),
2671 .papdRateMaskHt40 = LE32(0x6cf0e0e0), 2678 .papdRateMaskHt40 = LE32(0x6cf0e0e0),
2672 .futureModal = { 2679 .futureModal = {
2673 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2680 0, 0, 0, 0, 0, 0, 0, 0,
2674 }, 2681 },
2675 }, 2682 },
2676 .base_ext2 = { 2683 .base_ext2 = {
@@ -3573,6 +3580,8 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
3573 3580
3574 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah)) 3581 if (AR_SREV_9485(ah) || AR_SREV_9330(ah) || AR_SREV_9340(ah))
3575 REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias); 3582 REG_RMW_FIELD(ah, AR_CH0_TOP2, AR_CH0_TOP2_XPABIASLVL, bias);
3583 else if (AR_SREV_9480(ah))
3584 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
3576 else { 3585 else {
3577 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias); 3586 REG_RMW_FIELD(ah, AR_CH0_TOP, AR_CH0_TOP_XPABIASLVL, bias);
3578 REG_RMW_FIELD(ah, AR_CH0_THERM, 3587 REG_RMW_FIELD(ah, AR_CH0_THERM,
@@ -3583,6 +3592,19 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
3583 } 3592 }
3584} 3593}
3585 3594
3595static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is_2ghz)
3596{
3597 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
3598 __le32 val;
3599
3600 if (is_2ghz)
3601 val = eep->modalHeader2G.switchcomspdt;
3602 else
3603 val = eep->modalHeader5G.switchcomspdt;
3604 return le32_to_cpu(val);
3605}
3606
3607
3586static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz) 3608static u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
3587{ 3609{
3588 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep; 3610 struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
@@ -3637,7 +3659,36 @@ static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
3637 3659
3638 u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz); 3660 u32 value = ar9003_hw_ant_ctrl_common_get(ah, is2ghz);
3639 3661
3640 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM, AR_SWITCH_TABLE_COM_ALL, value); 3662 if (AR_SREV_9480(ah)) {
3663 if (AR_SREV_9480_10(ah)) {
3664 value &= ~AR_SWITCH_TABLE_COM_SPDT;
3665 value |= 0x00100000;
3666 }
3667 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
3668 AR_SWITCH_TABLE_COM_AR9480_ALL, value);
3669 } else
3670 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM,
3671 AR_SWITCH_TABLE_COM_ALL, value);
3672
3673
3674 /*
3675 * AR9480 defines new switch table for BT/WLAN,
3676 * here's new field name in XXX.ref for both 2G and 5G.
3677 * Register: [GLB_CONTROL] GLB_CONTROL (@0x20044)
3678 * 15:12 R/W SWITCH_TABLE_COM_SPDT_WLAN_RX
3679 * SWITCH_TABLE_COM_SPDT_WLAN_RX
3680 *
3681 * 11:8 R/W SWITCH_TABLE_COM_SPDT_WLAN_TX
3682 * SWITCH_TABLE_COM_SPDT_WLAN_TX
3683 *
3684 * 7:4 R/W SWITCH_TABLE_COM_SPDT_WLAN_IDLE
3685 * SWITCH_TABLE_COM_SPDT_WLAN_IDLE
3686 */
3687 if (AR_SREV_9480_20_OR_LATER(ah)) {
3688 value = ar9003_switch_com_spdt_get(ah, is2ghz);
3689 REG_RMW_FIELD(ah, AR_PHY_GLB_CONTROL,
3690 AR_SWITCH_TABLE_COM_SPDT_ALL, value);
3691 }
3641 3692
3642 value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz); 3693 value = ar9003_hw_ant_ctrl_common_2_get(ah, is2ghz);
3643 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value); 3694 REG_RMW_FIELD(ah, AR_PHY_SWITCH_COM_2, AR_SWITCH_TABLE_COM2_ALL, value);
@@ -3837,6 +3888,7 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
3837{ 3888{
3838 int internal_regulator = 3889 int internal_regulator =
3839 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR); 3890 ath9k_hw_ar9300_get_eeprom(ah, EEP_INTERNAL_REGULATOR);
3891 u32 reg_val;
3840 3892
3841 if (internal_regulator) { 3893 if (internal_regulator) {
3842 if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) { 3894 if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
@@ -3881,13 +3933,16 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
3881 REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set); 3933 REG_WRITE(ah, AR_PHY_PMU2, reg_pmu_set);
3882 if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set)) 3934 if (!is_pmu_set(ah, AR_PHY_PMU2, reg_pmu_set))
3883 return; 3935 return;
3936 } else if (AR_SREV_9480(ah)) {
3937 reg_val = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG);
3938 REG_WRITE(ah, AR_PHY_PMU1, reg_val);
3884 } else { 3939 } else {
3885 /* Internal regulator is ON. Write swreg register. */ 3940 /* Internal regulator is ON. Write swreg register. */
3886 int swreg = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG); 3941 reg_val = ath9k_hw_ar9300_get_eeprom(ah, EEP_SWREG);
3887 REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3942 REG_WRITE(ah, AR_RTC_REG_CONTROL1,
3888 REG_READ(ah, AR_RTC_REG_CONTROL1) & 3943 REG_READ(ah, AR_RTC_REG_CONTROL1) &
3889 (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM)); 3944 (~AR_RTC_REG_CONTROL1_SWREG_PROGRAM));
3890 REG_WRITE(ah, AR_RTC_REG_CONTROL0, swreg); 3945 REG_WRITE(ah, AR_RTC_REG_CONTROL0, reg_val);
3891 /* Set REG_CONTROL1.SWREG_PROGRAM */ 3946 /* Set REG_CONTROL1.SWREG_PROGRAM */
3892 REG_WRITE(ah, AR_RTC_REG_CONTROL1, 3947 REG_WRITE(ah, AR_RTC_REG_CONTROL1,
3893 REG_READ(ah, 3948 REG_READ(ah,
@@ -3898,22 +3953,24 @@ static void ar9003_hw_internal_regulator_apply(struct ath_hw *ah)
3898 if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) { 3953 if (AR_SREV_9330(ah) || AR_SREV_9485(ah)) {
3899 REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0); 3954 REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0);
3900 while (REG_READ_FIELD(ah, AR_PHY_PMU2, 3955 while (REG_READ_FIELD(ah, AR_PHY_PMU2,
3901 AR_PHY_PMU2_PGM)) 3956 AR_PHY_PMU2_PGM))
3902 udelay(10); 3957 udelay(10);
3903 3958
3904 REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1); 3959 REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1);
3905 while (!REG_READ_FIELD(ah, AR_PHY_PMU1, 3960 while (!REG_READ_FIELD(ah, AR_PHY_PMU1,
3906 AR_PHY_PMU1_PWD)) 3961 AR_PHY_PMU1_PWD))
3907 udelay(10); 3962 udelay(10);
3908 REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1); 3963 REG_RMW_FIELD(ah, AR_PHY_PMU2, AR_PHY_PMU2_PGM, 0x1);
3909 while (!REG_READ_FIELD(ah, AR_PHY_PMU2, 3964 while (!REG_READ_FIELD(ah, AR_PHY_PMU2,
3910 AR_PHY_PMU2_PGM)) 3965 AR_PHY_PMU2_PGM))
3911 udelay(10); 3966 udelay(10);
3912 } else 3967 } else if (AR_SREV_9480(ah))
3913 REG_WRITE(ah, AR_RTC_SLEEP_CLK, 3968 REG_RMW_FIELD(ah, AR_PHY_PMU1, AR_PHY_PMU1_PWD, 0x1);
3914 (REG_READ(ah, 3969 else {
3915 AR_RTC_SLEEP_CLK) | 3970 reg_val = REG_READ(ah, AR_RTC_SLEEP_CLK) |
3916 AR_RTC_FORCE_SWREG_PRD)); 3971 AR_RTC_FORCE_SWREG_PRD;
3972 REG_WRITE(ah, AR_RTC_SLEEP_CLK, reg_val);
3973 }
3917 } 3974 }
3918 3975
3919} 3976}
@@ -4493,6 +4550,12 @@ static int ar9003_hw_power_control_override(struct ath_hw *ah,
4493 tempSlope = eep->modalHeader5G.tempSlope; 4550 tempSlope = eep->modalHeader5G.tempSlope;
4494 4551
4495 REG_RMW_FIELD(ah, AR_PHY_TPC_19, AR_PHY_TPC_19_ALPHA_THERM, tempSlope); 4552 REG_RMW_FIELD(ah, AR_PHY_TPC_19, AR_PHY_TPC_19_ALPHA_THERM, tempSlope);
4553
4554 if (AR_SREV_9480_20(ah))
4555 REG_RMW_FIELD(ah, AR_PHY_TPC_19_B1,
4556 AR_PHY_TPC_19_B1_ALPHA_THERM, tempSlope);
4557
4558
4496 REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE, 4559 REG_RMW_FIELD(ah, AR_PHY_TPC_18, AR_PHY_TPC_18_THERM_CAL_VALUE,
4497 temperature[0]); 4560 temperature[0]);
4498 4561
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
index ab21a4915981..6335a867527e 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h
@@ -233,7 +233,8 @@ struct ar9300_modal_eep_header {
233 u8 thresh62; 233 u8 thresh62;
234 __le32 papdRateMaskHt20; 234 __le32 papdRateMaskHt20;
235 __le32 papdRateMaskHt40; 235 __le32 papdRateMaskHt40;
236 u8 futureModal[10]; 236 __le16 switchcomspdt;
237 u8 futureModal[8];
237} __packed; 238} __packed;
238 239
239struct ar9300_cal_data_per_freq_op_loop { 240struct ar9300_cal_data_per_freq_op_loop {
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_hw.c b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
index 6b54700eff5b..901f417bb036 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_hw.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_hw.c
@@ -22,6 +22,8 @@
22#include "ar9330_1p1_initvals.h" 22#include "ar9330_1p1_initvals.h"
23#include "ar9330_1p2_initvals.h" 23#include "ar9330_1p2_initvals.h"
24#include "ar9580_1p0_initvals.h" 24#include "ar9580_1p0_initvals.h"
25#include "ar9480_1p0_initvals.h"
26#include "ar9480_2p0_initvals.h"
25 27
26/* General hardware code for the AR9003 hadware family */ 28/* General hardware code for the AR9003 hadware family */
27 29
@@ -32,6 +34,14 @@
32 */ 34 */
33static void ar9003_hw_init_mode_regs(struct ath_hw *ah) 35static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
34{ 36{
37#define PCIE_PLL_ON_CREQ_DIS_L1_2P0 \
38 ar9480_pciephy_pll_on_clkreq_disable_L1_2p0
39
40#define AR9480_BB_CTX_COEFJ(x) \
41 ar9480_##x##_baseband_core_txfir_coeff_japan_2484
42
43#define AR9480_BBC_TXIFR_COEFFJ \
44 ar9480_2p0_baseband_core_txfir_coeff_japan_2484
35 if (AR_SREV_9330_11(ah)) { 45 if (AR_SREV_9330_11(ah)) {
36 /* mac */ 46 /* mac */
37 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 47 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
@@ -254,6 +264,132 @@ static void ar9003_hw_init_mode_regs(struct ath_hw *ah)
254 ar9485_1_1_pcie_phy_clkreq_disable_L1, 264 ar9485_1_1_pcie_phy_clkreq_disable_L1,
255 ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1), 265 ARRAY_SIZE(ar9485_1_1_pcie_phy_clkreq_disable_L1),
256 2); 266 2);
267 } else if (AR_SREV_9480_10(ah)) {
268 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
269 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9480_1p0_mac_core,
270 ARRAY_SIZE(ar9480_1p0_mac_core), 2);
271 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
272 ar9480_1p0_mac_postamble,
273 ARRAY_SIZE(ar9480_1p0_mac_postamble),
274 5);
275
276 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
277 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
278 ar9480_1p0_baseband_core,
279 ARRAY_SIZE(ar9480_1p0_baseband_core),
280 2);
281 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
282 ar9480_1p0_baseband_postamble,
283 ARRAY_SIZE(ar9480_1p0_baseband_postamble), 5);
284
285 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
286 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
287 ar9480_1p0_radio_core,
288 ARRAY_SIZE(ar9480_1p0_radio_core), 2);
289 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
290 ar9480_1p0_radio_postamble,
291 ARRAY_SIZE(ar9480_1p0_radio_postamble), 5);
292
293 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
294 ar9480_1p0_soc_preamble,
295 ARRAY_SIZE(ar9480_1p0_soc_preamble), 2);
296 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
297 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
298 ar9480_1p0_soc_postamble,
299 ARRAY_SIZE(ar9480_1p0_soc_postamble), 5);
300
301 INIT_INI_ARRAY(&ah->iniModesRxGain,
302 ar9480_common_rx_gain_table_1p0,
303 ARRAY_SIZE(ar9480_common_rx_gain_table_1p0), 2);
304
305 /* Awake -> Sleep Setting */
306 INIT_INI_ARRAY(&ah->iniPcieSerdes,
307 ar9480_pcie_phy_clkreq_disable_L1_1p0,
308 ARRAY_SIZE(ar9480_pcie_phy_clkreq_disable_L1_1p0),
309 2);
310
311 /* Sleep -> Awake Setting */
312 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
313 ar9480_pcie_phy_clkreq_disable_L1_1p0,
314 ARRAY_SIZE(ar9480_pcie_phy_clkreq_disable_L1_1p0),
315 2);
316
317 INIT_INI_ARRAY(&ah->iniModesAdditional,
318 ar9480_modes_fast_clock_1p0,
319 ARRAY_SIZE(ar9480_modes_fast_clock_1p0), 3);
320 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
321 AR9480_BB_CTX_COEFJ(1p0),
322 ARRAY_SIZE(AR9480_BB_CTX_COEFJ(1p0)), 2);
323
324 } else if (AR_SREV_9480_20(ah)) {
325
326 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
327 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_CORE], ar9480_2p0_mac_core,
328 ARRAY_SIZE(ar9480_2p0_mac_core), 2);
329 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_POST],
330 ar9480_2p0_mac_postamble,
331 ARRAY_SIZE(ar9480_2p0_mac_postamble), 5);
332
333 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_PRE], NULL, 0, 0);
334 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_CORE],
335 ar9480_2p0_baseband_core,
336 ARRAY_SIZE(ar9480_2p0_baseband_core), 2);
337 INIT_INI_ARRAY(&ah->iniBB[ATH_INI_POST],
338 ar9480_2p0_baseband_postamble,
339 ARRAY_SIZE(ar9480_2p0_baseband_postamble), 5);
340
341 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_PRE], NULL, 0, 0);
342 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_CORE],
343 ar9480_2p0_radio_core,
344 ARRAY_SIZE(ar9480_2p0_radio_core), 2);
345 INIT_INI_ARRAY(&ah->iniRadio[ATH_INI_POST],
346 ar9480_2p0_radio_postamble,
347 ARRAY_SIZE(ar9480_2p0_radio_postamble), 5);
348 INIT_INI_ARRAY(&ah->ini_radio_post_sys2ant,
349 ar9480_2p0_radio_postamble_sys2ant,
350 ARRAY_SIZE(ar9480_2p0_radio_postamble_sys2ant),
351 5);
352
353 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_PRE],
354 ar9480_2p0_soc_preamble,
355 ARRAY_SIZE(ar9480_2p0_soc_preamble), 2);
356 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_CORE], NULL, 0, 0);
357 INIT_INI_ARRAY(&ah->iniSOC[ATH_INI_POST],
358 ar9480_2p0_soc_postamble,
359 ARRAY_SIZE(ar9480_2p0_soc_postamble), 5);
360
361 INIT_INI_ARRAY(&ah->iniModesRxGain,
362 ar9480_common_rx_gain_table_2p0,
363 ARRAY_SIZE(ar9480_common_rx_gain_table_2p0), 2);
364
365 INIT_INI_ARRAY(&ah->ini_BTCOEX_MAX_TXPWR,
366 ar9480_2p0_BTCOEX_MAX_TXPWR_table,
367 ARRAY_SIZE(ar9480_2p0_BTCOEX_MAX_TXPWR_table),
368 2);
369
370 /* Awake -> Sleep Setting */
371 INIT_INI_ARRAY(&ah->iniPcieSerdes,
372 PCIE_PLL_ON_CREQ_DIS_L1_2P0,
373 ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
374 2);
375 /* Sleep -> Awake Setting */
376 INIT_INI_ARRAY(&ah->iniPcieSerdesLowPower,
377 PCIE_PLL_ON_CREQ_DIS_L1_2P0,
378 ARRAY_SIZE(PCIE_PLL_ON_CREQ_DIS_L1_2P0),
379 2);
380
381 /* Fast clock modal settings */
382 INIT_INI_ARRAY(&ah->iniModesAdditional,
383 ar9480_modes_fast_clock_2p0,
384 ARRAY_SIZE(ar9480_modes_fast_clock_2p0), 3);
385
386 INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
387 AR9480_BB_CTX_COEFJ(2p0),
388 ARRAY_SIZE(AR9480_BB_CTX_COEFJ(2p0)), 2);
389
390 INIT_INI_ARRAY(&ah->ini_japan2484, AR9480_BBC_TXIFR_COEFFJ,
391 ARRAY_SIZE(AR9480_BBC_TXIFR_COEFFJ), 2);
392
257 } else if (AR_SREV_9580(ah)) { 393 } else if (AR_SREV_9580(ah)) {
258 /* mac */ 394 /* mac */
259 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0); 395 INIT_INI_ARRAY(&ah->iniMac[ATH_INI_PRE], NULL, 0, 0);
@@ -401,6 +537,16 @@ static void ar9003_tx_gain_table_mode0(struct ath_hw *ah)
401 ar9580_1p0_lowest_ob_db_tx_gain_table, 537 ar9580_1p0_lowest_ob_db_tx_gain_table,
402 ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table), 538 ARRAY_SIZE(ar9580_1p0_lowest_ob_db_tx_gain_table),
403 5); 539 5);
540 else if (AR_SREV_9480_10(ah))
541 INIT_INI_ARRAY(&ah->iniModesTxGain,
542 ar9480_modes_low_ob_db_tx_gain_table_1p0,
543 ARRAY_SIZE(ar9480_modes_low_ob_db_tx_gain_table_1p0),
544 5);
545 else if (AR_SREV_9480_20(ah))
546 INIT_INI_ARRAY(&ah->iniModesTxGain,
547 ar9480_modes_low_ob_db_tx_gain_table_2p0,
548 ARRAY_SIZE(ar9480_modes_low_ob_db_tx_gain_table_2p0),
549 5);
404 else 550 else
405 INIT_INI_ARRAY(&ah->iniModesTxGain, 551 INIT_INI_ARRAY(&ah->iniModesTxGain,
406 ar9300Modes_lowest_ob_db_tx_gain_table_2p2, 552 ar9300Modes_lowest_ob_db_tx_gain_table_2p2,
@@ -435,6 +581,16 @@ static void ar9003_tx_gain_table_mode1(struct ath_hw *ah)
435 ar9580_1p0_high_ob_db_tx_gain_table, 581 ar9580_1p0_high_ob_db_tx_gain_table,
436 ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table), 582 ARRAY_SIZE(ar9580_1p0_high_ob_db_tx_gain_table),
437 5); 583 5);
584 else if (AR_SREV_9480_10(ah))
585 INIT_INI_ARRAY(&ah->iniModesTxGain,
586 ar9480_modes_high_ob_db_tx_gain_table_1p0,
587 ARRAY_SIZE(ar9480_modes_high_ob_db_tx_gain_table_1p0),
588 5);
589 else if (AR_SREV_9480_20(ah))
590 INIT_INI_ARRAY(&ah->iniModesTxGain,
591 ar9480_modes_high_ob_db_tx_gain_table_2p0,
592 ARRAY_SIZE(ar9480_modes_high_ob_db_tx_gain_table_2p0),
593 5);
438 else 594 else
439 INIT_INI_ARRAY(&ah->iniModesTxGain, 595 INIT_INI_ARRAY(&ah->iniModesTxGain,
440 ar9300Modes_high_ob_db_tx_gain_table_2p2, 596 ar9300Modes_high_ob_db_tx_gain_table_2p2,
@@ -556,6 +712,16 @@ static void ar9003_rx_gain_table_mode0(struct ath_hw *ah)
556 ar9580_1p0_rx_gain_table, 712 ar9580_1p0_rx_gain_table,
557 ARRAY_SIZE(ar9580_1p0_rx_gain_table), 713 ARRAY_SIZE(ar9580_1p0_rx_gain_table),
558 2); 714 2);
715 else if (AR_SREV_9480_10(ah))
716 INIT_INI_ARRAY(&ah->iniModesRxGain,
717 ar9480_common_rx_gain_table_1p0,
718 ARRAY_SIZE(ar9480_common_rx_gain_table_1p0),
719 2);
720 else if (AR_SREV_9480_20(ah))
721 INIT_INI_ARRAY(&ah->iniModesRxGain,
722 ar9480_common_rx_gain_table_2p0,
723 ARRAY_SIZE(ar9480_common_rx_gain_table_2p0),
724 2);
559 else 725 else
560 INIT_INI_ARRAY(&ah->iniModesRxGain, 726 INIT_INI_ARRAY(&ah->iniModesRxGain,
561 ar9300Common_rx_gain_table_2p2, 727 ar9300Common_rx_gain_table_2p2,
@@ -585,6 +751,16 @@ static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
585 ar9485Common_wo_xlna_rx_gain_1_1, 751 ar9485Common_wo_xlna_rx_gain_1_1,
586 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1), 752 ARRAY_SIZE(ar9485Common_wo_xlna_rx_gain_1_1),
587 2); 753 2);
754 else if (AR_SREV_9480_10(ah))
755 INIT_INI_ARRAY(&ah->iniModesRxGain,
756 ar9480_common_wo_xlna_rx_gain_table_1p0,
757 ARRAY_SIZE(ar9480_common_wo_xlna_rx_gain_table_1p0),
758 2);
759 else if (AR_SREV_9480_20(ah))
760 INIT_INI_ARRAY(&ah->iniModesRxGain,
761 ar9480_common_wo_xlna_rx_gain_table_2p0,
762 ARRAY_SIZE(ar9480_common_wo_xlna_rx_gain_table_2p0),
763 2);
588 else if (AR_SREV_9580(ah)) 764 else if (AR_SREV_9580(ah))
589 INIT_INI_ARRAY(&ah->iniModesRxGain, 765 INIT_INI_ARRAY(&ah->iniModesRxGain,
590 ar9580_1p0_wo_xlna_rx_gain_table, 766 ar9580_1p0_wo_xlna_rx_gain_table,
@@ -597,6 +773,18 @@ static void ar9003_rx_gain_table_mode1(struct ath_hw *ah)
597 2); 773 2);
598} 774}
599 775
776static void ar9003_rx_gain_table_mode2(struct ath_hw *ah)
777{
778 if (AR_SREV_9480_10(ah))
779 INIT_INI_ARRAY(&ah->iniModesRxGain,
780 ar9480_common_mixed_rx_gain_table_1p0,
781 ARRAY_SIZE(ar9480_common_mixed_rx_gain_table_1p0), 2);
782 else if (AR_SREV_9480_20(ah))
783 INIT_INI_ARRAY(&ah->iniModesRxGain,
784 ar9480_common_mixed_rx_gain_table_2p0,
785 ARRAY_SIZE(ar9480_common_mixed_rx_gain_table_2p0), 2);
786}
787
600static void ar9003_rx_gain_table_apply(struct ath_hw *ah) 788static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
601{ 789{
602 switch (ar9003_hw_get_rx_gain_idx(ah)) { 790 switch (ar9003_hw_get_rx_gain_idx(ah)) {
@@ -607,6 +795,9 @@ static void ar9003_rx_gain_table_apply(struct ath_hw *ah)
607 case 1: 795 case 1:
608 ar9003_rx_gain_table_mode1(ah); 796 ar9003_rx_gain_table_mode1(ah);
609 break; 797 break;
798 case 2:
799 ar9003_rx_gain_table_mode2(ah);
800 break;
610 } 801 }
611} 802}
612 803
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
index bb2214f425b2..609acb2b504f 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
@@ -147,7 +147,7 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
147 AR_PHY_PAPRD_CTRL1_B2 147 AR_PHY_PAPRD_CTRL1_B2
148 }; 148 };
149 int training_power; 149 int training_power;
150 int i; 150 int i, val;
151 151
152 if (IS_CHAN_2GHZ(ah->curchan)) 152 if (IS_CHAN_2GHZ(ah->curchan))
153 training_power = ar9003_get_training_power_2g(ah); 153 training_power = ar9003_get_training_power_2g(ah);
@@ -207,8 +207,9 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
207 AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING, 28); 207 AR_PHY_PAPRD_TRAINER_CNTL1_CF_PAPRD_AGC2_SETTLING, 28);
208 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1, 208 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL1,
209 AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE, 1); 209 AR_PHY_PAPRD_TRAINER_CNTL1_CF_CF_PAPRD_TRAIN_ENABLE, 1);
210 val = AR_SREV_9480(ah) ? 0x91 : 147;
210 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL2, 211 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL2,
211 AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN, 147); 212 AR_PHY_PAPRD_TRAINER_CNTL2_CF_PAPRD_INIT_RX_BB_GAIN, val);
212 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 213 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
213 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN, 4); 214 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_FINE_CORR_LEN, 4);
214 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 215 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
@@ -217,7 +218,7 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
217 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7); 218 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_NUM_CORR_STAGES, 7);
218 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 219 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
219 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1); 220 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_MIN_LOOPBACK_DEL, 1);
220 if (AR_SREV_9485(ah)) 221 if (AR_SREV_9485(ah) || AR_SREV_9480(ah))
221 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 222 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
222 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 223 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP,
223 -3); 224 -3);
@@ -225,9 +226,10 @@ static int ar9003_paprd_setup_single_table(struct ath_hw *ah)
225 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 226 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
226 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, 227 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP,
227 -6); 228 -6);
229 val = AR_SREV_9480(ah) ? -10 : -15;
228 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 230 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
229 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE, 231 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_ADC_DESIRED_SIZE,
230 -15); 232 val);
231 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3, 233 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL3,
232 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE, 1); 234 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_BBTXMIX_DISABLE, 1);
233 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL4, 235 REG_RMW_FIELD(ah, AR_PHY_PAPRD_TRAINER_CNTL4,
@@ -757,6 +759,7 @@ void ar9003_paprd_populate_single_table(struct ath_hw *ah,
757 training_power); 759 training_power);
758 760
759 if (ah->caps.tx_chainmask & BIT(2)) 761 if (ah->caps.tx_chainmask & BIT(2))
762 /* val AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL correct? */
760 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B2, 763 REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL1_B2,
761 AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL, 764 AR_PHY_PAPRD_CTRL1_PAPRD_POWER_AT_AM2AM_CAL,
762 training_power); 765 training_power);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 33edb5653ca6..95147948794d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -559,6 +559,9 @@ static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
559 559
560 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7)) 560 if ((ah->caps.hw_caps & ATH9K_HW_CAP_APM) && (tx == 0x7))
561 REG_WRITE(ah, AR_SELFGEN_MASK, 0x3); 561 REG_WRITE(ah, AR_SELFGEN_MASK, 0x3);
562 else if (AR_SREV_9480(ah))
563 /* xxx only when MCI support is enabled */
564 REG_WRITE(ah, AR_SELFGEN_MASK, 0x3);
562 else 565 else
563 REG_WRITE(ah, AR_SELFGEN_MASK, tx); 566 REG_WRITE(ah, AR_SELFGEN_MASK, tx);
564 567
@@ -658,6 +661,10 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
658 ar9003_hw_prog_ini(ah, &ah->iniMac[i], modesIndex); 661 ar9003_hw_prog_ini(ah, &ah->iniMac[i], modesIndex);
659 ar9003_hw_prog_ini(ah, &ah->iniBB[i], modesIndex); 662 ar9003_hw_prog_ini(ah, &ah->iniBB[i], modesIndex);
660 ar9003_hw_prog_ini(ah, &ah->iniRadio[i], modesIndex); 663 ar9003_hw_prog_ini(ah, &ah->iniRadio[i], modesIndex);
664 if (i == ATH_INI_POST && AR_SREV_9480_20(ah))
665 ar9003_hw_prog_ini(ah,
666 &ah->ini_radio_post_sys2ant,
667 modesIndex);
661 } 668 }
662 669
663 REG_WRITE_ARRAY(&ah->iniModesRxGain, 1, regWrites); 670 REG_WRITE_ARRAY(&ah->iniModesRxGain, 1, regWrites);
@@ -677,6 +684,9 @@ static int ar9003_hw_process_ini(struct ath_hw *ah,
677 if (AR_SREV_9340(ah) && !ah->is_clk_25mhz) 684 if (AR_SREV_9340(ah) && !ah->is_clk_25mhz)
678 REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites); 685 REG_WRITE_ARRAY(&ah->iniModesAdditional_40M, 1, regWrites);
679 686
687 if (AR_SREV_9480(ah))
688 ar9003_hw_prog_ini(ah, &ah->ini_BTCOEX_MAX_TXPWR, 1);
689
680 ar9003_hw_override_ini(ah); 690 ar9003_hw_override_ini(ah);
681 ar9003_hw_set_channel_regs(ah, chan); 691 ar9003_hw_set_channel_regs(ah, chan);
682 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); 692 ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f2065fce4ec9..4ace66c9d59d 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -580,6 +580,7 @@ static int __ath9k_hw_init(struct ath_hw *ah)
580 case AR_SREV_VERSION_9330: 580 case AR_SREV_VERSION_9330:
581 case AR_SREV_VERSION_9485: 581 case AR_SREV_VERSION_9485:
582 case AR_SREV_VERSION_9340: 582 case AR_SREV_VERSION_9340:
583 case AR_SREV_VERSION_9480:
583 break; 584 break;
584 default: 585 default:
585 ath_err(common, 586 ath_err(common,
@@ -664,6 +665,7 @@ int ath9k_hw_init(struct ath_hw *ah)
664 case AR9300_DEVID_AR9330: 665 case AR9300_DEVID_AR9330:
665 case AR9300_DEVID_AR9340: 666 case AR9300_DEVID_AR9340:
666 case AR9300_DEVID_AR9580: 667 case AR9300_DEVID_AR9580:
668 case AR9300_DEVID_AR9480:
667 break; 669 break;
668 default: 670 default:
669 if (common->bus_ops->ath_bus_type == ATH_USB) 671 if (common->bus_ops->ath_bus_type == ATH_USB)
@@ -1340,6 +1342,7 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah)
1340 1342
1341static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type) 1343static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1342{ 1344{
1345
1343 if (AR_SREV_9300_20_OR_LATER(ah)) { 1346 if (AR_SREV_9300_20_OR_LATER(ah)) {
1344 REG_WRITE(ah, AR_WA, ah->WARegVal); 1347 REG_WRITE(ah, AR_WA, ah->WARegVal);
1345 udelay(10); 1348 udelay(10);
@@ -1743,25 +1746,41 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
1743{ 1746{
1744 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 1747 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
1745 if (setChip) { 1748 if (setChip) {
1749 if (AR_SREV_9480(ah)) {
1750 REG_WRITE(ah, AR_TIMER_MODE,
1751 REG_READ(ah, AR_TIMER_MODE) & 0xFFFFFF00);
1752 REG_WRITE(ah, AR_NDP2_TIMER_MODE, REG_READ(ah,
1753 AR_NDP2_TIMER_MODE) & 0xFFFFFF00);
1754 REG_WRITE(ah, AR_SLP32_INC,
1755 REG_READ(ah, AR_SLP32_INC) & 0xFFF00000);
1756 /* xxx Required for WLAN only case ? */
1757 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, 0);
1758 udelay(100);
1759 }
1760
1746 /* 1761 /*
1747 * Clear the RTC force wake bit to allow the 1762 * Clear the RTC force wake bit to allow the
1748 * mac to go to sleep. 1763 * mac to go to sleep.
1749 */ 1764 */
1750 REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, 1765 REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN);
1751 AR_RTC_FORCE_WAKE_EN); 1766
1767 if (AR_SREV_9480(ah))
1768 udelay(100);
1769
1752 if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah)) 1770 if (!AR_SREV_9100(ah) && !AR_SREV_9300_20_OR_LATER(ah))
1753 REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF); 1771 REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF);
1754 1772
1755 /* Shutdown chip. Active low */ 1773 /* Shutdown chip. Active low */
1756 if (!AR_SREV_5416(ah) && !AR_SREV_9271(ah)) 1774 if (!AR_SREV_5416(ah) &&
1757 REG_CLR_BIT(ah, (AR_RTC_RESET), 1775 !AR_SREV_9271(ah) && !AR_SREV_9480_10(ah)) {
1758 AR_RTC_RESET_EN); 1776 REG_CLR_BIT(ah, AR_RTC_RESET, AR_RTC_RESET_EN);
1777 udelay(2);
1778 }
1759 } 1779 }
1760 1780
1761 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */ 1781 /* Clear Bit 14 of AR_WA after putting chip into Full Sleep mode. */
1762 if (AR_SREV_9300_20_OR_LATER(ah)) 1782 if (!AR_SREV_9480(ah))
1763 REG_WRITE(ah, AR_WA, 1783 REG_WRITE(ah, AR_WA, ah->WARegVal & ~AR_WA_D3_L1_DISABLE);
1764 ah->WARegVal & ~AR_WA_D3_L1_DISABLE);
1765} 1784}
1766 1785
1767/* 1786/*
@@ -1771,6 +1790,8 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
1771 */ 1790 */
1772static void ath9k_set_power_network_sleep(struct ath_hw *ah, int setChip) 1791static void ath9k_set_power_network_sleep(struct ath_hw *ah, int setChip)
1773{ 1792{
1793 u32 val;
1794
1774 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV); 1795 REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
1775 if (setChip) { 1796 if (setChip) {
1776 struct ath9k_hw_capabilities *pCap = &ah->caps; 1797 struct ath9k_hw_capabilities *pCap = &ah->caps;
@@ -1780,12 +1801,30 @@ static void ath9k_set_power_network_sleep(struct ath_hw *ah, int setChip)
1780 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 1801 REG_WRITE(ah, AR_RTC_FORCE_WAKE,
1781 AR_RTC_FORCE_WAKE_ON_INT); 1802 AR_RTC_FORCE_WAKE_ON_INT);
1782 } else { 1803 } else {
1804
1805 /* When chip goes into network sleep, it could be waken
1806 * up by MCI_INT interrupt caused by BT's HW messages
1807 * (LNA_xxx, CONT_xxx) which chould be in a very fast
1808 * rate (~100us). This will cause chip to leave and
1809 * re-enter network sleep mode frequently, which in
1810 * consequence will have WLAN MCI HW to generate lots of
1811 * SYS_WAKING and SYS_SLEEPING messages which will make
1812 * BT CPU to busy to process.
1813 */
1814 if (AR_SREV_9480(ah)) {
1815 val = REG_READ(ah, AR_MCI_INTERRUPT_RX_MSG_EN) &
1816 ~AR_MCI_INTERRUPT_RX_HW_MSG_MASK;
1817 REG_WRITE(ah, AR_MCI_INTERRUPT_RX_MSG_EN, val);
1818 }
1783 /* 1819 /*
1784 * Clear the RTC force wake bit to allow the 1820 * Clear the RTC force wake bit to allow the
1785 * mac to go to sleep. 1821 * mac to go to sleep.
1786 */ 1822 */
1787 REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE, 1823 REG_CLR_BIT(ah, AR_RTC_FORCE_WAKE,
1788 AR_RTC_FORCE_WAKE_EN); 1824 AR_RTC_FORCE_WAKE_EN);
1825
1826 if (AR_SREV_9480(ah))
1827 udelay(30);
1789 } 1828 }
1790 } 1829 }
1791 1830
@@ -2404,6 +2443,9 @@ void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
2404 2443
2405 ENABLE_REGWRITE_BUFFER(ah); 2444 ENABLE_REGWRITE_BUFFER(ah);
2406 2445
2446 if (AR_SREV_9480(ah))
2447 bits |= ATH9K_RX_FILTER_CONTROL_WRAPPER;
2448
2407 REG_WRITE(ah, AR_RX_FILTER, bits); 2449 REG_WRITE(ah, AR_RX_FILTER, bits);
2408 2450
2409 phybits = 0; 2451 phybits = 0;
@@ -2660,6 +2702,20 @@ void ath9k_hw_gen_timer_start(struct ath_hw *ah,
2660 REG_SET_BIT(ah, gen_tmr_configuration[timer->index].mode_addr, 2702 REG_SET_BIT(ah, gen_tmr_configuration[timer->index].mode_addr,
2661 gen_tmr_configuration[timer->index].mode_mask); 2703 gen_tmr_configuration[timer->index].mode_mask);
2662 2704
2705 if (AR_SREV_9480(ah)) {
2706 /*
2707 * Starting from AR9480, each generic timer can select which tsf
2708 * to use. But we still follow the old rule, 0 - 7 use tsf and
2709 * 8 - 15 use tsf2.
2710 */
2711 if ((timer->index < AR_GEN_TIMER_BANK_1_LEN))
2712 REG_CLR_BIT(ah, AR_MAC_PCU_GEN_TIMER_TSF_SEL,
2713 (1 << timer->index));
2714 else
2715 REG_SET_BIT(ah, AR_MAC_PCU_GEN_TIMER_TSF_SEL,
2716 (1 << timer->index));
2717 }
2718
2663 /* Enable both trigger and thresh interrupt masks */ 2719 /* Enable both trigger and thresh interrupt masks */
2664 REG_SET_BIT(ah, AR_IMR_S5, 2720 REG_SET_BIT(ah, AR_IMR_S5,
2665 (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) | 2721 (SM(AR_GENTMR_BIT(timer->index), AR_IMR_S5_GENTIMER_THRESH) |
@@ -2765,6 +2821,7 @@ static struct {
2765 { AR_SREV_VERSION_9330, "9330" }, 2821 { AR_SREV_VERSION_9330, "9330" },
2766 { AR_SREV_VERSION_9340, "9340" }, 2822 { AR_SREV_VERSION_9340, "9340" },
2767 { AR_SREV_VERSION_9485, "9485" }, 2823 { AR_SREV_VERSION_9485, "9485" },
2824 { AR_SREV_VERSION_9480, "9480" },
2768}; 2825};
2769 2826
2770/* For devices with external radios */ 2827/* For devices with external radios */
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 891661a61513..bda2233126d0 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -33,6 +33,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath_pci_id_table) = {
33 { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */ 33 { PCI_VDEVICE(ATHEROS, 0x0030) }, /* PCI-E AR9300 */
34 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */ 34 { PCI_VDEVICE(ATHEROS, 0x0032) }, /* PCI-E AR9485 */
35 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */ 35 { PCI_VDEVICE(ATHEROS, 0x0033) }, /* PCI-E AR9580 */
36 { PCI_VDEVICE(ATHEROS, 0x0034) }, /* PCI-E AR9480 */
36 { 0 } 37 { 0 }
37}; 38};
38 39