View | Details | Raw Unified | Return to bug 13892
Collapse All | Expand All

(-)a/drivers/net/wireless/ath/ath5k/base.c (+48 lines)
Lines 48-53 Link Here
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>
Lines 195-200 static const struct ieee80211_rate ath5k_rates[] = { Link Here
195
static int __devinit	ath5k_pci_probe(struct pci_dev *pdev,
196
static int __devinit	ath5k_pci_probe(struct pci_dev *pdev,
196
				const struct pci_device_id *id);
197
				const struct pci_device_id *id);
197
static void __devexit	ath5k_pci_remove(struct pci_dev *pdev);
198
static void __devexit	ath5k_pci_remove(struct pci_dev *pdev);
199
static void		__ath5k_disable_aspm(struct pci_dev *pdev, u16 state);
200
static void		ath5k_disable_aspm(struct pci_dev *pdev, u16 state);
198
#ifdef CONFIG_PM
201
#ifdef CONFIG_PM
199
static int		ath5k_pci_suspend(struct device *dev);
202
static int		ath5k_pci_suspend(struct device *dev);
200
static int		ath5k_pci_resume(struct device *dev);
203
static int		ath5k_pci_resume(struct device *dev);
Lines 424-429 module_exit(exit_ath5k_pci); Link Here
424
* PCI Initialization *
427
* PCI Initialization *
425
\********************/
428
\********************/
426
429
430
#ifdef CONFIG_PCIEASPM
431
static void __ath5k_disable_aspm(struct pci_dev *pdev, u16 state)
432
{
433
	pci_disable_link_state(pdev, state);
434
}
435
#else
436
static void __ath5k_disable_aspm(struct pci_dev *pdev, u16 state)
437
{
438
	int pos;
439
	u16 reg16;
440
441
	/*
442
	 * Both device and parent should have the same ASPM setting.
443
	 * Disable ASPM in downstream component first and then upstream.
444
	 */
445
	pos = pci_pcie_cap(pdev);
446
	pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, &reg16);
447
	reg16 &= ~state;
448
	pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16);
449
450
	if (!pdev->bus->self)
451
		return;
452
453
	pos = pci_pcie_cap(pdev->bus->self);
454
	pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, &reg16);
455
	reg16 &= ~state;
456
	pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16);
457
}
458
#endif
459
static void ath5k_disable_aspm(struct pci_dev *pdev, u16 state)
460
{
461
	if (!pdev->is_pcie)
462
		return;
463
464
	dev_info(&pdev->dev, "Disabling ASPM %s%s\n",
465
		 (state & PCIE_LINK_STATE_L0S) ? "L0s " : "",
466
		 (state & PCIE_LINK_STATE_L1) ? "L1" : "");
467
468
	__ath5k_disable_aspm(pdev, state);
469
}
470
427
static const char *
471
static const char *
428
ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
472
ath5k_chip_name(enum ath5k_srev_type type, u_int16_t val)
429
{
473
{
Lines 473-478 ath5k_pci_probe(struct pci_dev *pdev, Link Here
473
	int ret;
517
	int ret;
474
	u8 csz;
518
	u8 csz;
475
519
520
	ath5k_disable_aspm(pdev, PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_L0S);
521
476
	ret = pci_enable_device(pdev);
522
	ret = pci_enable_device(pdev);
477
	if (ret) {
523
	if (ret) {
478
		dev_err(&pdev->dev, "can't enable device\n");
524
		dev_err(&pdev->dev, "can't enable device\n");
Lines 725-730 static int ath5k_pci_resume(struct device *dev) Link Here
725
	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
771
	struct ieee80211_hw *hw = pci_get_drvdata(pdev);
726
	struct ath5k_softc *sc = hw->priv;
772
	struct ath5k_softc *sc = hw->priv;
727
773
774
	ath5k_disable_aspm(pdev, PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_L0S);
775
728
	/*
776
	/*
729
	 * Suspend/Resume resets the PCI configuration space, so we have to
777
	 * Suspend/Resume resets the PCI configuration space, so we have to
730
	 * re-disable the RETRY_TIMEOUT register (0x41) to keep
778
	 * re-disable the RETRY_TIMEOUT register (0x41) to keep

Return to bug 13892