| .. | .. |
|---|
| 6 | 6 | * GPL LICENSE SUMMARY |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
|---|
| 9 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 9 | + * Copyright(c) 2018 - 2019 Intel Corporation |
|---|
| 10 | 10 | * |
|---|
| 11 | 11 | * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | 12 | * it under the terms of version 2 of the GNU General Public License as |
|---|
| .. | .. |
|---|
| 16 | 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | 18 | * General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | | - * You should have received a copy of the GNU General Public License |
|---|
| 21 | | - * along with this program; if not, write to the Free Software |
|---|
| 22 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
|---|
| 23 | | - * USA |
|---|
| 24 | 19 | * |
|---|
| 25 | 20 | * The full GNU General Public License is included in this distribution |
|---|
| 26 | 21 | * in the file called COPYING. |
|---|
| .. | .. |
|---|
| 32 | 27 | * BSD LICENSE |
|---|
| 33 | 28 | * |
|---|
| 34 | 29 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
|---|
| 35 | | - * Copyright(c) 2018 Intel Corporation |
|---|
| 30 | + * Copyright(c) 2018 - 2019 Intel Corporation |
|---|
| 36 | 31 | * All rights reserved. |
|---|
| 37 | 32 | * |
|---|
| 38 | 33 | * Redistribution and use in source and binary forms, with or without |
|---|
| .. | .. |
|---|
| 198 | 193 | { |
|---|
| 199 | 194 | int ret; |
|---|
| 200 | 195 | |
|---|
| 201 | | - /* Enable 40MHz radio clock */ |
|---|
| 202 | | - iwl_write32(trans, CSR_GP_CNTRL, |
|---|
| 203 | | - iwl_read32(trans, CSR_GP_CNTRL) | |
|---|
| 204 | | - BIT(trans->cfg->csr->flag_init_done)); |
|---|
| 196 | + ret = iwl_finish_nic_init(trans, trans->trans_cfg); |
|---|
| 197 | + if (ret) |
|---|
| 198 | + return ret; |
|---|
| 205 | 199 | |
|---|
| 206 | | - /* wait for clock to be ready */ |
|---|
| 207 | | - ret = iwl_poll_bit(trans, CSR_GP_CNTRL, |
|---|
| 208 | | - BIT(trans->cfg->csr->flag_mac_clock_ready), |
|---|
| 209 | | - BIT(trans->cfg->csr->flag_mac_clock_ready), |
|---|
| 210 | | - 25000); |
|---|
| 211 | | - if (ret < 0) { |
|---|
| 212 | | - IWL_ERR(trans, "Time out access OTP\n"); |
|---|
| 213 | | - } else { |
|---|
| 214 | | - iwl_set_bits_prph(trans, APMG_PS_CTRL_REG, |
|---|
| 215 | | - APMG_PS_CTRL_VAL_RESET_REQ); |
|---|
| 216 | | - udelay(5); |
|---|
| 217 | | - iwl_clear_bits_prph(trans, APMG_PS_CTRL_REG, |
|---|
| 218 | | - APMG_PS_CTRL_VAL_RESET_REQ); |
|---|
| 200 | + iwl_set_bits_prph(trans, APMG_PS_CTRL_REG, |
|---|
| 201 | + APMG_PS_CTRL_VAL_RESET_REQ); |
|---|
| 202 | + udelay(5); |
|---|
| 203 | + iwl_clear_bits_prph(trans, APMG_PS_CTRL_REG, |
|---|
| 204 | + APMG_PS_CTRL_VAL_RESET_REQ); |
|---|
| 219 | 205 | |
|---|
| 220 | | - /* |
|---|
| 221 | | - * CSR auto clock gate disable bit - |
|---|
| 222 | | - * this is only applicable for HW with OTP shadow RAM |
|---|
| 223 | | - */ |
|---|
| 224 | | - if (trans->cfg->base_params->shadow_ram_support) |
|---|
| 225 | | - iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, |
|---|
| 226 | | - CSR_RESET_LINK_PWR_MGMT_DISABLED); |
|---|
| 227 | | - } |
|---|
| 228 | | - return ret; |
|---|
| 206 | + /* |
|---|
| 207 | + * CSR auto clock gate disable bit - |
|---|
| 208 | + * this is only applicable for HW with OTP shadow RAM |
|---|
| 209 | + */ |
|---|
| 210 | + if (trans->trans_cfg->base_params->shadow_ram_support) |
|---|
| 211 | + iwl_set_bit(trans, CSR_DBG_LINK_PWR_MGMT_REG, |
|---|
| 212 | + CSR_RESET_LINK_PWR_MGMT_DISABLED); |
|---|
| 213 | + |
|---|
| 214 | + return 0; |
|---|
| 229 | 215 | } |
|---|
| 230 | 216 | |
|---|
| 231 | 217 | static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr, |
|---|
| .. | .. |
|---|
| 342 | 328 | } |
|---|
| 343 | 329 | /* more in the link list, continue */ |
|---|
| 344 | 330 | usedblocks++; |
|---|
| 345 | | - } while (usedblocks <= trans->cfg->base_params->max_ll_items); |
|---|
| 331 | + } while (usedblocks <= trans->trans_cfg->base_params->max_ll_items); |
|---|
| 346 | 332 | |
|---|
| 347 | 333 | /* OTP has no valid blocks */ |
|---|
| 348 | 334 | IWL_DEBUG_EEPROM(trans->dev, "OTP has no valid blocks\n"); |
|---|
| .. | .. |
|---|
| 375 | 361 | if (nvm_is_otp < 0) |
|---|
| 376 | 362 | return nvm_is_otp; |
|---|
| 377 | 363 | |
|---|
| 378 | | - sz = trans->cfg->base_params->eeprom_size; |
|---|
| 364 | + sz = trans->trans_cfg->base_params->eeprom_size; |
|---|
| 379 | 365 | IWL_DEBUG_EEPROM(trans->dev, "NVM size = %d\n", sz); |
|---|
| 380 | 366 | |
|---|
| 381 | 367 | e = kmalloc(sz, GFP_KERNEL); |
|---|
| .. | .. |
|---|
| 410 | 396 | CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK | |
|---|
| 411 | 397 | CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK); |
|---|
| 412 | 398 | /* traversing the linked list if no shadow ram supported */ |
|---|
| 413 | | - if (!trans->cfg->base_params->shadow_ram_support) { |
|---|
| 399 | + if (!trans->trans_cfg->base_params->shadow_ram_support) { |
|---|
| 414 | 400 | ret = iwl_find_otp_image(trans, &validblockaddr); |
|---|
| 415 | 401 | if (ret) |
|---|
| 416 | 402 | goto err_unlock; |
|---|