OLD | NEW |
1 /*- | 1 /*- |
2 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting | 2 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting |
3 * Copyright (c) 2004-2005 Atheros Communications, Inc. | 3 * Copyright (c) 2004-2005 Atheros Communications, Inc. |
4 * Copyright (c) 2006 Devicescape Software, Inc. | 4 * Copyright (c) 2006 Devicescape Software, Inc. |
5 * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com> | 5 * Copyright (c) 2007 Jiri Slaby <jirislaby@gmail.com> |
6 * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> | 6 * Copyright (c) 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> |
7 * | 7 * |
8 * All rights reserved. | 8 * All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 30 matching lines...) Expand all Loading... |
41 */ | 41 */ |
42 | 42 |
43 #include <linux/module.h> | 43 #include <linux/module.h> |
44 #include <linux/delay.h> | 44 #include <linux/delay.h> |
45 #include <linux/hardirq.h> | 45 #include <linux/hardirq.h> |
46 #include <linux/if.h> | 46 #include <linux/if.h> |
47 #include <linux/io.h> | 47 #include <linux/io.h> |
48 #include <linux/netdevice.h> | 48 #include <linux/netdevice.h> |
49 #include <linux/cache.h> | 49 #include <linux/cache.h> |
50 #include <linux/pci.h> | 50 #include <linux/pci.h> |
| 51 #include <linux/pci-aspm.h> |
51 #include <linux/ethtool.h> | 52 #include <linux/ethtool.h> |
52 #include <linux/uaccess.h> | 53 #include <linux/uaccess.h> |
53 #include <linux/slab.h> | 54 #include <linux/slab.h> |
54 | 55 |
55 #include <net/ieee80211_radiotap.h> | 56 #include <net/ieee80211_radiotap.h> |
56 | 57 |
57 #include <asm/unaligned.h> | 58 #include <asm/unaligned.h> |
58 | 59 |
59 #include "base.h" | 60 #include "base.h" |
60 #include "reg.h" | 61 #include "reg.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 ath5k_pci_probe(struct pci_dev *pdev, | 506 ath5k_pci_probe(struct pci_dev *pdev, |
506 const struct pci_device_id *id) | 507 const struct pci_device_id *id) |
507 { | 508 { |
508 void __iomem *mem; | 509 void __iomem *mem; |
509 struct ath5k_softc *sc; | 510 struct ath5k_softc *sc; |
510 struct ath_common *common; | 511 struct ath_common *common; |
511 struct ieee80211_hw *hw; | 512 struct ieee80211_hw *hw; |
512 int ret; | 513 int ret; |
513 u8 csz; | 514 u8 csz; |
514 | 515 |
| 516 /* |
| 517 * L0s needs to be disabled on all ath5k cards. |
| 518 * |
| 519 * For distributions shipping with CONFIG_PCIEASPM (this will be enabled |
| 520 * by default in the future in 2.6.36) this will also mean both L1 and |
| 521 * L0s will be disabled when a pre 1.1 PCIe device is detected. We do |
| 522 * know L1 works correctly even for all ath5k pre 1.1 PCIe devices |
| 523 * though but cannot currently undue the effect of a blacklist, for |
| 524 * details you can read pcie_aspm_sanity_check() and see how it adjusts |
| 525 * the device link capability. |
| 526 * |
| 527 * It may be possible in the future to implement some PCI API to allow |
| 528 * drivers to override blacklists for pre 1.1 PCIe but for now it is |
| 529 * best to accept that both L0s and L1 will be disabled completely for |
| 530 * distributions shipping with CONFIG_PCIEASPM rather than having this |
| 531 * issue present. Motivation for adding this new API will be to help |
| 532 * with power consumption for some of these devices. |
| 533 */ |
| 534 pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S); |
| 535 |
515 ret = pci_enable_device(pdev); | 536 ret = pci_enable_device(pdev); |
516 if (ret) { | 537 if (ret) { |
517 dev_err(&pdev->dev, "can't enable device\n"); | 538 dev_err(&pdev->dev, "can't enable device\n"); |
518 goto err; | 539 goto err; |
519 } | 540 } |
520 | 541 |
521 /* XXX 32-bit addressing only */ | 542 /* XXX 32-bit addressing only */ |
522 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 543 ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
523 if (ret) { | 544 if (ret) { |
524 dev_err(&pdev->dev, "32-bit DMA not available\n"); | 545 dev_err(&pdev->dev, "32-bit DMA not available\n"); |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 u16 duration = 0; | 1356 u16 duration = 0; |
1336 u8 rc_flags; | 1357 u8 rc_flags; |
1337 | 1358 |
1338 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; | 1359 flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK; |
1339 | 1360 |
1340 /* XXX endianness */ | 1361 /* XXX endianness */ |
1341 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, | 1362 bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len, |
1342 PCI_DMA_TODEVICE); | 1363 PCI_DMA_TODEVICE); |
1343 | 1364 |
1344 rate = ieee80211_get_tx_rate(sc->hw, info); | 1365 rate = ieee80211_get_tx_rate(sc->hw, info); |
| 1366 if (!rate) { |
| 1367 ret = -EINVAL; |
| 1368 goto err_unmap; |
| 1369 } |
1345 | 1370 |
1346 if (info->flags & IEEE80211_TX_CTL_NO_ACK) | 1371 if (info->flags & IEEE80211_TX_CTL_NO_ACK) |
1347 flags |= AR5K_TXDESC_NOACK; | 1372 flags |= AR5K_TXDESC_NOACK; |
1348 | 1373 |
1349 rc_flags = info->control.rates[0].flags; | 1374 rc_flags = info->control.rates[0].flags; |
1350 hw_rate = (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) ? | 1375 hw_rate = (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) ? |
1351 rate->hw_value_short : rate->hw_value; | 1376 rate->hw_value_short : rate->hw_value; |
1352 | 1377 |
1353 pktlen = skb->len; | 1378 pktlen = skb->len; |
1354 | 1379 |
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3580 * reset. | 3605 * reset. |
3581 */ | 3606 */ |
3582 static void ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) | 3607 static void ath5k_set_coverage_class(struct ieee80211_hw *hw, u8 coverage_class) |
3583 { | 3608 { |
3584 struct ath5k_softc *sc = hw->priv; | 3609 struct ath5k_softc *sc = hw->priv; |
3585 | 3610 |
3586 mutex_lock(&sc->lock); | 3611 mutex_lock(&sc->lock); |
3587 ath5k_hw_set_coverage_class(sc->ah, coverage_class); | 3612 ath5k_hw_set_coverage_class(sc->ah, coverage_class); |
3588 mutex_unlock(&sc->lock); | 3613 mutex_unlock(&sc->lock); |
3589 } | 3614 } |
OLD | NEW |