forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/wireless/intel/iwlwifi/iwl-eeprom-read.c
....@@ -6,7 +6,7 @@
66 * GPL LICENSE SUMMARY
77 *
88 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
9
- * Copyright(c) 2018 Intel Corporation
9
+ * Copyright(c) 2018 - 2019 Intel Corporation
1010 *
1111 * This program is free software; you can redistribute it and/or modify
1212 * it under the terms of version 2 of the GNU General Public License as
....@@ -16,11 +16,6 @@
1616 * WITHOUT ANY WARRANTY; without even the implied warranty of
1717 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1818 * 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
2419 *
2520 * The full GNU General Public License is included in this distribution
2621 * in the file called COPYING.
....@@ -32,7 +27,7 @@
3227 * BSD LICENSE
3328 *
3429 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35
- * Copyright(c) 2018 Intel Corporation
30
+ * Copyright(c) 2018 - 2019 Intel Corporation
3631 * All rights reserved.
3732 *
3833 * Redistribution and use in source and binary forms, with or without
....@@ -198,34 +193,25 @@
198193 {
199194 int ret;
200195
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;
205199
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);
219205
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;
229215 }
230216
231217 static int iwl_read_otp_word(struct iwl_trans *trans, u16 addr,
....@@ -342,7 +328,7 @@
342328 }
343329 /* more in the link list, continue */
344330 usedblocks++;
345
- } while (usedblocks <= trans->cfg->base_params->max_ll_items);
331
+ } while (usedblocks <= trans->trans_cfg->base_params->max_ll_items);
346332
347333 /* OTP has no valid blocks */
348334 IWL_DEBUG_EEPROM(trans->dev, "OTP has no valid blocks\n");
....@@ -375,7 +361,7 @@
375361 if (nvm_is_otp < 0)
376362 return nvm_is_otp;
377363
378
- sz = trans->cfg->base_params->eeprom_size;
364
+ sz = trans->trans_cfg->base_params->eeprom_size;
379365 IWL_DEBUG_EEPROM(trans->dev, "NVM size = %d\n", sz);
380366
381367 e = kmalloc(sz, GFP_KERNEL);
....@@ -410,7 +396,7 @@
410396 CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK |
411397 CSR_OTP_GP_REG_ECC_UNCORR_STATUS_MSK);
412398 /* 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) {
414400 ret = iwl_find_otp_image(trans, &validblockaddr);
415401 if (ret)
416402 goto err_unlock;