aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/pci.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index f088f4bf9a26..7ae73fbd9136 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -96,17 +96,6 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)
96 return true; 96 return true;
97} 97}
98 98
99static void ath_pci_extn_synch_enable(struct ath_common *common)
100{
101 struct ath_softc *sc = (struct ath_softc *) common->priv;
102 struct pci_dev *pdev = to_pci_dev(sc->dev);
103 u8 lnkctl;
104
105 pci_read_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, &lnkctl);
106 lnkctl |= PCI_EXP_LNKCTL_ES;
107 pci_write_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, lnkctl);
108}
109
110/* Need to be called after we discover btcoex capabilities */ 99/* Need to be called after we discover btcoex capabilities */
111static void ath_pci_aspm_init(struct ath_common *common) 100static void ath_pci_aspm_init(struct ath_common *common)
112{ 101{
@@ -125,23 +114,23 @@ static void ath_pci_aspm_init(struct ath_common *common)
125 114
126 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && 115 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&
127 (AR_SREV_9285(ah))) { 116 (AR_SREV_9285(ah))) {
128 /* Bluetooth coexistance requires disabling ASPM. */ 117 /* Bluetooth coexistence requires disabling ASPM. */
129 pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, 118 pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL,
130 PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); 119 PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
131 120
132 /* 121 /*
133 * Both upstream and downstream PCIe components should 122 * Both upstream and downstream PCIe components should
134 * have the same ASPM settings. 123 * have the same ASPM settings.
135 */ 124 */
136 pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, 125 pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
137 PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); 126 PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
138 127
139 ath_info(common, "Disabling ASPM since BTCOEX is enabled\n"); 128 ath_info(common, "Disabling ASPM since BTCOEX is enabled\n");
140 return; 129 return;
141 } 130 }
142 131
143 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); 132 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
144 if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { 133 if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
145 ah->aspm_enabled = true; 134 ah->aspm_enabled = true;
146 /* Initialize PCIe PM and SERDES registers. */ 135 /* Initialize PCIe PM and SERDES registers. */
147 ath9k_hw_configpcipowersave(ah, false); 136 ath9k_hw_configpcipowersave(ah, false);
@@ -153,7 +142,6 @@ static const struct ath_bus_ops ath_pci_bus_ops = {
153 .ath_bus_type = ATH_PCI, 142 .ath_bus_type = ATH_PCI,
154 .read_cachesize = ath_pci_read_cachesize, 143 .read_cachesize = ath_pci_read_cachesize,
155 .eeprom_read = ath_pci_eeprom_read, 144 .eeprom_read = ath_pci_eeprom_read,
156 .extn_synch_en = ath_pci_extn_synch_enable,
157 .aspm_init = ath_pci_aspm_init, 145 .aspm_init = ath_pci_aspm_init,
158}; 146};
159 147
@@ -299,7 +287,7 @@ static void ath_pci_remove(struct pci_dev *pdev)
299 pci_release_region(pdev, 0); 287 pci_release_region(pdev, 0);
300} 288}
301 289
302#ifdef CONFIG_PM 290#ifdef CONFIG_PM_SLEEP
303 291
304static int ath_pci_suspend(struct device *device) 292static int ath_pci_suspend(struct device *device)
305{ 293{
@@ -345,22 +333,15 @@ static int ath_pci_resume(struct device *device)
345 return 0; 333 return 0;
346} 334}
347 335
348static const struct dev_pm_ops ath9k_pm_ops = { 336static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume);
349 .suspend = ath_pci_suspend,
350 .resume = ath_pci_resume,
351 .freeze = ath_pci_suspend,
352 .thaw = ath_pci_resume,
353 .poweroff = ath_pci_suspend,
354 .restore = ath_pci_resume,
355};
356 337
357#define ATH9K_PM_OPS (&ath9k_pm_ops) 338#define ATH9K_PM_OPS (&ath9k_pm_ops)
358 339
359#else /* !CONFIG_PM */ 340#else /* !CONFIG_PM_SLEEP */
360 341
361#define ATH9K_PM_OPS NULL 342#define ATH9K_PM_OPS NULL
362 343
363#endif /* !CONFIG_PM */ 344#endif /* !CONFIG_PM_SLEEP */
364 345
365 346
366MODULE_DEVICE_TABLE(pci, ath_pci_id_table); 347MODULE_DEVICE_TABLE(pci, ath_pci_id_table);