mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 08:20:40 -04:00
wifi: mt76: mt7996: add macros for pci device ids
The chipset name (i.e., brand name) used by the driver may cause confusion with the PCI device ID when adding support for new chipsets. | Chipset name | PCI device id | |--------------|----------------| | 7996 | 0x7990, 0x7991 | | 7992 | 0x7992, 0x799a | | 7990 | 0x7993, 0x799b | To prevent confusion, replace the code that directly uses the device ID with macros. This is a preliminary patch to support mt7990 chipset. Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Link: https://patch.msgid.link/20250409140750.724437-2-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
committed by
Felix Fietkau
parent
0b0ff976af
commit
7014fe5358
@@ -48,8 +48,8 @@ const struct mt7996_mem_region*
|
||||
mt7996_coredump_get_mem_layout(struct mt7996_dev *dev, u32 *num)
|
||||
{
|
||||
switch (mt76_chip(&dev->mt76)) {
|
||||
case 0x7990:
|
||||
case 0x7991:
|
||||
case MT7996_DEVICE_ID:
|
||||
case MT7996_DEVICE_ID_2:
|
||||
*num = ARRAY_SIZE(mt7996_mem_regions);
|
||||
return &mt7996_mem_regions[0];
|
||||
default:
|
||||
|
||||
@@ -13,9 +13,9 @@ static int mt7996_check_eeprom(struct mt7996_dev *dev)
|
||||
u16 val = get_unaligned_le16(eeprom);
|
||||
|
||||
switch (val) {
|
||||
case 0x7990:
|
||||
case MT7996_DEVICE_ID:
|
||||
return is_mt7996(&dev->mt76) ? 0 : -EINVAL;
|
||||
case 0x7992:
|
||||
case MT7992_DEVICE_ID:
|
||||
return is_mt7992(&dev->mt76) ? 0 : -EINVAL;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -25,7 +25,7 @@ static int mt7996_check_eeprom(struct mt7996_dev *dev)
|
||||
static char *mt7996_eeprom_name(struct mt7996_dev *dev)
|
||||
{
|
||||
switch (mt76_chip(&dev->mt76)) {
|
||||
case 0x7992:
|
||||
case MT7992_DEVICE_ID:
|
||||
switch (dev->var.type) {
|
||||
case MT7992_VAR_TYPE_23:
|
||||
if (dev->var.fem == MT7996_FEM_INT)
|
||||
@@ -39,7 +39,7 @@ static char *mt7996_eeprom_name(struct mt7996_dev *dev)
|
||||
return MT7992_EEPROM_DEFAULT_MIX;
|
||||
return MT7992_EEPROM_DEFAULT;
|
||||
}
|
||||
case 0x7990:
|
||||
case MT7996_DEVICE_ID:
|
||||
default:
|
||||
switch (dev->var.type) {
|
||||
case MT7996_VAR_TYPE_233:
|
||||
|
||||
@@ -929,13 +929,13 @@ static int mt7996_variant_type_init(struct mt7996_dev *dev)
|
||||
u8 var_type;
|
||||
|
||||
switch (mt76_chip(&dev->mt76)) {
|
||||
case 0x7990:
|
||||
case MT7996_DEVICE_ID:
|
||||
if (val & MT_PAD_GPIO_2ADIE_TBTC)
|
||||
var_type = MT7996_VAR_TYPE_233;
|
||||
else
|
||||
var_type = MT7996_VAR_TYPE_444;
|
||||
break;
|
||||
case 0x7992:
|
||||
case MT7992_DEVICE_ID:
|
||||
if (val & MT_PAD_GPIO_ADIE_SINGLE)
|
||||
var_type = MT7992_VAR_TYPE_23;
|
||||
else if (u32_get_bits(val, MT_PAD_GPIO_ADIE_COMB_7992))
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#define fw_name(_dev, name, ...) ({ \
|
||||
char *_fw; \
|
||||
switch (mt76_chip(&(_dev)->mt76)) { \
|
||||
case 0x7992: \
|
||||
case MT7992_DEVICE_ID: \
|
||||
switch ((_dev)->var.type) { \
|
||||
case MT7992_VAR_TYPE_23: \
|
||||
_fw = MT7992_##name##_23; \
|
||||
@@ -22,7 +22,7 @@
|
||||
_fw = MT7992_##name; \
|
||||
} \
|
||||
break; \
|
||||
case 0x7990: \
|
||||
case MT7996_DEVICE_ID: \
|
||||
default: \
|
||||
switch ((_dev)->var.type) { \
|
||||
case MT7996_VAR_TYPE_233: \
|
||||
|
||||
@@ -350,7 +350,7 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
|
||||
MT_RXQ_RING_BASE(MT7996_RXQ_BAND0) +
|
||||
MT7996_RXQ_BAND0 * MT_RING_SIZE;
|
||||
|
||||
wed->wlan.id = 0x7991;
|
||||
wed->wlan.id = MT7996_DEVICE_ID_2;
|
||||
wed->wlan.tx_tbit[0] = ffs(MT_INT_TX_DONE_BAND2) - 1;
|
||||
} else {
|
||||
wed->wlan.hw_rro = dev->has_rro; /* default on */
|
||||
@@ -443,13 +443,13 @@ static int mt7996_mmio_init(struct mt76_dev *mdev,
|
||||
spin_lock_init(&dev->reg_lock);
|
||||
|
||||
switch (device_id) {
|
||||
case 0x7990:
|
||||
case MT7996_DEVICE_ID:
|
||||
dev->reg.base = mt7996_reg_base;
|
||||
dev->reg.offs_rev = mt7996_offs;
|
||||
dev->reg.map = mt7996_reg_map;
|
||||
dev->reg.map_size = ARRAY_SIZE(mt7996_reg_map);
|
||||
break;
|
||||
case 0x7992:
|
||||
case MT7992_DEVICE_ID:
|
||||
dev->reg.base = mt7996_reg_base;
|
||||
dev->reg.offs_rev = mt7992_offs;
|
||||
dev->reg.map = mt7996_reg_map;
|
||||
|
||||
@@ -30,6 +30,11 @@
|
||||
#define MT7996_RX_MCU_RING_SIZE 512
|
||||
#define MT7996_RX_MCU_RING_SIZE_WA 1024
|
||||
|
||||
#define MT7996_DEVICE_ID 0x7990
|
||||
#define MT7996_DEVICE_ID_2 0x7991
|
||||
#define MT7992_DEVICE_ID 0x7992
|
||||
#define MT7992_DEVICE_ID_2 0x799a
|
||||
|
||||
#define MT7996_FIRMWARE_WA "mediatek/mt7996/mt7996_wa.bin"
|
||||
#define MT7996_FIRMWARE_WM "mediatek/mt7996/mt7996_wm.bin"
|
||||
#define MT7996_FIRMWARE_DSP "mediatek/mt7996/mt7996_dsp.bin"
|
||||
@@ -471,11 +476,11 @@ static inline bool
|
||||
mt7996_has_background_radar(struct mt7996_dev *dev)
|
||||
{
|
||||
switch (mt76_chip(&dev->mt76)) {
|
||||
case 0x7990:
|
||||
case MT7996_DEVICE_ID:
|
||||
if (dev->var.type == MT7996_VAR_TYPE_233)
|
||||
return false;
|
||||
break;
|
||||
case 0x7992:
|
||||
case MT7992_DEVICE_ID:
|
||||
if (dev->var.type == MT7992_VAR_TYPE_23)
|
||||
return false;
|
||||
break;
|
||||
|
||||
@@ -16,14 +16,14 @@ static DEFINE_SPINLOCK(hif_lock);
|
||||
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) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, MT7996_DEVICE_ID) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, MT7992_DEVICE_ID) },
|
||||
{ },
|
||||
};
|
||||
|
||||
static const struct pci_device_id mt7996_hif_device_table[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7991) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x799a) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, MT7996_DEVICE_ID_2) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, MT7992_DEVICE_ID_2) },
|
||||
{ },
|
||||
};
|
||||
|
||||
@@ -63,8 +63,8 @@ static struct mt7996_hif *mt7996_pci_init_hif2(struct pci_dev *pdev)
|
||||
{
|
||||
hif_idx++;
|
||||
|
||||
if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x7991, NULL) &&
|
||||
!pci_get_device(PCI_VENDOR_ID_MEDIATEK, 0x799a, NULL))
|
||||
if (!pci_get_device(PCI_VENDOR_ID_MEDIATEK, MT7996_DEVICE_ID_2, NULL) &&
|
||||
!pci_get_device(PCI_VENDOR_ID_MEDIATEK, MT7992_DEVICE_ID_2, NULL))
|
||||
return NULL;
|
||||
|
||||
writel(hif_idx | MT_PCIE_RECOG_ID_SEM,
|
||||
@@ -121,7 +121,8 @@ static int mt7996_pci_probe(struct pci_dev *pdev,
|
||||
|
||||
mt76_pci_disable_aspm(pdev);
|
||||
|
||||
if (id->device == 0x7991 || id->device == 0x799a)
|
||||
if (id->device == MT7996_DEVICE_ID_2 ||
|
||||
id->device == MT7992_DEVICE_ID_2)
|
||||
return mt7996_pci_hif2_probe(pdev);
|
||||
|
||||
dev = mt7996_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0],
|
||||
|
||||
Reference in New Issue
Block a user