Skip to content

Commit 1c6b222

Browse files
derenopsiff
authored andcommitted
wifi: mt76: mt7921: introduce mt7920 PCIe support
mainline inclusion from mainline-v6.10-rc1 category: feature mt7920e is a mt7921 series chipset with 802.11ax 2x2:2SS support. The major difference is in firmware side only, at this moment. This patch would add some mandatory changes for new chip id and firmware download control. Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 4a40fcb) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent bb0425d commit 1c6b222

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

drivers/net/wireless/mediatek/mt76/mt76_connac.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,19 @@ static inline bool is_mt7925(struct mt76_dev *dev)
177177
return mt76_chip(dev) == 0x7925;
178178
}
179179

180+
static inline bool is_mt7920(struct mt76_dev *dev)
181+
{
182+
return mt76_chip(dev) == 0x7920;
183+
}
184+
180185
static inline bool is_mt7922(struct mt76_dev *dev)
181186
{
182187
return mt76_chip(dev) == 0x7922;
183188
}
184189

185190
static inline bool is_mt7921(struct mt76_dev *dev)
186191
{
187-
return mt76_chip(dev) == 0x7961 || is_mt7922(dev);
192+
return mt76_chip(dev) == 0x7961 || is_mt7922(dev) || is_mt7920(dev);
188193
}
189194

190195
static inline bool is_mt7663(struct mt76_dev *dev)
@@ -249,6 +254,7 @@ static inline bool is_mt76_fw_txp(struct mt76_dev *dev)
249254
{
250255
switch (mt76_chip(dev)) {
251256
case 0x7961:
257+
case 0x7920:
252258
case 0x7922:
253259
case 0x7925:
254260
case 0x7663:

drivers/net/wireless/mediatek/mt76/mt7921/pci.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ static const struct pci_device_id mt7921_pci_device_table[] = {
2323
.driver_data = (kernel_ulong_t)MT7921_FIRMWARE_WM },
2424
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x0616),
2525
.driver_data = (kernel_ulong_t)MT7922_FIRMWARE_WM },
26+
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7920),
27+
.driver_data = (kernel_ulong_t)MT7920_FIRMWARE_WM },
2628
{ },
2729
};
2830

@@ -268,9 +270,9 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
268270
struct mt76_bus_ops *bus_ops;
269271
struct mt792x_dev *dev;
270272
struct mt76_dev *mdev;
273+
u16 cmd, chipid;
271274
u8 features;
272275
int ret;
273-
u16 cmd;
274276

275277
ret = pcim_enable_device(pdev);
276278
if (ret)
@@ -350,7 +352,10 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
350352
if (ret)
351353
goto err_free_dev;
352354

353-
mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) |
355+
chipid = mt7921_l1_rr(dev, MT_HW_CHIPID);
356+
if (chipid == 0x7961 && (mt7921_l1_rr(dev, MT_HW_BOUND) & BIT(7)))
357+
chipid = 0x7920;
358+
mdev->rev = (chipid << 16) |
354359
(mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
355360
dev_info(mdev->dev, "ASIC revision: %04x\n", mdev->rev);
356361

@@ -545,6 +550,8 @@ static struct pci_driver mt7921_pci_driver = {
545550
module_pci_driver(mt7921_pci_driver);
546551

547552
MODULE_DEVICE_TABLE(pci, mt7921_pci_device_table);
553+
MODULE_FIRMWARE(MT7920_FIRMWARE_WM);
554+
MODULE_FIRMWARE(MT7920_ROM_PATCH);
548555
MODULE_FIRMWARE(MT7921_FIRMWARE_WM);
549556
MODULE_FIRMWARE(MT7921_ROM_PATCH);
550557
MODULE_FIRMWARE(MT7922_FIRMWARE_WM);

drivers/net/wireless/mediatek/mt76/mt792x.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@
3636
#define MT792x_MCU_INIT_RETRY_COUNT 10
3737
#define MT792x_WFSYS_INIT_RETRY_COUNT 2
3838

39+
#define MT7920_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1a.bin"
3940
#define MT7921_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7961_1.bin"
4041
#define MT7922_FIRMWARE_WM "mediatek/WIFI_RAM_CODE_MT7922_1.bin"
4142
#define MT7925_FIRMWARE_WM "mediatek/mt7925/WIFI_RAM_CODE_MT7925_1_1.bin"
4243

44+
#define MT7920_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1a_2_hdr.bin"
4345
#define MT7921_ROM_PATCH "mediatek/WIFI_MT7961_patch_mcu_1_2_hdr.bin"
4446
#define MT7922_ROM_PATCH "mediatek/WIFI_MT7922_patch_mcu_1_1_hdr.bin"
4547
#define MT7925_ROM_PATCH "mediatek/mt7925/WIFI_MT7925_PATCH_MCU_1_1_hdr.bin"
@@ -325,6 +327,8 @@ int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
325327
static inline char *mt792x_ram_name(struct mt792x_dev *dev)
326328
{
327329
switch (mt76_chip(&dev->mt76)) {
330+
case 0x7920:
331+
return MT7920_FIRMWARE_WM;
328332
case 0x7922:
329333
return MT7922_FIRMWARE_WM;
330334
case 0x7925:
@@ -337,6 +341,8 @@ static inline char *mt792x_ram_name(struct mt792x_dev *dev)
337341
static inline char *mt792x_patch_name(struct mt792x_dev *dev)
338342
{
339343
switch (mt76_chip(&dev->mt76)) {
344+
case 0x7920:
345+
return MT7920_ROM_PATCH;
340346
case 0x7922:
341347
return MT7922_ROM_PATCH;
342348
case 0x7925:

0 commit comments

Comments
 (0)