ath9k: Fix RTC reset for AR5416
[safe/jmp/linux-2.6] / drivers / net / wireless / ath / ath9k / hw.c
index 6d2ac33..0a3de3f 100644 (file)
@@ -18,7 +18,7 @@
 #include <asm/unaligned.h>
 
 #include "hw.h"
-#include "ath9k.h"
+#include "rc.h"
 #include "initvals.h"
 
 #define ATH9K_CLOCK_RATE_CCK           22
@@ -26,8 +26,7 @@
 #define ATH9K_CLOCK_RATE_2GHZ_OFDM     44
 
 static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type);
-static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
-                             enum ath9k_ht_macmode macmode);
+static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan);
 static u32 ath9k_hw_ini_fixup(struct ath_hw *ah,
                              struct ar5416_eeprom_def *pEepData,
                              u32 reg, u32 value);
@@ -944,6 +943,16 @@ int ath9k_hw_init(struct ath_hw *ah)
        else
                ath9k_hw_disablepcie(ah);
 
+       /* Support for Japan ch.14 (2484) spread */
+       if (AR_SREV_9287_11_OR_LATER(ah)) {
+               INIT_INI_ARRAY(&ah->iniCckfirNormal,
+                      ar9287Common_normal_cck_fir_coeff_92871_1,
+                      ARRAY_SIZE(ar9287Common_normal_cck_fir_coeff_92871_1), 2);
+               INIT_INI_ARRAY(&ah->iniCckfirJapan2484,
+                      ar9287Common_japan_2484_cck_fir_coeff_92871_1,
+                      ARRAY_SIZE(ar9287Common_japan_2484_cck_fir_coeff_92871_1), 2);
+       }
+
        r = ath9k_hw_post_init(ah);
        if (r)
                return r;
@@ -1352,8 +1361,7 @@ static u32 ath9k_regd_get_ctl(struct ath_regulatory *reg,
 }
 
 static int ath9k_hw_process_ini(struct ath_hw *ah,
-                               struct ath9k_channel *chan,
-                               enum ath9k_ht_macmode macmode)
+                               struct ath9k_channel *chan)
 {
        struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
        int i, regWrites = 0;
@@ -1455,7 +1463,7 @@ static int ath9k_hw_process_ini(struct ath_hw *ah,
        }
 
        ath9k_hw_override_ini(ah, chan);
-       ath9k_hw_set_regs(ah, chan, macmode);
+       ath9k_hw_set_regs(ah, chan);
        ath9k_hw_init_chain_masks(ah);
 
        if (OLC_FOR_AR9280_20_LATER)
@@ -1738,8 +1746,7 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
        }
 }
 
-static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
-                             enum ath9k_ht_macmode macmode)
+static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        u32 phymode;
        u32 enableDacFifo = 0;
@@ -1761,7 +1768,7 @@ static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
        }
        REG_WRITE(ah, AR_PHY_TURBO, phymode);
 
-       ath9k_hw_set11nmac2040(ah, macmode);
+       ath9k_hw_set11nmac2040(ah);
 
        REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
        REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
@@ -1787,8 +1794,7 @@ static bool ath9k_hw_chip_reset(struct ath_hw *ah,
 }
 
 static bool ath9k_hw_channel_change(struct ath_hw *ah,
-                                   struct ath9k_channel *chan,
-                                   enum ath9k_ht_macmode macmode)
+                                   struct ath9k_channel *chan)
 {
        struct ath_regulatory *regulatory = ath9k_hw_regulatory(ah);
        struct ath_common *common = ath9k_hw_common(ah);
@@ -1812,7 +1818,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah,
                return false;
        }
 
-       ath9k_hw_set_regs(ah, chan, macmode);
+       ath9k_hw_set_regs(ah, chan);
 
        if (AR_SREV_9280_10_OR_LATER(ah)) {
                ath9k_hw_ar9280_set_channel(ah, chan);
@@ -2323,7 +2329,6 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
 {
        struct ath_common *common = ath9k_hw_common(ah);
        u32 saveLedState;
-       struct ath_softc *sc = ah->ah_sc;
        struct ath9k_channel *curchan = ah->curchan;
        u32 saveDefAntenna;
        u32 macStaId1;
@@ -2348,7 +2353,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
             !(AR_SREV_9280(ah) || IS_CHAN_A_5MHZ_SPACED(chan) ||
             IS_CHAN_A_5MHZ_SPACED(ah->curchan))) {
 
-               if (ath9k_hw_channel_change(ah, chan, sc->tx_chan_width)) {
+               if (ath9k_hw_channel_change(ah, chan)) {
                        ath9k_hw_loadnf(ah, ah->curchan);
                        ath9k_hw_start_nfcal(ah);
                        return 0;
@@ -2408,7 +2413,7 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
                REG_SET_BIT(ah, AR_MAC_PCU_ASYNC_FIFO_REG3,
                                AR_MAC_PCU_ASYNC_FIFO_REG3_SOFT_RESET);
        }
-       r = ath9k_hw_process_ini(ah, chan, sc->tx_chan_width);
+       r = ath9k_hw_process_ini(ah, chan);
        if (r)
                return r;
 
@@ -2846,8 +2851,9 @@ static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
                if (!AR_SREV_9100(ah))
                        REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF);
 
-               REG_CLR_BIT(ah, (AR_RTC_RESET),
-                           AR_RTC_RESET_EN);
+               if(!AR_SREV_5416(ah))
+                       REG_CLR_BIT(ah, (AR_RTC_RESET),
+                                   AR_RTC_RESET_EN);
        }
 }
 
@@ -3819,7 +3825,7 @@ void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio)
 {
        u32 gpio_shift;
 
-       ASSERT(gpio < ah->caps.num_gpio_pins);
+       BUG_ON(gpio >= ah->caps.num_gpio_pins);
 
        gpio_shift = gpio << 1;
 
@@ -4063,12 +4069,12 @@ bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
        }
 }
 
-void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode)
+void ath9k_hw_set11nmac2040(struct ath_hw *ah)
 {
+       struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
        u32 macmode;
 
-       if (mode == ATH9K_HT_MACMODE_2040 &&
-           !ah->config.cwm_ignore_extcca)
+       if (conf_is_ht40(conf) && !ah->config.cwm_ignore_extcca)
                macmode = AR_2040_JOINED_RX_CLEAR;
        else
                macmode = 0;