@@ -10,7 +10,6 @@ mt76-y := \
mmio.o util.o trace.o dma.o mac80211.o debugfs.o eeprom.o \
tx.o agg-rx.o mcu.o
-mt76-$(CONFIG_PCI) += pci.o
mt76-$(CONFIG_NL80211_TESTMODE) += testmode.o
mt76-usb-y := usb.o usb_trace.o
@@ -933,7 +933,6 @@ bool ____mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
#define mt76_poll_msec_tick(dev, ...) ____mt76_poll_msec(&((dev)->mt76), __VA_ARGS__)
void mt76_mmio_init(struct mt76_dev *dev, void __iomem *regs);
-void mt76_pci_disable_aspm(struct pci_dev *pdev);
static inline u16 mt76_chip(struct mt76_dev *dev)
{
@@ -43,7 +43,7 @@ static int mt7615_pci_probe(struct pci_dev *pdev,
if (ret)
goto error;
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
map = id->device == 0x7663 ? mt7663e_reg_map : mt7615e_reg_map;
ret = mt7615_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0],
@@ -181,7 +181,7 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret)
return ret;
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops,
&drv_ops);
@@ -85,7 +85,7 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* RG_SSUSB_CDR_BR_PE1D = 0x3 */
mt76_rmw_field(dev, 0x15c58, 0x3 << 6, 0x3);
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
return 0;
@@ -122,7 +122,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
if (ret)
return ret;
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
if (id->device == 0x7916 || id->device == 0x790a)
return mt7915_pci_hif2_probe(pdev);
@@ -286,7 +286,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
goto err_free_pci_vec;
if (mt7921_disable_aspm)
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
ops = mt7921_get_mac80211_ops(&pdev->dev, (void *)id->driver_data,
&features);
@@ -111,7 +111,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
if (ret)
return ret;
- mt76_pci_disable_aspm(pdev);
+ pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
if (id->device == 0x7991)
return mt7996_pci_hif2_probe(pdev);
deleted file mode 100644
@@ -1,47 +0,0 @@
-// SPDX-License-Identifier: ISC
-/*
- * Copyright (C) 2019 Lorenzo Bianconi <lorenzo@kernel.org>
- */
-
-#include "mt76.h"
-#include <linux/pci.h>
-
-void mt76_pci_disable_aspm(struct pci_dev *pdev)
-{
- struct pci_dev *parent = pdev->bus->self;
- u16 aspm_conf, parent_aspm_conf = 0;
-
- pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &aspm_conf);
- aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
- if (parent) {
- pcie_capability_read_word(parent, PCI_EXP_LNKCTL,
- &parent_aspm_conf);
- parent_aspm_conf &= PCI_EXP_LNKCTL_ASPMC;
- }
-
- if (!aspm_conf && (!parent || !parent_aspm_conf)) {
- /* aspm already disabled */
- return;
- }
-
- dev_info(&pdev->dev, "disabling ASPM %s %s\n",
- (aspm_conf & PCI_EXP_LNKCTL_ASPM_L0S) ? "L0s" : "",
- (aspm_conf & PCI_EXP_LNKCTL_ASPM_L1) ? "L1" : "");
-
- if (IS_ENABLED(CONFIG_PCIEASPM)) {
- int err;
-
- err = pci_disable_link_state(pdev, aspm_conf);
- if (!err)
- return;
- }
-
- /* both device and parent should have the same ASPM setting.
- * disable ASPM in downstream component first and then upstream.
- */
- pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, aspm_conf);
- if (parent)
- pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
- aspm_conf);
-}
-EXPORT_SYMBOL_GPL(mt76_pci_disable_aspm);