iwlwifi: add Pu/PnJ/Th device values to differentiate them
authorLuca Coelho <luciano.coelho@intel.com>
Mon, 9 Mar 2020 07:16:11 +0000 (09:16 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 17 Mar 2020 19:10:45 +0000 (21:10 +0200)
Pu, PnJ and Th devices have different combinations of PCI ID, MAC ID
and RF IDs.  Use these to differentiate them and choose the correct
configuration.

This also includes a change from using soc cfg's for 0x2526
devices (PnJ/Th), which was incorrect.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200309091348.602bb33528cf.I3acacb07c69ed063c7f1ca78f2dce9b7b4ef3946@changeid
drivers/net/wireless/intel/iwlwifi/iwl-config.h
drivers/net/wireless/intel/iwlwifi/pcie/drv.c

index e2b8f6b..7a985b3 100644 (file)
@@ -454,6 +454,8 @@ struct iwl_cfg {
 
 #define IWL_CFG_ANY (~0)
 
+#define IWL_CFG_MAC_TYPE_PU            0x31
+#define IWL_CFG_MAC_TYPE_PNJ           0x32
 #define IWL_CFG_MAC_TYPE_TH            0x32
 #define IWL_CFG_MAC_TYPE_QU            0x33
 
@@ -461,12 +463,18 @@ struct iwl_cfg {
 #define IWL_CFG_RF_TYPE_JF2            0x105
 #define IWL_CFG_RF_TYPE_JF1            0x108
 
+#define IWL_CFG_RF_ID_TH               0x1
+#define IWL_CFG_RF_ID_TH1              0x1
+#define IWL_CFG_RF_ID_JF               0x3
+#define IWL_CFG_RF_ID_JF1              0x6
+
 #define IWL_CFG_NO_160                 0x0
 #define IWL_CFG_160                    0x1
 
 #define IWL_CFG_CORES_BT               0x0
 #define IWL_CFG_CORES_BT_GNSS          0x5
 
+#define IWL_SUBDEVICE_RF_ID(subdevice) ((u16)((subdevice) & 0x00F0) >> 4)
 #define IWL_SUBDEVICE_NO_160(subdevice)        ((u16)((subdevice) & 0x0100) >> 9)
 #define IWL_SUBDEVICE_CORES(subdevice) ((u16)((subdevice) & 0x1C00) >> 10)
 
@@ -475,6 +483,7 @@ struct iwl_dev_info {
        u16 subdevice;
        u16 mac_type;
        u16 rf_type;
+       u8 rf_id;
        u8 no_160;
        u8 cores;
        const struct iwl_cfg *cfg;
index f474d14..492aa44 100644 (file)
@@ -941,36 +941,20 @@ static const struct pci_device_id iwl_hw_card_ids[] = {
 };
 MODULE_DEVICE_TABLE(pci, iwl_hw_card_ids);
 
-#define _IWL_DEV_INFO(_device, _subdevice, _mac_type, _rf_type, _no_160,   \
-                     _cores, _cfg, _name)                                 \
+#define _IWL_DEV_INFO(_device, _subdevice, _mac_type, _rf_type, _rf_id,    \
+                     _no_160, _cores, _cfg, _name)                        \
        { .device = (_device), .subdevice = (_subdevice), .cfg = &(_cfg),  \
          .name = _name, .mac_type = _mac_type, .rf_type = _rf_type,       \
-         .no_160 = _no_160, .cores = _cores }
+         .no_160 = _no_160, .cores = _cores, .rf_id = _rf_id, }
 
 #define IWL_DEV_INFO(_device, _subdevice, _cfg, _name) \
-       _IWL_DEV_INFO(_device, _subdevice, IWL_CFG_ANY, IWL_CFG_ANY,    \
-                     IWL_CFG_ANY, IWL_CFG_ANY, _cfg, _name)
+       _IWL_DEV_INFO(_device, _subdevice, IWL_CFG_ANY, IWL_CFG_ANY,       \
+                     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, 0x1550, iwl9260_2ac_cfg, iwl9260_killer_1550_name),
 
-       IWL_DEV_INFO(0x2526, 0x0030, iwl9560_2ac_cfg, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x0038, iwl9560_2ac_cfg, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x003C, iwl9560_2ac_cfg, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x4030, iwl9560_2ac_cfg, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x2030, iwl9560_2ac_cfg_soc, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x2034, iwl9560_2ac_cfg_soc, iwl9560_160_name),
-       IWL_DEV_INFO(0x2526, 0x4034, iwl9560_2ac_cfg_soc, iwl9560_160_name),
-
-       IWL_DEV_INFO(0x2526, 0x0034, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x0230, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x0234, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x0238, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x023C, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x1030, iwl9560_2ac_cfg, iwl9560_name),
-       IWL_DEV_INFO(0x2526, 0x4234, iwl9560_2ac_cfg_soc, iwl9560_name),
-
        IWL_DEV_INFO(0x2526, 0x0060, iwl9560_2ac_cfg_soc, iwl9461_name),
        IWL_DEV_INFO(0x2526, 0x0064, iwl9560_2ac_cfg_soc, iwl9461_name),
        IWL_DEV_INFO(0x2526, 0x0260, iwl9560_2ac_cfg_soc, iwl9461_name),
@@ -987,21 +971,30 @@ static const struct iwl_dev_info iwl_dev_info_table[] = {
        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,
-                     IWL_CFG_CORES_BT_GNSS,
+                     IWL_CFG_MAC_TYPE_PNJ, IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF,
+                     IWL_CFG_160, IWL_CFG_CORES_BT,
+                     iwl9560_2ac_cfg, iwl9560_160_name),
+       _IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
+                     IWL_CFG_MAC_TYPE_PNJ, IWL_CFG_RF_TYPE_JF2, IWL_CFG_RF_ID_JF,
+                     IWL_CFG_NO_160, IWL_CFG_CORES_BT,
+                     iwl9560_2ac_cfg, iwl9560_name),
+
+       _IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
+                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY,
+                     IWL_CFG_160, IWL_CFG_CORES_BT_GNSS,
                      iwl9260_2ac_cfg, iwl9270_160_name),
        _IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
