Skip to content

Commit

Permalink
iwlwifi: add mac/rf types and 160MHz to the device tables
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/iwlwifi.20200309091348.a6bef6ee8fe1.I01f7a6f49aa60d2d61633a8a8b859015681eac5b@changeid
  • Loading branch information
lucacoelho committed Mar 17, 2020
1 parent 67eb556 commit d6f2134
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 26 deletions.
15 changes: 15 additions & 0 deletions drivers/net/wireless/intel/iwlwifi/iwl-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
56 changes: 30 additions & 26 deletions drivers/net/wireless/intel/iwlwifi/pcie/drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down Expand Up @@ -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 */
};

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d6f2134

Please sign in to comment.