• Home
  • Raw
  • Download

Lines Matching refs:sc

173 static void ath9k_deinit_softc(struct ath_softc *sc);
185 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_iowrite32() local
189 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_iowrite32()
190 iowrite32(val, sc->mem + reg_offset); in ath9k_iowrite32()
191 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_iowrite32()
193 iowrite32(val, sc->mem + reg_offset); in ath9k_iowrite32()
200 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_ioread32() local
205 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_ioread32()
206 val = ioread32(sc->mem + reg_offset); in ath9k_ioread32()
207 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_ioread32()
209 val = ioread32(sc->mem + reg_offset); in ath9k_ioread32()
213 static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset, in __ath9k_reg_rmw() argument
218 val = ioread32(sc->mem + reg_offset); in __ath9k_reg_rmw()
221 iowrite32(val, sc->mem + reg_offset); in __ath9k_reg_rmw()
230 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_reg_rmw() local
235 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_reg_rmw()
236 val = __ath9k_reg_rmw(sc, reg_offset, set, clr); in ath9k_reg_rmw()
237 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_reg_rmw()
239 val = __ath9k_reg_rmw(sc, reg_offset, set, clr); in ath9k_reg_rmw()
248 static void setup_ht_cap(struct ath_softc *sc, in setup_ht_cap() argument
251 struct ath_hw *ah = sc->sc_ah; in setup_ht_cap()
262 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_LDPC) in setup_ht_cap()
265 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_SGI_20) in setup_ht_cap()
310 struct ath_softc *sc = hw->priv; in ath9k_reg_notifier() local
311 struct ath_hw *ah = sc->sc_ah; in ath9k_reg_notifier()
318 sc->config.txpowlimit = 2 * ah->curchan->chan->max_power; in ath9k_reg_notifier()
319 ath9k_ps_wakeup(sc); in ath9k_reg_notifier()
320 ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit, false); in ath9k_reg_notifier()
321 sc->curtxpow = ath9k_hw_regulatory(ah)->power_limit; in ath9k_reg_notifier()
323 if (sc->dfs_detector != NULL) in ath9k_reg_notifier()
324 sc->dfs_detector->set_dfs_domain(sc->dfs_detector, in ath9k_reg_notifier()
326 ath9k_ps_restore(sc); in ath9k_reg_notifier()
335 int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, in ath_descdma_setup() argument
339 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_descdma_setup()
350 desc_len = sc->sc_ah->caps.tx_desc_len; in ath_descdma_setup()
368 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) { in ath_descdma_setup()
382 dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, in ath_descdma_setup()
394 bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); in ath_descdma_setup()
402 if (!(sc->sc_ah->caps.hw_caps & in ath_descdma_setup()
424 static int ath9k_init_queues(struct ath_softc *sc) in ath9k_init_queues() argument
428 sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah); in ath9k_init_queues()
429 sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0); in ath9k_init_queues()
431 sc->config.cabqReadytime = ATH_CABQ_READY_TIME; in ath9k_init_queues()
432 ath_cabq_update(sc); in ath9k_init_queues()
435 sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i); in ath9k_init_queues()
436 sc->tx.txq_map[i]->mac80211_qnum = i; in ath9k_init_queues()
437 sc->tx.txq_max_pending[i] = ATH_MAX_QDEPTH; in ath9k_init_queues()
442 static int ath9k_init_channels_rates(struct ath_softc *sc) in ath9k_init_channels_rates() argument
450 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) { in ath9k_init_channels_rates()
451 channels = devm_kzalloc(sc->dev, in ath9k_init_channels_rates()
458 sc->sbands[IEEE80211_BAND_2GHZ].channels = channels; in ath9k_init_channels_rates()
459 sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; in ath9k_init_channels_rates()
460 sc->sbands[IEEE80211_BAND_2GHZ].n_channels = in ath9k_init_channels_rates()
462 sc->sbands[IEEE80211_BAND_2GHZ].bitrates = ath9k_legacy_rates; in ath9k_init_channels_rates()
463 sc->sbands[IEEE80211_BAND_2GHZ].n_bitrates = in ath9k_init_channels_rates()
467 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) { in ath9k_init_channels_rates()
468 channels = devm_kzalloc(sc->dev, in ath9k_init_channels_rates()
475 sc->sbands[IEEE80211_BAND_5GHZ].channels = channels; in ath9k_init_channels_rates()
476 sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; in ath9k_init_channels_rates()
477 sc->sbands[IEEE80211_BAND_5GHZ].n_channels = in ath9k_init_channels_rates()
479 sc->sbands[IEEE80211_BAND_5GHZ].bitrates = in ath9k_init_channels_rates()
481 sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = in ath9k_init_channels_rates()
487 static void ath9k_init_misc(struct ath_softc *sc) in ath9k_init_misc() argument
489 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_init_misc()
492 setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc); in ath9k_init_misc()
494 sc->last_rssi = ATH_RSSI_DUMMY_MARKER; in ath9k_init_misc()
495 sc->config.txpowlimit = ATH_TXPOWER_MAX; in ath9k_init_misc()
497 sc->beacon.slottime = ATH9K_SLOT_TIME_9; in ath9k_init_misc()
499 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) in ath9k_init_misc()
500 sc->beacon.bslot[i] = NULL; in ath9k_init_misc()
502 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) in ath9k_init_misc()
503 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT; in ath9k_init_misc()
505 sc->spec_config.enabled = 0; in ath9k_init_misc()
506 sc->spec_config.short_repeat = true; in ath9k_init_misc()
507 sc->spec_config.count = 8; in ath9k_init_misc()
508 sc->spec_config.endless = false; in ath9k_init_misc()
509 sc->spec_config.period = 0xFF; in ath9k_init_misc()
510 sc->spec_config.fft_period = 0xF; in ath9k_init_misc()
524 static int ath9k_eeprom_request(struct ath_softc *sc, const char *name) in ath9k_eeprom_request() argument
527 struct ath_hw *ah = ah = sc->sc_ah; in ath9k_eeprom_request()
532 ec.ah = sc->sc_ah; in ath9k_eeprom_request()
534 err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL, in ath9k_eeprom_request()
553 static void ath9k_eeprom_release(struct ath_softc *sc) in ath9k_eeprom_release() argument
555 release_firmware(sc->sc_ah->eeprom_blob); in ath9k_eeprom_release()
558 static int ath9k_init_softc(u16 devid, struct ath_softc *sc, in ath9k_init_softc() argument
561 struct ath9k_platform_data *pdata = sc->dev->platform_data; in ath9k_init_softc()
567 ah = devm_kzalloc(sc->dev, sizeof(struct ath_hw), GFP_KERNEL); in ath9k_init_softc()
571 ah->dev = sc->dev; in ath9k_init_softc()
572 ah->hw = sc->hw; in ath9k_init_softc()
578 sc->sc_ah = ah; in ath9k_init_softc()
580 sc->dfs_detector = dfs_pattern_detector_init(ah, NL80211_DFS_UNSET); in ath9k_init_softc()
584 sc->sc_ah->led_pin = -1; in ath9k_init_softc()
586 sc->sc_ah->gpio_mask = pdata->gpio_mask; in ath9k_init_softc()
587 sc->sc_ah->gpio_val = pdata->gpio_val; in ath9k_init_softc()
588 sc->sc_ah->led_pin = pdata->led_pin; in ath9k_init_softc()
598 common->hw = sc->hw; in ath9k_init_softc()
599 common->priv = sc; in ath9k_init_softc()
613 spin_lock_init(&sc->sc_serial_rw); in ath9k_init_softc()
614 spin_lock_init(&sc->sc_pm_lock); in ath9k_init_softc()
615 mutex_init(&sc->mutex); in ath9k_init_softc()
617 spin_lock_init(&sc->debug.samp_lock); in ath9k_init_softc()
619 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); in ath9k_init_softc()
620 tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet, in ath9k_init_softc()
621 (unsigned long)sc); in ath9k_init_softc()
623 INIT_WORK(&sc->hw_reset_work, ath_reset_work); in ath9k_init_softc()
624 INIT_WORK(&sc->hw_check_work, ath_hw_check); in ath9k_init_softc()
625 INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); in ath9k_init_softc()
626 INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); in ath9k_init_softc()
627 setup_timer(&sc->rx_poll_timer, ath_rx_poll, (unsigned long)sc); in ath9k_init_softc()
637 ret = ath9k_eeprom_request(sc, pdata->eeprom_name); in ath9k_init_softc()
650 ret = ath9k_init_queues(sc); in ath9k_init_softc()
654 ret = ath9k_init_btcoex(sc); in ath9k_init_softc()
658 ret = ath9k_init_channels_rates(sc); in ath9k_init_softc()
662 ath9k_cmn_init_crypto(sc->sc_ah); in ath9k_init_softc()
663 ath9k_init_misc(sc); in ath9k_init_softc()
664 ath_fill_led_pin(sc); in ath9k_init_softc()
673 if (ATH_TXQ_SETUP(sc, i)) in ath9k_init_softc()
674 ath_tx_cleanupq(sc, &sc->tx.txq[i]); in ath9k_init_softc()
678 ath9k_eeprom_release(sc); in ath9k_init_softc()
682 static void ath9k_init_band_txpower(struct ath_softc *sc, int band) in ath9k_init_band_txpower() argument
686 struct ath_hw *ah = sc->sc_ah; in ath9k_init_band_txpower()
689 sband = &sc->sbands[band]; in ath9k_init_band_txpower()
698 static void ath9k_init_txpower_limits(struct ath_softc *sc) in ath9k_init_txpower_limits() argument
700 struct ath_hw *ah = sc->sc_ah; in ath9k_init_txpower_limits()
704 ath9k_init_band_txpower(sc, IEEE80211_BAND_2GHZ); in ath9k_init_txpower_limits()
706 ath9k_init_band_txpower(sc, IEEE80211_BAND_5GHZ); in ath9k_init_txpower_limits()
711 void ath9k_reload_chainmask_settings(struct ath_softc *sc) in ath9k_reload_chainmask_settings() argument
713 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)) in ath9k_reload_chainmask_settings()
716 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) in ath9k_reload_chainmask_settings()
717 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); in ath9k_reload_chainmask_settings()
718 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) in ath9k_reload_chainmask_settings()
719 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap); in ath9k_reload_chainmask_settings()
758 void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) in ath9k_set_hw_capab() argument
760 struct ath_hw *ah = sc->sc_ah; in ath9k_set_hw_capab()
772 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) in ath9k_set_hw_capab()
775 if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) in ath9k_set_hw_capab()
799 device_can_wakeup(sc->dev)) { in ath9k_set_hw_capab()
809 atomic_set(&sc->wow_sleep_proc_intr, -1); in ath9k_set_hw_capab()
810 atomic_set(&sc->wow_got_bmiss_intr, -1); in ath9k_set_hw_capab()
829 sc->ant_rx = hw->wiphy->available_antennas_rx; in ath9k_set_hw_capab()
830 sc->ant_tx = hw->wiphy->available_antennas_tx; in ath9k_set_hw_capab()
832 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) in ath9k_set_hw_capab()
834 &sc->sbands[IEEE80211_BAND_2GHZ]; in ath9k_set_hw_capab()
835 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) in ath9k_set_hw_capab()
837 &sc->sbands[IEEE80211_BAND_5GHZ]; in ath9k_set_hw_capab()
839 ath9k_reload_chainmask_settings(sc); in ath9k_set_hw_capab()
844 int ath9k_init_device(u16 devid, struct ath_softc *sc, in ath9k_init_device() argument
847 struct ieee80211_hw *hw = sc->hw; in ath9k_init_device()
854 error = ath9k_init_softc(devid, sc, bus_ops); in ath9k_init_device()
858 ah = sc->sc_ah; in ath9k_init_device()
860 ath9k_set_hw_capab(sc, hw); in ath9k_init_device()
863 error = ath_regd_init(&common->regulatory, sc->hw->wiphy, in ath9k_init_device()
871 error = ath_tx_init(sc, ATH_TXBUF); in ath9k_init_device()
876 error = ath_rx_init(sc, ATH_RXBUF); in ath9k_init_device()
880 ath9k_init_txpower_limits(sc); in ath9k_init_device()
884 sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw, in ath9k_init_device()
907 ath_init_leds(sc); in ath9k_init_device()
908 ath_start_rfkill_poll(sc); in ath9k_init_device()
913 ath9k_deinit_debug(sc); in ath9k_init_device()
917 ath_rx_cleanup(sc); in ath9k_init_device()
919 ath9k_deinit_softc(sc); in ath9k_init_device()
927 static void ath9k_deinit_softc(struct ath_softc *sc) in ath9k_deinit_softc() argument
931 ath9k_deinit_btcoex(sc); in ath9k_deinit_softc()
934 if (ATH_TXQ_SETUP(sc, i)) in ath9k_deinit_softc()
935 ath_tx_cleanupq(sc, &sc->tx.txq[i]); in ath9k_deinit_softc()
937 ath9k_hw_deinit(sc->sc_ah); in ath9k_deinit_softc()
938 if (sc->dfs_detector != NULL) in ath9k_deinit_softc()
939 sc->dfs_detector->exit(sc->dfs_detector); in ath9k_deinit_softc()
941 ath9k_eeprom_release(sc); in ath9k_deinit_softc()
944 void ath9k_deinit_device(struct ath_softc *sc) in ath9k_deinit_device() argument
946 struct ieee80211_hw *hw = sc->hw; in ath9k_deinit_device()
948 ath9k_ps_wakeup(sc); in ath9k_deinit_device()
950 wiphy_rfkill_stop_polling(sc->hw->wiphy); in ath9k_deinit_device()
951 ath_deinit_leds(sc); in ath9k_deinit_device()
953 ath9k_ps_restore(sc); in ath9k_deinit_device()
955 ath9k_deinit_debug(sc); in ath9k_deinit_device()
957 ath_rx_cleanup(sc); in ath9k_deinit_device()
958 ath9k_deinit_softc(sc); in ath9k_deinit_device()