-                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_NO_160,
-                     IWL_CFG_CORES_BT_GNSS,
+                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY,
+                     IWL_CFG_NO_160, IWL_CFG_CORES_BT_GNSS,
                      iwl9260_2ac_cfg, iwl9270_name),
 
        _IWL_DEV_INFO(0x2526, IWL_CFG_ANY,
-                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_160,
-                     IWL_CFG_CORES_BT,
+                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY,
+                     IWL_CFG_160, IWL_CFG_CORES_BT,
                      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,
-                     IWL_CFG_CORES_BT,
+                     IWL_CFG_MAC_TYPE_TH, IWL_CFG_RF_TYPE_TH, IWL_CFG_ANY,
+                     IWL_CFG_NO_160, IWL_CFG_CORES_BT,
                      iwl9260_2ac_cfg, iwl9260_name),
 #endif /* CONFIG_IWLMVM */
 };
@@ -1052,6 +1045,9 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                    (dev_info->rf_type == (u16)IWL_CFG_ANY ||
                     dev_info->rf_type ==
                     CSR_HW_RFID_TYPE(iwl_trans->hw_rf_id)) &&
+                   (dev_info->rf_id == (u8)IWL_CFG_ANY ||
+                    dev_info->rf_id ==
+                    IWL_SUBDEVICE_RF_ID(pdev->subsystem_device)) &&
                    (dev_info->no_160 == (u8)IWL_CFG_ANY ||
                     dev_info->no_160 ==
                     IWL_SUBDEVICE_NO_160(pdev->subsystem_device)) &&