Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'iwlwifi-for-kalle-2016-02-15' of https://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-fixes

These are a few fixes for the current cycle.
3 out of the 5 patches fix a bugzilla.

* fix a race that users reported when we try to load the firmware
and the hardware rfkill interrupt triggers at the same time.
* Luca fixes a very visible bug in scheduled scan: our firmware
doesn't support scheduled scan with no profile configured and
the supplicant sometimes requests such scheduled scans.
* build system fix
* firmware name update for 8265
* typo fix in return value

+164 -94
-1
drivers/net/wireless/intel/iwlwifi/Kconfig
··· 53 53 54 54 config IWLDVM 55 55 tristate "Intel Wireless WiFi DVM Firmware support" 56 - depends on m 57 56 help 58 57 This is the driver that supports the DVM firmware. The list 59 58 of the devices that use this firmware is available here:
+33 -9
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
··· 7 7 * 8 8 * Copyright(c) 2014 Intel Corporation. All rights reserved. 9 9 * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH 10 + * Copyright(c) 2016 Intel Deutschland GmbH 10 11 * 11 12 * This program is free software; you can redistribute it and/or modify 12 13 * it under the terms of version 2 of the GNU General Public License as ··· 71 70 72 71 /* Highest firmware API version supported */ 73 72 #define IWL8000_UCODE_API_MAX 20 73 + #define IWL8265_UCODE_API_MAX 20 74 74 75 75 /* Oldest version we won't warn about */ 76 76 #define IWL8000_UCODE_API_OK 13 77 + #define IWL8265_UCODE_API_OK 20 77 78 78 79 /* Lowest firmware API version supported */ 79 80 #define IWL8000_UCODE_API_MIN 13 81 + #define IWL8265_UCODE_API_MIN 20 80 82 81 83 /* NVM versions */ 82 84 #define IWL8000_NVM_VERSION 0x0a1d ··· 96 92 #define IWL8000_FW_PRE "iwlwifi-8000" 97 93 #define IWL8000_MODULE_FIRMWARE(api) \ 98 94 IWL8000_FW_PRE "-" __stringify(api) ".ucode" 95 + 96 + #define IWL8265_FW_PRE "iwlwifi-8265-" 97 + #define IWL8265_MODULE_FIRMWARE(api) \ 98 + IWL8265_FW_PRE __stringify(api) ".ucode" 99 99 100 100 #define NVM_HW_SECTION_NUM_FAMILY_8000 10 101 101 #define DEFAULT_NVM_FILE_FAMILY_8000B "nvmData-8000B" ··· 152 144 .support_tx_backoff = true, 153 145 }; 154 146 155 - #define IWL_DEVICE_8000 \ 156 - .ucode_api_max = IWL8000_UCODE_API_MAX, \ 157 - .ucode_api_ok = IWL8000_UCODE_API_OK, \ 158 - .ucode_api_min = IWL8000_UCODE_API_MIN, \ 147 + #define IWL_DEVICE_8000_COMMON \ 159 148 .device_family = IWL_DEVICE_FAMILY_8000, \ 160 149 .max_inst_size = IWL60_RTC_INST_SIZE, \ 161 150 .max_data_size = IWL60_RTC_DATA_SIZE, \ ··· 172 167 .thermal_params = &iwl8000_tt_params, \ 173 168 .apmg_not_supported = true 174 169 170 + #define IWL_DEVICE_8000 \ 171 + IWL_DEVICE_8000_COMMON, \ 172 + .ucode_api_max = IWL8000_UCODE_API_MAX, \ 173 + .ucode_api_ok = IWL8000_UCODE_API_OK, \ 174 + .ucode_api_min = IWL8000_UCODE_API_MIN \ 175 + 176 + #define IWL_DEVICE_8260 \ 177 + IWL_DEVICE_8000_COMMON, \ 178 + .ucode_api_max = IWL8000_UCODE_API_MAX, \ 179 + .ucode_api_ok = IWL8000_UCODE_API_OK, \ 180 + .ucode_api_min = IWL8000_UCODE_API_MIN \ 181 + 182 + #define IWL_DEVICE_8265 \ 183 + IWL_DEVICE_8000_COMMON, \ 184 + .ucode_api_max = IWL8265_UCODE_API_MAX, \ 185 + .ucode_api_ok = IWL8265_UCODE_API_OK, \ 186 + .ucode_api_min = IWL8265_UCODE_API_MIN \ 187 + 175 188 const struct iwl_cfg iwl8260_2n_cfg = { 176 189 .name = "Intel(R) Dual Band Wireless N 8260", 177 190 .fw_name_pre = IWL8000_FW_PRE, 178 - IWL_DEVICE_8000, 191 + IWL_DEVICE_8260, 179 192 .ht_params = &iwl8000_ht_params, 180 193 .nvm_ver = IWL8000_NVM_VERSION, 181 194 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, ··· 202 179 const struct iwl_cfg iwl8260_2ac_cfg = { 203 180 .name = "Intel(R) Dual Band Wireless AC 8260", 204 181 .fw_name_pre = IWL8000_FW_PRE, 205 - IWL_DEVICE_8000, 182 + IWL_DEVICE_8260, 206 183 .ht_params = &iwl8000_ht_params, 207 184 .nvm_ver = IWL8000_NVM_VERSION, 208 185 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, ··· 211 188 212 189 const struct iwl_cfg iwl8265_2ac_cfg = { 213 190 .name = "Intel(R) Dual Band Wireless AC 8265", 214 - .fw_name_pre = IWL8000_FW_PRE, 215 - IWL_DEVICE_8000, 191 + .fw_name_pre = IWL8265_FW_PRE, 192 + IWL_DEVICE_8265, 216 193 .ht_params = &iwl8000_ht_params, 217 194 .nvm_ver = IWL8000_NVM_VERSION, 218 195 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, ··· 232 209 const struct iwl_cfg iwl8260_2ac_sdio_cfg = { 233 210 .name = "Intel(R) Dual Band Wireless-AC 8260", 234 211 .fw_name_pre = IWL8000_FW_PRE, 235 - IWL_DEVICE_8000, 212 + IWL_DEVICE_8260, 236 213 .ht_params = &iwl8000_ht_params, 237 214 .nvm_ver = IWL8000_NVM_VERSION, 238 215 .nvm_calib_ver = IWL8000_TX_POWER_VERSION, ··· 259 236 }; 260 237 261 238 MODULE_FIRMWARE(IWL8000_MODULE_FIRMWARE(IWL8000_UCODE_API_OK)); 239 + MODULE_FIRMWARE(IWL8265_MODULE_FIRMWARE(IWL8265_UCODE_API_OK));
+4 -2
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 243 243 if (drv->trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) { 244 244 char rev_step = 'A' + CSR_HW_REV_STEP(drv->trans->hw_rev); 245 245 246 - snprintf(drv->firmware_name, sizeof(drv->firmware_name), 247 - "%s%c-%s.ucode", name_pre, rev_step, tag); 246 + if (rev_step != 'A') 247 + snprintf(drv->firmware_name, 248 + sizeof(drv->firmware_name), "%s%c-%s.ucode", 249 + name_pre, rev_step, tag); 248 250 } 249 251 250 252 IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n",
+4
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1298 1298 return -EBUSY; 1299 1299 } 1300 1300 1301 + /* we don't support "match all" in the firmware */ 1302 + if (!req->n_match_sets) 1303 + return -EOPNOTSUPP; 1304 + 1301 1305 ret = iwl_mvm_check_running_scans(mvm, type); 1302 1306 if (ret) 1303 1307 return ret;
+9
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
··· 490 490 iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask); 491 491 } 492 492 493 + static inline void iwl_enable_fw_load_int(struct iwl_trans *trans) 494 + { 495 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 496 + 497 + IWL_DEBUG_ISR(trans, "Enabling FW load interrupt\n"); 498 + trans_pcie->inta_mask = CSR_INT_BIT_FH_TX; 499 + iwl_write32(trans, CSR_INT_MASK, trans_pcie->inta_mask); 500 + } 501 + 493 502 static inline void iwl_enable_rfkill_int(struct iwl_trans *trans) 494 503 { 495 504 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+5 -3
drivers/net/wireless/intel/iwlwifi/pcie/rx.c
··· 1438 1438 inta & ~trans_pcie->inta_mask); 1439 1439 } 1440 1440 1441 - /* Re-enable all interrupts */ 1442 - /* only Re-enable if disabled by irq */ 1443 - if (test_bit(STATUS_INT_ENABLED, &trans->status)) 1441 + /* we are loading the firmware, enable FH_TX interrupt only */ 1442 + if (handled & CSR_INT_BIT_FH_TX) 1443 + iwl_enable_fw_load_int(trans); 1444 + /* only Re-enable all interrupt if disabled by irq */ 1445 + else if (test_bit(STATUS_INT_ENABLED, &trans->status)) 1444 1446 iwl_enable_interrupts(trans); 1445 1447 /* Re-enable RF_KILL if it occurred */ 1446 1448 else if (handled & CSR_INT_BIT_RF_KILL)
+109 -79
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 1021 1021 &first_ucode_section); 1022 1022 } 1023 1023 1024 - static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, 1025 - const struct fw_img *fw, bool run_in_rfkill) 1026 - { 1027 - struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1028 - bool hw_rfkill; 1029 - int ret; 1030 - 1031 - mutex_lock(&trans_pcie->mutex); 1032 - 1033 - /* Someone called stop_device, don't try to start_fw */ 1034 - if (trans_pcie->is_down) { 1035 - IWL_WARN(trans, 1036 - "Can't start_fw since the HW hasn't been started\n"); 1037 - ret = EIO; 1038 - goto out; 1039 - } 1040 - 1041 - /* This may fail if AMT took ownership of the device */ 1042 - if (iwl_pcie_prepare_card_hw(trans)) { 1043 - IWL_WARN(trans, "Exit HW not ready\n"); 1044 - ret = -EIO; 1045 - goto out; 1046 - } 1047 - 1048 - iwl_enable_rfkill_int(trans); 1049 - 1050 - /* If platform's RF_KILL switch is NOT set to KILL */ 1051 - hw_rfkill = iwl_is_rfkill_set(trans); 1052 - if (hw_rfkill) 1053 - set_bit(STATUS_RFKILL, &trans->status); 1054 - else 1055 - clear_bit(STATUS_RFKILL, &trans->status); 1056 - iwl_trans_pcie_rf_kill(trans, hw_rfkill); 1057 - if (hw_rfkill && !run_in_rfkill) { 1058 - ret = -ERFKILL; 1059 - goto out; 1060 - } 1061 - 1062 - iwl_write32(trans, CSR_INT, 0xFFFFFFFF); 1063 - 1064 - ret = iwl_pcie_nic_init(trans); 1065 - if (ret) { 1066 - IWL_ERR(trans, "Unable to init nic\n"); 1067 - goto out; 1068 - } 1069 - 1070 - /* make sure rfkill handshake bits are cleared */ 1071 - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1072 - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, 1073 - CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 1074 - 1075 - /* clear (again), then enable host interrupts */ 1076 - iwl_write32(trans, CSR_INT, 0xFFFFFFFF); 1077 - iwl_enable_interrupts(trans); 1078 - 1079 - /* really make sure rfkill handshake bits are cleared */ 1080 - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1081 - iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1082 - 1083 - /* Load the given image to the HW */ 1084 - if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) 1085 - ret = iwl_pcie_load_given_ucode_8000(trans, fw); 1086 - else 1087 - ret = iwl_pcie_load_given_ucode(trans, fw); 1088 - 1089 - out: 1090 - mutex_unlock(&trans_pcie->mutex); 1091 - return ret; 1092 - } 1093 - 1094 - static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans, u32 scd_addr) 1095 - { 1096 - iwl_pcie_reset_ict(trans); 1097 - iwl_pcie_tx_start(trans, scd_addr); 1098 - } 1099 - 1100 1024 static void _iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power) 1101 1025 { 1102 1026 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); ··· 1051 1127 * already dead. 1052 1128 */ 1053 1129 if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { 1054 - IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); 1130 + IWL_DEBUG_INFO(trans, 1131 + "DEVICE_ENABLED bit was set and is now cleared\n"); 1055 1132 iwl_pcie_tx_stop(trans); 1056 1133 iwl_pcie_rx_stop(trans); 1057 1134 ··· 1086 1161 iwl_disable_interrupts(trans); 1087 1162 spin_unlock(&trans_pcie->irq_lock); 1088 1163 1089 - 1090 1164 /* clear all status bits */ 1091 1165 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); 1092 1166 clear_bit(STATUS_INT_ENABLED, &trans->status); ··· 1118 1194 if (hw_rfkill != was_hw_rfkill) 1119 1195 iwl_trans_pcie_rf_kill(trans, hw_rfkill); 1120 1196 1121 - /* re-take ownership to prevent other users from stealing the deivce */ 1197 + /* re-take ownership to prevent other users from stealing the device */ 1122 1198 iwl_pcie_prepare_card_hw(trans); 1199 + } 1200 + 1201 + static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, 1202 + const struct fw_img *fw, bool run_in_rfkill) 1203 + { 1204 + struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 1205 + bool hw_rfkill; 1206 + int ret; 1207 + 1208 + /* This may fail if AMT took ownership of the device */ 1209 + if (iwl_pcie_prepare_card_hw(trans)) { 1210 + IWL_WARN(trans, "Exit HW not ready\n"); 1211 + ret = -EIO; 1212 + goto out; 1213 + } 1214 + 1215 + iwl_enable_rfkill_int(trans); 1216 + 1217 + iwl_write32(trans, CSR_INT, 0xFFFFFFFF); 1218 + 1219 + /* 1220 + * We enabled the RF-Kill interrupt and the handler may very 1221 + * well be running. Disable the interrupts to make sure no other 1222 + * interrupt can be fired. 1223 + */ 1224 + iwl_disable_interrupts(trans); 1225 + 1226 + /* Make sure it finished running */ 1227 + synchronize_irq(trans_pcie->pci_dev->irq); 1228 + 1229 + mutex_lock(&trans_pcie->mutex); 1230 + 1231 + /* If platform's RF_KILL switch is NOT set to KILL */ 1232 + hw_rfkill = iwl_is_rfkill_set(trans); 1233 + if (hw_rfkill) 1234 + set_bit(STATUS_RFKILL, &trans->status); 1235 + else 1236 + clear_bit(STATUS_RFKILL, &trans->status); 1237 + iwl_trans_pcie_rf_kill(trans, hw_rfkill); 1238 + if (hw_rfkill && !run_in_rfkill) { 1239 + ret = -ERFKILL; 1240 + goto out; 1241 + } 1242 + 1243 + /* Someone called stop_device, don't try to start_fw */ 1244 + if (trans_pcie->is_down) { 1245 + IWL_WARN(trans, 1246 + "Can't start_fw since the HW hasn't been started\n"); 1247 + ret = -EIO; 1248 + goto out; 1249 + } 1250 + 1251 + /* make sure rfkill handshake bits are cleared */ 1252 + iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1253 + iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, 1254 + CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED); 1255 + 1256 + /* clear (again), then enable host interrupts */ 1257 + iwl_write32(trans, CSR_INT, 0xFFFFFFFF); 1258 + 1259 + ret = iwl_pcie_nic_init(trans); 1260 + if (ret) { 1261 + IWL_ERR(trans, "Unable to init nic\n"); 1262 + goto out; 1263 + } 1264 + 1265 + /* 1266 + * Now, we load the firmware and don't want to be interrupted, even 1267 + * by the RF-Kill interrupt (hence mask all the interrupt besides the 1268 + * FH_TX interrupt which is needed to load the firmware). If the 1269 + * RF-Kill switch is toggled, we will find out after having loaded 1270 + * the firmware and return the proper value to the caller. 1271 + */ 1272 + iwl_enable_fw_load_int(trans); 1273 + 1274 + /* really make sure rfkill handshake bits are cleared */ 1275 + iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1276 + iwl_write32(trans, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); 1277 + 1278 + /* Load the given image to the HW */ 1279 + if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) 1280 + ret = iwl_pcie_load_given_ucode_8000(trans, fw); 1281 + else 1282 + ret = iwl_pcie_load_given_ucode(trans, fw); 1283 + iwl_enable_interrupts(trans); 1284 + 1285 + /* re-check RF-Kill state since we may have missed the interrupt */ 1286 + hw_rfkill = iwl_is_rfkill_set(trans); 1287 + if (hw_rfkill) 1288 + set_bit(STATUS_RFKILL, &trans->status); 1289 + else 1290 + clear_bit(STATUS_RFKILL, &trans->status); 1291 + 1292 + iwl_trans_pcie_rf_kill(trans, hw_rfkill); 1293 + if (hw_rfkill && !run_in_rfkill) 1294 + ret = -ERFKILL; 1295 + 1296 + out: 1297 + mutex_unlock(&trans_pcie->mutex); 1298 + return ret; 1299 + } 1300 + 1301 + static void iwl_trans_pcie_fw_alive(struct iwl_trans *trans, u32 scd_addr) 1302 + { 1303 + iwl_pcie_reset_ict(trans); 1304 + iwl_pcie_tx_start(trans, scd_addr); 1123 1305 } 1124 1306 1125 1307 static void iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power)