ath9k: Advertise support for TDLS
[deliverable/linux.git] / drivers / net / wireless / ath / ath9k / init.c
index d7761d1fc5ba7c4813c4808488d6f2fd29735dbc..5cb0599b01c250d6ebd00168c2799e5726734f8b 100644 (file)
@@ -270,8 +270,8 @@ static void setup_ht_cap(struct ath_softc *sc,
 
        /* set up supported mcs set */
        memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
-       tx_streams = ath9k_cmn_count_streams(common->tx_chainmask, max_streams);
-       rx_streams = ath9k_cmn_count_streams(common->rx_chainmask, max_streams);
+       tx_streams = ath9k_cmn_count_streams(ah->txchainmask, max_streams);
+       rx_streams = ath9k_cmn_count_streams(ah->rxchainmask, max_streams);
 
        ath_dbg(common, ATH_DBG_CONFIG,
                "TX streams %d, RX streams: %d\n",
@@ -423,6 +423,8 @@ static int ath9k_init_btcoex(struct ath_softc *sc)
                txq = sc->tx.txq_map[WME_AC_BE];
                ath9k_hw_init_btcoex_hw(sc->sc_ah, txq->axq_qnum);
                sc->btcoex.bt_stomp_type = ATH_BTCOEX_STOMP_LOW;
+               sc->btcoex.duty_cycle = ATH_BTCOEX_DEF_DUTY_CYCLE;
+               INIT_LIST_HEAD(&sc->btcoex.mci.info);
                break;
        default:
                WARN_ON(1);
@@ -506,10 +508,6 @@ static void ath9k_init_misc(struct ath_softc *sc)
                sc->sc_flags |= SC_OP_RXAGGR;
        }
 
-       common->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
-       common->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
-
-       ath9k_hw_set_diversity(sc->sc_ah, true);
        sc->rx.defant = ath9k_hw_getdefantenna(sc->sc_ah);
 
        memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
@@ -572,6 +570,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
        mutex_init(&sc->mutex);
 #ifdef CONFIG_ATH9K_DEBUGFS
        spin_lock_init(&sc->nodes_lock);
+       spin_lock_init(&sc->debug.samp_lock);
        INIT_LIST_HEAD(&sc->nodes);
 #endif
        tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc);
@@ -629,7 +628,6 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
        struct ieee80211_supported_band *sband;
        struct ieee80211_channel *chan;
        struct ath_hw *ah = sc->sc_ah;
-       struct ath_regulatory *reg = ath9k_hw_regulatory(ah);
        int i;
 
        sband = &sc->sbands[band];
@@ -638,17 +636,14 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band)
                ah->curchan = &ah->channels[chan->hw_value];
                ath9k_cmn_update_ichannel(ah->curchan, chan, NL80211_CHAN_HT20);
                ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true);
-               chan->max_power = reg->max_power_level / 2;
        }
 }
 
 static void ath9k_init_txpower_limits(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
-       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
        struct ath9k_channel *curchan = ah->curchan;
 
-       ah->txchainmask = common->tx_chainmask;
        if (ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
                ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ);
        if (ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
@@ -657,9 +652,22 @@ static void ath9k_init_txpower_limits(struct ath_softc *sc)
        ah->curchan = curchan;
 }
 
+void ath9k_reload_chainmask_settings(struct ath_softc *sc)
+{
+       if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT))
+               return;
+
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
+               setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
+               setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
+}
+
+
 void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 {
-       struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_common *common = ath9k_hw_common(ah);
 
        hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
                IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
@@ -688,6 +696,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
                hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
 
        hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
+       hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
 
        hw->queues = 4;
        hw->max_rates = 4;
@@ -697,6 +706,16 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
        hw->sta_data_size = sizeof(struct ath_node);
        hw->vif_data_size = sizeof(struct ath_vif);
 
+       hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1;
+       hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1;
+
+       /* single chain devices with rx diversity */
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
+               hw->wiphy->available_antennas_rx = BIT(0) | BIT(1);
+
+       sc->ant_rx = hw->wiphy->available_antennas_rx;
+       sc->ant_tx = hw->wiphy->available_antennas_tx;
+
 #ifdef CONFIG_ATH9K_RATE_CONTROL
        hw->rate_control_algorithm = "ath9k_rate_control";
 #endif
@@ -708,12 +727,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
                hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
                        &sc->sbands[IEEE80211_BAND_5GHZ];
 
-       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
-               if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ)
-                       setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
-               if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ)
-                       setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
-       }
+       ath9k_reload_chainmask_settings(sc);
 
        SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
 }
@@ -781,6 +795,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc,
                        goto error_world;
        }
 
+       INIT_WORK(&sc->hw_reset_work, ath_reset_work);
        INIT_WORK(&sc->hw_check_work, ath_hw_check);
        INIT_WORK(&sc->paprd_work, ath_paprd_calibrate);
        INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work);
This page took 0.045318 seconds and 5 git commands to generate.