Skip to content

Commit d6f2134

Browse files
committed
iwlwifi: add mac/rf types and 160MHz to the device tables
Add MAC ID, RF ID and the bit that tells us whether the device can handle 160MHz bandwidth to the device struct. This allows us to chose the correct structure and string depending on these parameters. Do so for all the 0x2526 devices we already moved to the new table. Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200309091348.a6bef6ee8fe1.I01f7a6f49aa60d2d61633a8a8b859015681eac5b@changeid
1 parent 67eb556 commit d6f2134

2 files changed

Lines changed: 45 additions & 26 deletions

File tree

drivers/net/wireless/intel/iwlwifi/iwl-config.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,24 @@ struct iwl_cfg {
454454

455455
#define IWL_CFG_ANY (~0)
456456

457+
#define IWL_CFG_MAC_TYPE_TH 0x32
458+
#define IWL_CFG_MAC_TYPE_QU 0x33
459+
460+
#define IWL_CFG_RF_TYPE_TH 0x105
461+
#define IWL_CFG_RF_TYPE_JF2 0x105
462+
#define IWL_CFG_RF_TYPE_JF1 0x108
463+
464+
#define IWL_CFG_NO_160 0x0
465+
#define IWL_CFG_160 0x1
466+
467+
#define IWL_SUBDEVICE_NO_160(subdevice) ((u16)((subdevice) & 0x0100) >> 9)
468+
457469
struct iwl_dev_info {
458470
u16 device;
459471
u16 subdevice;
472+
u16 mac_type;
473+
u16 rf_type;
474+
u8 no_160;
460475
const struct iwl_cfg *cfg;
461476
const char *name;
462477
};

drivers/net/wireless/intel/iwlwifi/pcie/drv.c

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -941,29 +941,18 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
941941
};
942942
MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
943943

944-
#define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \
945-
{ .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg), \
946-
.name = _name }
944+
#define _IWL_DEV_INFO(_device, _subdevice, _mac_type, _rf_type, _no_160, \
945+
_cfg, _name) \
946+
{ .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg), \
947+
.name = _name, .mac_type = _mac_type, .rf_type = _rf_type, \
948+
.no_160 = _no_160, }
949+
950+
#define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \
951+
_IWL_DEV_INFO(_device, _subdevice, IWL_CFG_ANY, IWL_CFG_ANY, \
952+
IWL_CFG_ANY, _cfg, _name)
947953

948954
static const struct iwl_dev_info iwl_dev_info_table[] = {
949955
#if IS_ENABLED(CONFIG_IWLMVM)
950-
IWL_DEV_INFO(0x2526, 0x0010, iwl9260_2ac_cfg, iwl9260_160_name),
951-
IWL_DEV_INFO(0x2526, 0x0014, iwl9260_2ac_cfg, iwl9260_160_name),
952-
IWL_DEV_INFO(0x2526, 0x0018, iwl9260_2ac_cfg, iwl9260_160_name),
953-
IWL_DEV_INFO(0x2526, 0x001C, iwl9260_2ac_cfg, iwl9260_160_name),
954-
IWL_DEV_INFO(0x2526, 0x6010, iwl9260_2ac_cfg, iwl9260_160_name),
955-
IWL_DEV_INFO(0x2526, 0x6014, iwl9260_2ac_cfg, iwl9260_160_name),
956-
IWL_DEV_INFO(0x2526, 0x8014, iwl9260_2ac_cfg, iwl9260_160_name),
957-
IWL_DEV_INFO(0x2526, 0x8010, iwl9260_2ac_cfg, iwl9260_160_name),
958-
IWL_DEV_INFO(0x2526, 0xA014, iwl9260_2ac_cfg, iwl9260_160_name),
959-
IWL_DEV_INFO(0x2526, 0xE010, iwl9260_2ac_cfg, iwl9260_160_name),
960-
IWL_DEV_INFO(0x2526, 0xE014, iwl9260_2ac_cfg, iwl9260_160_name),
961-
962-
IWL_DEV_INFO(0x2526, 0x0210, iwl9260_2ac_cfg, iwl9260_name),
963-
IWL_DEV_INFO(0x2526, 0x0214, iwl9260_2ac_cfg, iwl9260_name),
964-
IWL_DEV_INFO(0x2526, 0x1010, iwl9260_2ac_cfg, iwl9260_name),
965-
IWL_DEV_INFO(0x2526, 0x1210, iwl9260_2ac_cfg, iwl9260_name),
966-
967956
IWL_DEV_INFO(0x2526, 0x1410, iwl9260_2ac_cfg, iwl9270_name),
968957
IWL_DEV_INFO(0x2526, 0x1610, iwl9260_2ac_cfg, iwl9270_name),
969958

@@ -999,6 +988,13 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {
999988

1000989
IWL_DEV_INFO(0x2526, 0x1551, iwl9560_2ac_cfg_soc, iwl9560_killer_1550s_name),
1001990
IWL_DEV_INFO(0x2526, 0x1552, iwl9560_2ac_cfg_soc, iwl9560_killer_1550i_name),
991+
992+
_IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
993+
IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_160,
994+
iwl9260_2ac_cfg, iwl9260_160_name),
995+
_IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
996+
IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_NO_160,
997+
iwl9260_2ac_cfg, iwl9260_name),
1002998
#endif /* CONFIG_IWLMVM */
1003999
};
10041000

@@ -1034,13 +1030,23 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10341030
/* the trans_cfg should never change, so set it now */
10351031
iwl_trans->trans_cfg = trans;
10361032

1033+
iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID);
1034+
10371035
for (i = 0; i < ARRAY_SIZE(iwl_dev_info_table); i++) {
10381036
const struct iwl_dev_info *dev_info = &iwl_dev_info_table[i];
1039-
1040-
if ((dev_info->device == IWL_CFG_ANY ||
1037+
if ((dev_info->device == (u16)IWL_CFG_ANY ||
10411038
dev_info->device == pdev->device) &&
1042-
(dev_info->subdevice == IWL_CFG_ANY ||
1043-
dev_info->subdevice == pdev->subsystem_device)) {
1039+
(dev_info->subdevice == (u16)IWL_CFG_ANY ||
1040+
dev_info->subdevice == pdev->subsystem_device) &&
1041+
(dev_info->mac_type == (u16)IWL_CFG_ANY ||
1042+
dev_info->mac_type ==
1043+
CSR_HW_REV_TYPE(iwl_trans->hw_rev)) &&
1044+
(dev_info->rf_type == (u16)IWL_CFG_ANY ||
1045+
dev_info->rf_type ==
1046+
CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id)) &&
1047+
(dev_info->no_160 == (u8)IWL_CFG_ANY ||
1048+
dev_info->no_160 ==
1049+
IWL_SUBDEVICE_NO_160(pdev->subsystem_device))) {
10441050
iwl_trans->cfg = dev_info->cfg;
10451051
iwl_trans->name = dev_info->name;
10461052
goto found;
@@ -1065,8 +1071,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
10651071
(iwl_trans->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_7265D)
10661072
iwl_trans->cfg = cfg_7265d;
10671073

1068-
iwl_trans->hw_rf_id = iwl_read32(iwl_trans, CSR_HW_RF_ID);
1069-
10701074
if (cfg == &iwlax210_2ax_cfg_so_hr_a0) {
10711075
if (iwl_trans->hw_rev == CSR_HW_REV_TYPE_TY) {
10721076
iwl_trans->cfg = &iwlax210_2ax_cfg_ty_gf_a0;

0 commit comments

Comments
 (0)