diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 87 |
1 files changed, 60 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index e3d11c41a145..7df728f36330 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -347,7 +347,6 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, | |||
347 | { | 347 | { |
348 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 348 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
349 | u8 *ds; | 349 | u8 *ds; |
350 | struct ath_buf *bf; | ||
351 | int i, bsize, desc_len; | 350 | int i, bsize, desc_len; |
352 | 351 | ||
353 | ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n", | 352 | ath_dbg(common, CONFIG, "%s DMA: %u buffers %u desc/buf\n", |
@@ -399,33 +398,68 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd, | |||
399 | ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); | 398 | ito64(dd->dd_desc_paddr), /*XXX*/(u32) dd->dd_desc_len); |
400 | 399 | ||
401 | /* allocate buffers */ | 400 | /* allocate buffers */ |
402 | bsize = sizeof(struct ath_buf) * nbuf; | 401 | if (is_tx) { |
403 | bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); | 402 | struct ath_buf *bf; |
404 | if (!bf) | 403 | |
405 | return -ENOMEM; | 404 | bsize = sizeof(struct ath_buf) * nbuf; |
405 | bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); | ||
406 | if (!bf) | ||
407 | return -ENOMEM; | ||
408 | |||
409 | for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) { | ||
410 | bf->bf_desc = ds; | ||
411 | bf->bf_daddr = DS2PHYS(dd, ds); | ||
412 | |||
413 | if (!(sc->sc_ah->caps.hw_caps & | ||
414 | ATH9K_HW_CAP_4KB_SPLITTRANS)) { | ||
415 | /* | ||
416 | * Skip descriptor addresses which can cause 4KB | ||
417 | * boundary crossing (addr + length) with a 32 dword | ||
418 | * descriptor fetch. | ||
419 | */ | ||
420 | while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) { | ||
421 | BUG_ON((caddr_t) bf->bf_desc >= | ||
422 | ((caddr_t) dd->dd_desc + | ||
423 | dd->dd_desc_len)); | ||
424 | |||
425 | ds += (desc_len * ndesc); | ||
426 | bf->bf_desc = ds; | ||
427 | bf->bf_daddr = DS2PHYS(dd, ds); | ||
428 | } | ||
429 | } | ||
430 | list_add_tail(&bf->list, head); | ||
431 | } | ||
432 | } else { | ||
433 | struct ath_rxbuf *bf; | ||
434 | |||
435 | bsize = sizeof(struct ath_rxbuf) * nbuf; | ||
436 | bf = devm_kzalloc(sc->dev, bsize, GFP_KERNEL); | ||
437 | if (!bf) | ||
438 | return -ENOMEM; | ||
406 | 439 | ||
407 | for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) { | 440 | for (i = 0; i < nbuf; i++, bf++, ds += (desc_len * ndesc)) { |
408 | bf->bf_desc = ds; | 441 | bf->bf_desc = ds; |
409 | bf->bf_daddr = DS2PHYS(dd, ds); | 442 | bf->bf_daddr = DS2PHYS(dd, ds); |
410 | 443 | ||
411 | if (!(sc->sc_ah->caps.hw_caps & | 444 | if (!(sc->sc_ah->caps.hw_caps & |
412 | ATH9K_HW_CAP_4KB_SPLITTRANS)) { | 445 | ATH9K_HW_CAP_4KB_SPLITTRANS)) { |
413 | /* | 446 | /* |
414 | * Skip descriptor addresses which can cause 4KB | 447 | * Skip descriptor addresses which can cause 4KB |
415 | * boundary crossing (addr + length) with a 32 dword | 448 | * boundary crossing (addr + length) with a 32 dword |
416 | * descriptor fetch. | 449 | * descriptor fetch. |
417 | */ | 450 | */ |
418 | while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) { | 451 | while (ATH_DESC_4KB_BOUND_CHECK(bf->bf_daddr)) { |
419 | BUG_ON((caddr_t) bf->bf_desc >= | 452 | BUG_ON((caddr_t) bf->bf_desc >= |
420 | ((caddr_t) dd->dd_desc + | 453 | ((caddr_t) dd->dd_desc + |
421 | dd->dd_desc_len)); | 454 | dd->dd_desc_len)); |
422 | 455 | ||
423 | ds += (desc_len * ndesc); | 456 | ds += (desc_len * ndesc); |
424 | bf->bf_desc = ds; | 457 | bf->bf_desc = ds; |
425 | bf->bf_daddr = DS2PHYS(dd, ds); | 458 | bf->bf_daddr = DS2PHYS(dd, ds); |
459 | } | ||
426 | } | 460 | } |
461 | list_add_tail(&bf->list, head); | ||
427 | } | 462 | } |
428 | list_add_tail(&bf->list, head); | ||
429 | } | 463 | } |
430 | return 0; | 464 | return 0; |
431 | } | 465 | } |
@@ -437,7 +471,6 @@ static int ath9k_init_queues(struct ath_softc *sc) | |||
437 | sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah); | 471 | sc->beacon.beaconq = ath9k_hw_beaconq_setup(sc->sc_ah); |
438 | sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0); | 472 | sc->beacon.cabq = ath_txq_setup(sc, ATH9K_TX_QUEUE_CAB, 0); |
439 | 473 | ||
440 | sc->config.cabqReadytime = ATH_CABQ_READY_TIME; | ||
441 | ath_cabq_update(sc); | 474 | ath_cabq_update(sc); |
442 | 475 | ||
443 | sc->tx.uapsdq = ath_txq_setup(sc, ATH9K_TX_QUEUE_UAPSD, 0); | 476 | sc->tx.uapsdq = ath_txq_setup(sc, ATH9K_TX_QUEUE_UAPSD, 0); |
@@ -768,7 +801,7 @@ static void ath9k_init_band_txpower(struct ath_softc *sc, int band) | |||
768 | chan = &sband->channels[i]; | 801 | chan = &sband->channels[i]; |
769 | ah->curchan = &ah->channels[chan->hw_value]; | 802 | ah->curchan = &ah->channels[chan->hw_value]; |
770 | cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); | 803 | cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_HT20); |
771 | ath9k_cmn_update_ichannel(ah->curchan, &chandef); | 804 | ath9k_cmn_get_channel(sc->hw, ah, &chandef); |
772 | ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); | 805 | ath9k_hw_set_txpowerlimit(ah, MAX_RATE_POWER, true); |
773 | } | 806 | } |
774 | } | 807 | } |