From 2f85aa5cbc627bb603ec4ebf24a6d9cb737d16f5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 26 Jan 2021 18:03:27 +0100 Subject: [PATCH] mt76: mt7915: avoid writes to MT_PCIE_RECOG_ID when not using gen1 devices Signed-off-by: Felix Fietkau --- mt7915/pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mt7915/pci.c b/mt7915/pci.c index 251856c4..b0e8e83c 100644 --- a/mt7915/pci.c +++ b/mt7915/pci.c @@ -158,6 +158,12 @@ static void mt7915_pci_init_hif2(struct mt7915_dev *dev) { struct mt7915_hif *hif; + dev->hif_idx = ++hif_idx; + if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7916, NULL)) + return; + + mt76_wr(dev, MT_PCIE_RECOG_ID, dev->hif_idx | MT_PCIE_RECOG_ID_SEM); + hif = mt7915_pci_get_hif2(dev); if (!hif) return; @@ -258,9 +264,6 @@ static int mt7915_pci_probe(struct pci_dev *pdev, if (ret) goto error; - dev->hif_idx = ++hif_idx; - mt76_wr(dev, MT_PCIE_RECOG_ID, dev->hif_idx | MT_PCIE_RECOG_ID_SEM); - mt7915_pci_init_hif2(dev); ret = mt7915_register_device(dev);