Lines Matching refs:sc

150 static void ath9k_deinit_softc(struct ath_softc *sc);
177 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_iowrite32() local
181 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_iowrite32()
182 iowrite32(val, sc->mem + reg_offset); in ath9k_iowrite32()
183 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_iowrite32()
185 iowrite32(val, sc->mem + reg_offset); in ath9k_iowrite32()
192 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_ioread32() local
197 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_ioread32()
198 val = ioread32(sc->mem + reg_offset); in ath9k_ioread32()
199 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_ioread32()
201 val = ioread32(sc->mem + reg_offset); in ath9k_ioread32()
215 static unsigned int __ath9k_reg_rmw(struct ath_softc *sc, u32 reg_offset, in __ath9k_reg_rmw() argument
220 val = ioread32(sc->mem + reg_offset); in __ath9k_reg_rmw()
223 iowrite32(val, sc->mem + reg_offset); in __ath9k_reg_rmw()
232 struct ath_softc *sc = (struct ath_softc *) common->priv; in ath9k_reg_rmw() local
237 spin_lock_irqsave(&sc->sc_serial_rw, flags); in ath9k_reg_rmw()
238 val = __ath9k_reg_rmw(sc, reg_offset, set, clr); in ath9k_reg_rmw()
239 spin_unlock_irqrestore(&sc->sc_serial_rw, flags); in ath9k_reg_rmw()
241 val = __ath9k_reg_rmw(sc, reg_offset, set, clr); in ath9k_reg_rmw()
254 struct ath_softc *sc = hw->priv; in ath9k_reg_notifier() local
255 struct ath_hw *ah = sc->sc_ah; in ath9k_reg_notifier()
261 if (sc->dfs_detector != NULL) in ath9k_reg_notifier()
262 sc->dfs_detector->set_dfs_domain(sc->dfs_detector, in ath9k_reg_notifier()
269 sc->cur_chan->txpower = 2 * ah->curchan->chan->max_power; in ath9k_reg_notifier()
270 ath9k_ps_wakeup(sc); in ath9k_reg_notifier()
271 ath9k_hw_set_txpowerlimit(ah, sc->cur_chan->txpower, false); in ath9k_reg_notifier()
272 ath9k_cmn_update_txpow(ah, sc->cur_chan->cur_txpower, in ath9k_reg_notifier()
273 sc->cur_chan->txpower, in ath9k_reg_notifier()
274 &sc->cur_chan->cur_txpower); in ath9k_reg_notifier()
275 ath9k_ps_restore(sc); in ath9k_reg_notifier()
283 int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, in ath_descdma_setup() argument
287 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath_descdma_setup()
297 desc_len = sc->sc_ah->caps.tx_desc_len; in ath_descdma_setup()
315 if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) { in ath_descdma_setup()
329 dd->dd_desc = dmam_alloc_coherent(sc->dev, dd->dd_desc_len, in ath_descdma_setup()
344 bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); in ath_descdma_setup()
352 if (!(sc->sc_ah->caps.hw_caps & in ath_descdma_setup()
375 bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); in ath_descdma_setup()
383 if (!(sc->sc_ah->caps.hw_caps & in ath_descdma_setup()
406 static int ath9k_init_queues(struct ath_softc *sc) in ath9k_init_queues() argument
410 sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah); in ath9k_init_queues()
411 sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0); in ath9k_init_queues()
412 ath_cabq_update(sc); in ath9k_init_queues()
414 sc->tx.uapsdq = ath_txq_setup(sc, ATH9K_TX_QUEUE_UAPSD, 0); in ath9k_init_queues()
417 sc->tx.txq_map[i] = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, i); in ath9k_init_queues()
418 sc->tx.txq_map[i]->mac80211_qnum = i; in ath9k_init_queues()
423 static void ath9k_init_misc(struct ath_softc *sc) in ath9k_init_misc() argument
425 struct ath_common *common = ath9k_hw_common(sc->sc_ah); in ath9k_init_misc()
432 sc->beacon.slottime = 9; in ath9k_init_misc()
434 for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) in ath9k_init_misc()
435 sc->beacon.bslot[i] = NULL; in ath9k_init_misc()
437 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) in ath9k_init_misc()
438 sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT; in ath9k_init_misc()
440 sc->spec_priv.ah = sc->sc_ah; in ath9k_init_misc()
441 sc->spec_priv.spec_config.enabled = 0; in ath9k_init_misc()
442 sc->spec_priv.spec_config.short_repeat = true; in ath9k_init_misc()
443 sc->spec_priv.spec_config.count = 8; in ath9k_init_misc()
444 sc->spec_priv.spec_config.endless = false; in ath9k_init_misc()
445 sc->spec_priv.spec_config.period = 0xFF; in ath9k_init_misc()
446 sc->spec_priv.spec_config.fft_period = 0xF; in ath9k_init_misc()
449 static void ath9k_init_pcoem_platform(struct ath_softc *sc) in ath9k_init_pcoem_platform() argument
451 struct ath_hw *ah = sc->sc_ah; in ath9k_init_pcoem_platform()
461 if (sc->driver_data & (ATH9K_PCI_CUS198 | in ath9k_init_pcoem_platform()
467 sc->ant_comb.low_rssi_thresh = 20; in ath9k_init_pcoem_platform()
468 sc->ant_comb.fast_div_bias = 3; in ath9k_init_pcoem_platform()
471 (sc->driver_data & ATH9K_PCI_CUS198) ? in ath9k_init_pcoem_platform()
475 if (sc->driver_data & ATH9K_PCI_CUS217) in ath9k_init_pcoem_platform()
478 if (sc->driver_data & ATH9K_PCI_CUS252) in ath9k_init_pcoem_platform()
481 if (sc->driver_data & ATH9K_PCI_AR9565_1ANT) in ath9k_init_pcoem_platform()
484 if (sc->driver_data & ATH9K_PCI_AR9565_2ANT) in ath9k_init_pcoem_platform()
487 if (sc->driver_data & ATH9K_PCI_KILLER) in ath9k_init_pcoem_platform()
496 if (sc->driver_data & (ATH9K_PCI_AR9565_1ANT | ATH9K_PCI_AR9565_2ANT)) { in ath9k_init_pcoem_platform()
497 if (!(sc->driver_data & ATH9K_PCI_BT_ANT_DIV)) in ath9k_init_pcoem_platform()
501 if (sc->driver_data & ATH9K_PCI_BT_ANT_DIV) { in ath9k_init_pcoem_platform()
506 if (sc->driver_data & ATH9K_PCI_D3_L1_WAR) { in ath9k_init_pcoem_platform()
518 if (sc->driver_data & ATH9K_PCI_NO_PLL_PWRSAVE) { in ath9k_init_pcoem_platform()
523 if (sc->driver_data & ATH9K_PCI_LED_ACT_HI) in ath9k_init_pcoem_platform()
538 static int ath9k_eeprom_request(struct ath_softc *sc, const char *name) in ath9k_eeprom_request() argument
541 struct ath_hw *ah = sc->sc_ah; in ath9k_eeprom_request()
546 ec.ah = sc->sc_ah; in ath9k_eeprom_request()
548 err = request_firmware_nowait(THIS_MODULE, 1, name, sc->dev, GFP_KERNEL, in ath9k_eeprom_request()
567 static void ath9k_eeprom_release(struct ath_softc *sc) in ath9k_eeprom_release() argument
569 release_firmware(sc->sc_ah->eeprom_blob); in ath9k_eeprom_release()
572 static int ath9k_init_platform(struct ath_softc *sc) in ath9k_init_platform() argument
574 struct ath9k_platform_data *pdata = sc->dev->platform_data; in ath9k_init_platform()
575 struct ath_hw *ah = sc->sc_ah; in ath9k_init_platform()
598 ret = ath9k_eeprom_request(sc, pdata->eeprom_name); in ath9k_init_platform()
615 static int ath9k_of_init(struct ath_softc *sc) in ath9k_of_init() argument
617 struct device_node *np = sc->dev->of_node; in ath9k_of_init()
618 struct ath_hw *ah = sc->sc_ah; in ath9k_of_init()
636 ret = ath9k_eeprom_request(sc, eeprom_name); in ath9k_of_init()
651 static int ath9k_init_softc(u16 devid, struct ath_softc *sc, in ath9k_init_softc() argument
660 ah = devm_kzalloc(sc->dev, sizeof(struct ath_hw), GFP_KERNEL); in ath9k_init_softc()
664 ah->dev = sc->dev; in ath9k_init_softc()
665 ah->hw = sc->hw; in ath9k_init_softc()
679 sc->airtime_flags = (AIRTIME_USE_TX | AIRTIME_USE_RX | in ath9k_init_softc()
682 sc->sc_ah = ah; in ath9k_init_softc()
683 sc->dfs_detector = dfs_pattern_detector_init(common, NL80211_DFS_UNSET); in ath9k_init_softc()
684 sc->tx99_power = MAX_RATE_POWER + 1; in ath9k_init_softc()
685 init_waitqueue_head(&sc->tx_wait); in ath9k_init_softc()
686 sc->cur_chan = &sc->chanctx[0]; in ath9k_init_softc()
688 sc->cur_chan->hw_queue_base = 0; in ath9k_init_softc()
694 common->hw = sc->hw; in ath9k_init_softc()
695 common->priv = sc; in ath9k_init_softc()
703 ath9k_init_pcoem_platform(sc); in ath9k_init_softc()
705 ret = ath9k_init_platform(sc); in ath9k_init_softc()
709 ret = ath9k_of_init(sc); in ath9k_init_softc()
728 spin_lock_init(&sc->intr_lock); in ath9k_init_softc()
729 spin_lock_init(&sc->sc_serial_rw); in ath9k_init_softc()
730 spin_lock_init(&sc->sc_pm_lock); in ath9k_init_softc()
731 spin_lock_init(&sc->chan_lock); in ath9k_init_softc()
732 mutex_init(&sc->mutex); in ath9k_init_softc()
733 tasklet_init(&sc->intr_tq, ath9k_tasklet, (unsigned long)sc); in ath9k_init_softc()
734 tasklet_init(&sc->bcon_tasklet, ath9k_beacon_tasklet, in ath9k_init_softc()
735 (unsigned long)sc); in ath9k_init_softc()
737 timer_setup(&sc->sleep_timer, ath_ps_full_sleep, 0); in ath9k_init_softc()
738 INIT_WORK(&sc->hw_reset_work, ath_reset_work); in ath9k_init_softc()
739 INIT_WORK(&sc->paprd_work, ath_paprd_calibrate); in ath9k_init_softc()
740 INIT_DELAYED_WORK(&sc->hw_pll_work, ath_hw_pll_work); in ath9k_init_softc()
741 INIT_DELAYED_WORK(&sc->hw_check_work, ath_hw_check_work); in ath9k_init_softc()
743 ath9k_init_channel_context(sc); in ath9k_init_softc()
757 ret = ath9k_init_queues(sc); in ath9k_init_softc()
761 ret = ath9k_init_btcoex(sc); in ath9k_init_softc()
769 ret = ath9k_init_p2p(sc); in ath9k_init_softc()
773 ath9k_cmn_init_crypto(sc->sc_ah); in ath9k_init_softc()
774 ath9k_init_misc(sc); in ath9k_init_softc()
775 ath_chanctx_init(sc); in ath9k_init_softc()
776 ath9k_offchannel_init(sc); in ath9k_init_softc()
785 if (ATH_TXQ_SETUP(sc, i)) in ath9k_init_softc()
786 ath_tx_cleanupq(sc, &sc->tx.txq[i]); in ath9k_init_softc()
790 ath9k_eeprom_release(sc); in ath9k_init_softc()
791 dev_kfree_skb_any(sc->tx99_skb); in ath9k_init_softc()
795 static void ath9k_init_band_txpower(struct ath_softc *sc, int band) in ath9k_init_band_txpower() argument
799 struct ath_hw *ah = sc->sc_ah; in ath9k_init_band_txpower()
809 ath9k_cmn_get_channel(sc->hw, ah, &chandef); in ath9k_init_band_txpower()
814 static void ath9k_init_txpower_limits(struct ath_softc *sc) in ath9k_init_txpower_limits() argument
816 struct ath_hw *ah = sc->sc_ah; in ath9k_init_txpower_limits()
820 ath9k_init_band_txpower(sc, NL80211_BAND_2GHZ); in ath9k_init_txpower_limits()
822 ath9k_init_band_txpower(sc, NL80211_BAND_5GHZ); in ath9k_init_txpower_limits()
892 static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw) in ath9k_set_mcc_capab() argument
894 struct ath_hw *ah = sc->sc_ah; in ath9k_set_mcc_capab()
917 static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) in ath9k_set_hw_capab() argument
919 struct ath_hw *ah = sc->sc_ah; in ath9k_set_hw_capab()
936 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { in ath9k_set_hw_capab()
944 if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || ath9k_modparam_nohwcrypt) in ath9k_set_hw_capab()
997 sc->ant_rx = hw->wiphy->available_antennas_rx; in ath9k_set_hw_capab()
998 sc->ant_tx = hw->wiphy->available_antennas_tx; in ath9k_set_hw_capab()
1000 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_2GHZ) in ath9k_set_hw_capab()
1003 if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_5GHZ) in ath9k_set_hw_capab()
1008 ath9k_set_mcc_capab(sc, hw); in ath9k_set_hw_capab()
1018 int ath9k_init_device(u16 devid, struct ath_softc *sc, in ath9k_init_device() argument
1021 struct ieee80211_hw *hw = sc->hw; in ath9k_init_device()
1028 error = ath9k_init_softc(devid, sc, bus_ops); in ath9k_init_device()
1032 ah = sc->sc_ah; in ath9k_init_device()
1034 ath9k_set_hw_capab(sc, hw); in ath9k_init_device()
1037 error = ath_regd_init(&common->regulatory, sc->hw->wiphy, in ath9k_init_device()
1045 error = ath_tx_init(sc, ATH_TXBUF); in ath9k_init_device()
1050 error = ath_rx_init(sc, ATH_RXBUF); in ath9k_init_device()
1054 ath9k_init_txpower_limits(sc); in ath9k_init_device()
1058 sc->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(sc->hw, in ath9k_init_device()
1081 ath_init_leds(sc); in ath9k_init_device()
1082 ath_start_rfkill_poll(sc); in ath9k_init_device()
1087 ath9k_deinit_debug(sc); in ath9k_init_device()
1091 ath_rx_cleanup(sc); in ath9k_init_device()
1093 ath9k_deinit_softc(sc); in ath9k_init_device()
1101 static void ath9k_deinit_softc(struct ath_softc *sc) in ath9k_deinit_softc() argument
1105 ath9k_deinit_p2p(sc); in ath9k_deinit_softc()
1106 ath9k_deinit_btcoex(sc); in ath9k_deinit_softc()
1109 if (ATH_TXQ_SETUP(sc, i)) in ath9k_deinit_softc()
1110 ath_tx_cleanupq(sc, &sc->tx.txq[i]); in ath9k_deinit_softc()
1112 del_timer_sync(&sc->sleep_timer); in ath9k_deinit_softc()
1113 ath9k_hw_deinit(sc->sc_ah); in ath9k_deinit_softc()
1114 if (sc->dfs_detector != NULL) in ath9k_deinit_softc()
1115 sc->dfs_detector->exit(sc->dfs_detector); in ath9k_deinit_softc()
1117 ath9k_eeprom_release(sc); in ath9k_deinit_softc()
1120 void ath9k_deinit_device(struct ath_softc *sc) in ath9k_deinit_device() argument
1122 struct ieee80211_hw *hw = sc->hw; in ath9k_deinit_device()
1124 ath9k_ps_wakeup(sc); in ath9k_deinit_device()
1126 wiphy_rfkill_stop_polling(sc->hw->wiphy); in ath9k_deinit_device()
1127 ath_deinit_leds(sc); in ath9k_deinit_device()
1129 ath9k_ps_restore(sc); in ath9k_deinit_device()
1131 ath9k_deinit_debug(sc); in ath9k_deinit_device()
1134 ath_rx_cleanup(sc); in ath9k_deinit_device()
1135 ath9k_deinit_softc(sc); in ath9k_deinit_device()