diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-config.h b/drivers/net/wireless/intel/iwlwifi/iwl-config.h index d95b1b513768..08ac4b1d18dd 100644 --- a/drivers/net/wireless/intel/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/intel/iwlwifi/iwl-config.h @@ -454,9 +454,24 @@ struct iwl_cfg { #define IWL_CFG_ANY (~0) +#define IWL_CFG_MAC_TYPE_TH 0x32 +#define IWL_CFG_MAC_TYPE_QU 0x33 + +#define IWL_CFG_RF_TYPE_TH 0x105 +#define IWL_CFG_RF_TYPE_JF2 0x105 +#define IWL_CFG_RF_TYPE_JF1 0x108 + +#define IWL_CFG_NO_160 0x0 +#define IWL_CFG_160 0x1 + +#define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0100) >> 9) + struct iwl_dev_info { u16 device; u16 subdevice; + u16 mac_type; + u16 rf_type; + u8 no_160; const struct iwl_cfg *cfg; const char *name; }; diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 51f4f4e9aa30..ef023d61ef3a 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c @@ -941,29 +941,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = { }; MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids); -#define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \ - { .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg), \ - .name = _name } +#define _IWL_DEV_INFO(_device, _subdevice, _mac_type, _rf_type, _no_160, \ + _cfg, _name) \ + { .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg), \ + .name = _name, .mac_type = _mac_type, .rf_type = _rf_type, \ + .no_160 = _no_160, } + +#define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \ + _IWL_DEV_INFO(_device, _subdevice, IWL_CFG_ANY, IWL_CFG_ANY, \ + IWL_CFG_ANY, _cfg, _name) static const struct iwl_dev_info iwl_dev_info_table[] = { #if IS_ENABLED(CONFIG_IWLMVM) - IWL_DEV_INFO(0x2526, 0x0010, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x0014, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x0018, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x001C, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x6010, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x6014, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x8014, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0x8010, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0xA014, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0xE010, iwl9260_2ac_cfg, iwl9260_160_name), - IWL_DEV_INFO(0x2526, 0xE014, iwl9260_2ac_cfg, iwl9260_160_name), - - IWL_DEV_INFO(0x2526, 0x0210, iwl9260_2ac_cfg, iwl9260_name), - IWL_DEV_INFO(0x2526, 0x0214, iwl9260_2ac_cfg, iwl9260_name), - IWL_DEV_INFO(0x2526, 0x1010, iwl9260_2ac_cfg, iwl9260_name), - IWL_DEV_INFO(0x2526, 0x1210, iwl9260_2ac_cfg, iwl9260_name), - IWL_DEV_INFO(0x2526, 0x1410, iwl9260_2ac_cfg, iwl9270_name), IWL_DEV_INFO(0x2526, 0x1610, iwl9260_2ac_cfg, iwl9270_name), @@ -999,6 +988,13 @@ static const struct iwl_dev_info iwl_dev_info_table[] = { IWL_DEV_INFO(0x2526, 0x1551, iwl9560_2ac_cfg_soc, iwl9560_killer_1550s_name), IWL_DEV_INFO(0x2526, 0x1552, iwl9560_2ac_cfg_soc, iwl9560_killer_1550i_name), + + _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, + IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_160, + iwl9260_2ac_cfg, iwl9260_160_name), + _IWL_DEV_INFO(0x2526, IWL_CFG_ANY, + IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_NO_160, + iwl9260_2ac_cfg, iwl9260_name), #endif /* CONFIG_IWLMVM */ }; @@ -1034,13 +1030,23 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* the trans_cfg should never change, so set it now */ iwl_trans->trans_cfg = trans; + iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID); + for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) { const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i]; - - if ((dev_info->device == IWL_CFG_ANY || + if ((dev_info->device == (u16)IWL_CFG_ANY || dev_info->device == pdev->device) && - (dev_info->subdevice == IWL_CFG_ANY || - dev_info->subdevice == pdev->subsystem_device)) { + (dev_info->subdevice == (u16)IWL_CFG_ANY || + dev_info->subdevice == pdev->subsystem_device) && + (dev_info->mac_type == (u16)IWL_CFG_ANY || + dev_info->mac_type == + CSR_HW_REV_TYPE(iwl_trans->hw_rev)) && + (dev_info->rf_type == (u16)IWL_CFG_ANY || + dev_info->rf_type == + CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id)) && + (dev_info->no_160 == (u8)IWL_CFG_ANY || + dev_info->no_160 == + IWL_SUBDEVICE_NO_160(pdev->subsystem_device))) { iwl_trans->cfg = dev_info->cfg; iwl_trans->name = dev_info->name; goto found; @@ -1065,8 +1071,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) (iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D) iwl_trans->cfg = cfg_7265d; - iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID); - if (cfg == &iwlax210_2ax_cfg_so_hr_a0) { if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_TY) { iwl_trans->cfg = &iwlax210_2ax_cfg_ty_gf_a0;