From 1cb35eccec20c27c3407574c050f3a0db366163a Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 22 May 2023 09:30:28 +0800
Subject: [PATCH 4000/4002] wifi: mt76: mt7992: add kite pci support

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
 mt76_connac.h | 5 +++++
 mt7996/mmio.c | 1 +
 mt7996/pci.c  | 8 ++++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/mt76_connac.h b/mt76_connac.h
index 02acac6..435604f 100644
--- a/mt76_connac.h
+++ b/mt76_connac.h
@@ -217,6 +217,11 @@ static inline bool is_mt7996(struct mt76_dev *dev)
 	return mt76_chip(dev) == 0x7990;
 }
 
+static inline bool is_mt7992(struct mt76_dev *dev)
+{
+	return mt76_chip(dev) == 0x7992;
+}
+
 static inline bool is_mt7622(struct mt76_dev *dev)
 {
 	if (!IS_ENABLED(CONFIG_MT7622_WMAC))
diff --git a/mt7996/mmio.c b/mt7996/mmio.c
index 8dfd694..8cb8a71 100644
--- a/mt7996/mmio.c
+++ b/mt7996/mmio.c
@@ -503,6 +503,7 @@ static int mt7996_mmio_init(struct mt76_dev *mdev,
 
 	switch (device_id) {
 	case 0x7990:
+	case 0x7992:
 		dev->reg.base = mt7996_reg_base;
 		dev->reg.map = mt7996_reg_map;
 		dev->reg.map_size = ARRAY_SIZE(mt7996_reg_map);
diff --git a/mt7996/pci.c b/mt7996/pci.c
index 86f0c18..9f45bd1 100644
--- a/mt7996/pci.c
+++ b/mt7996/pci.c
@@ -22,11 +22,13 @@ static u32 hif_idx;
 
 static const struct pci_device_id mt7996_pci_device_table[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7990) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7992) },
 	{ },
 };
 
 static const struct pci_device_id mt7996_hif_device_table[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7991) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x799a) },
 	{ },
 };
 
@@ -65,7 +67,9 @@ static void mt7996_put_hif2(struct mt7996_hif *hif)
 static struct mt7996_hif *mt7996_pci_init_hif2(struct pci_dev *pdev)
 {
 	hif_idx++;
-	if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7991, NULL))
+
+	if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7991, NULL) &&
+	    !pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x799a, NULL))
 		return NULL;
 
 	writel(hif_idx | MT_PCIE_RECOG_ID_SEM,
@@ -118,7 +122,7 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
 
 	mt76_pci_disable_aspm(pdev);
 
-	if (id->device == 0x7991)
+	if (id->device == 0x7991 || id->device == 0x799a)
 		return mt7996_pci_hif2_probe(pdev);
 
 	dev = mt7996_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0],
-- 
2.18.0

