On some systems there are heavy crashes if the kernel config
option CONFIG_PCIEASPM_PERFORMANCE is not set. Patch provided by
Sujith for ath9k fixes this issue and the card operates without
crashes with kernel default CONFIG_PCIEASPM_DEFAULT option that uses
BIOS provided ASPM settings. Tested with QCA9862 mPCIe card.

Signed-off-by: Sujith Manoharan <[email protected]>
Signed-off-by: Tomislav Požega <[email protected]>
---
 drivers/net/wireless/ath/ath10k/pci.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 271f92c..e24403c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -2787,14 +2787,25 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar,
                                   enum ath10k_firmware_mode fw_mode)
 {
        struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
+       struct pci_dev *pdev = ar_pci->pdev;
        int ret;
+       u32 val;
 
        ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif power up\n");
 
-       pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL,
+       if (ar->dev_id == QCA988X_2_0_DEVICE_ID) {
+               pci_read_config_dword(pdev, 0x70c, &val);
+               if ((val & 0xff000000) == 0x17000000) {
+                       val &= 0x00ffffff;
+                       val |= 0x27000000;
+                       pci_write_config_dword(pdev, 0x570c, val);
+               }
+       } else {
+               pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL,
                                  &ar_pci->link_ctl);
-       pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL,
+               pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL,
                                   ar_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC);
+       }
 
        /*
         * Bring the target up cleanly.
-- 
1.7.0.4

Reply via email to