iwlwifi: move PNVM implementation to common code
The PNVM code is generic and can be used by other opmodes. Move it to a common file and include it in the relevant opmodes. Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/iwlwifi.20201008181047.232aa310693b.I03a18ffa4162753af38e759d88e27509007c7bca@changeid
This commit is contained in:
parent
0fafaa97ef
commit
b3e4c0f34c
@ -16,7 +16,7 @@ iwlwifi-objs += iwl-trans.o
|
||||
iwlwifi-objs += queue/tx.o
|
||||
|
||||
iwlwifi-objs += fw/img.o fw/notif-wait.o
|
||||
iwlwifi-objs += fw/dbg.o
|
||||
iwlwifi-objs += fw/dbg.o fw/pnvm.o
|
||||
iwlwifi-$(CONFIG_IWLMVM) += fw/paging.o fw/smem.o fw/init.o
|
||||
iwlwifi-$(CONFIG_ACPI) += fw/acpi.o
|
||||
iwlwifi-$(CONFIG_IWLWIFI_DEBUGFS) += fw/debugfs.o
|
||||
|
55
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
Normal file
55
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c
Normal file
@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2020 Intel Corporation
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "iwl-drv.h"
|
||||
#include "pnvm.h"
|
||||
#include "iwl-prph.h"
|
||||
#include "iwl-io.h"
|
||||
#include "fw/api/commands.h"
|
||||
#include "fw/api/nvm-reg.h"
|
||||
|
||||
static bool iwl_pnvm_complete_fn(struct iwl_notif_wait_data *notif_wait,
|
||||
struct iwl_rx_packet *pkt, void *data)
|
||||
{
|
||||
struct iwl_trans *trans = (struct iwl_trans *)data;
|
||||
struct iwl_pnvm_init_complete_ntfy *pnvm_ntf = (void *)pkt->data;
|
||||
|
||||
IWL_DEBUG_FW(trans,
|
||||
"PNVM complete notification received with status %d\n",
|
||||
le32_to_cpu(pnvm_ntf->status));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int iwl_pnvm_load(struct iwl_trans *trans,
|
||||
struct iwl_notif_wait_data *notif_wait)
|
||||
{
|
||||
struct iwl_notification_wait pnvm_wait;
|
||||
static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP,
|
||||
PNVM_INIT_COMPLETE_NTFY) };
|
||||
|
||||
/* if the SKU_ID is empty, there's nothing to do */
|
||||
if (!trans->sku_id[0] && !trans->sku_id[1] && !trans->sku_id[2])
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* TODO: phase 2: load the pnvm file, find the right section,
|
||||
* load it and set the right DMA pointer.
|
||||
*/
|
||||
|
||||
iwl_init_notification_wait(notif_wait, &pnvm_wait,
|
||||
ntf_cmds, ARRAY_SIZE(ntf_cmds),
|
||||
iwl_pnvm_complete_fn, trans);
|
||||
|
||||
/* kick the doorbell */
|
||||
iwl_write_umac_prph(trans, UREG_DOORBELL_TO_ISR6,
|
||||
UREG_DOORBELL_TO_ISR6_PNVM);
|
||||
|
||||
return iwl_wait_notification(notif_wait, &pnvm_wait,
|
||||
MVM_UCODE_PNVM_TIMEOUT);
|
||||
}
|
||||
IWL_EXPORT_SYMBOL(iwl_pnvm_load);
|
18
drivers/net/wireless/intel/iwlwifi/fw/pnvm.h
Normal file
18
drivers/net/wireless/intel/iwlwifi/fw/pnvm.h
Normal file
@ -0,0 +1,18 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright(c) 2020 Intel Corporation
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef __IWL_PNVM_H__
|
||||
#define __IWL_PNVM_H__
|
||||
|
||||
#include "fw/notif-wait.h"
|
||||
|
||||
#define MVM_UCODE_PNVM_TIMEOUT (HZ / 10)
|
||||
|
||||
int iwl_pnvm_load(struct iwl_trans *trans,
|
||||
struct iwl_notif_wait_data *notif_wait);
|
||||
|
||||
#endif /* __IWL_PNVM_H__ */
|
@ -70,6 +70,7 @@
|
||||
#include "iwl-io.h" /* for iwl_mvm_rx_card_state_notif */
|
||||
#include "iwl-prph.h"
|
||||
#include "fw/acpi.h"
|
||||
#include "fw/pnvm.h"
|
||||
|
||||
#include "mvm.h"
|
||||
#include "fw/dbg.h"
|
||||
@ -77,9 +78,8 @@
|
||||
#include "iwl-modparams.h"
|
||||
#include "iwl-nvm-parse.h"
|
||||
|
||||
#define MVM_UCODE_ALIVE_TIMEOUT HZ
|
||||
#define MVM_UCODE_CALIB_TIMEOUT (2*HZ)
|
||||
#define MVM_UCODE_PNVM_TIMEOUT (HZ / 10)
|
||||
#define MVM_UCODE_ALIVE_TIMEOUT (HZ)
|
||||
#define MVM_UCODE_CALIB_TIMEOUT (2 * HZ)
|
||||
|
||||
#define UCODE_VALID_OK cpu_to_le32(0x1)
|
||||
|
||||
@ -313,20 +313,6 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool iwl_pnvm_complete_fn(struct iwl_notif_wait_data *notif_wait,
|
||||
struct iwl_rx_packet *pkt, void *data)
|
||||
{
|
||||
struct iwl_mvm *mvm =
|
||||
container_of(notif_wait, struct iwl_mvm, notif_wait);
|
||||
struct iwl_pnvm_init_complete_ntfy *pnvm_ntf = (void *)pkt->data;
|
||||
|
||||
IWL_DEBUG_FW(mvm,
|
||||
"PNVM complete notification received with status %d\n",
|
||||
le32_to_cpu(pnvm_ntf->status));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool iwl_wait_init_complete(struct iwl_notif_wait_data *notif_wait,
|
||||
struct iwl_rx_packet *pkt, void *data)
|
||||
{
|
||||
@ -350,35 +336,6 @@ static bool iwl_wait_phy_db_entry(struct iwl_notif_wait_data *notif_wait,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int iwl_mvm_load_pnvm(struct iwl_mvm *mvm)
|
||||
{
|
||||
struct iwl_notification_wait pnvm_wait;
|
||||
static const u16 ntf_cmds[] = { WIDE_ID(REGULATORY_AND_NVM_GROUP,
|
||||
PNVM_INIT_COMPLETE_NTFY) };
|
||||
|
||||
/* if the SKU_ID is empty, there's nothing to do */
|
||||
if (!mvm->trans->sku_id[0] &&
|
||||
!mvm->trans->sku_id[1] &&
|
||||
!mvm->trans->sku_id[2])
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* TODO: phase 2: load the pnvm file, find the right section,
|
||||
* load it and set the right DMA pointer.
|
||||
*/
|
||||
|
||||
iwl_init_notification_wait(&mvm->notif_wait, &pnvm_wait,
|
||||
ntf_cmds, ARRAY_SIZE(ntf_cmds),
|
||||
iwl_pnvm_complete_fn, NULL);
|
||||
|
||||
/* kick the doorbell */
|
||||
iwl_write_umac_prph(mvm->trans, UREG_DOORBELL_TO_ISR6,
|
||||
UREG_DOORBELL_TO_ISR6_PNVM);
|
||||
|
||||
return iwl_wait_notification(&mvm->notif_wait, &pnvm_wait,
|
||||
MVM_UCODE_PNVM_TIMEOUT);
|
||||
}
|
||||
|
||||
static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
|
||||
enum iwl_ucode_type ucode_type)
|
||||
{
|
||||
@ -467,7 +424,7 @@ static int iwl_mvm_load_ucode_wait_alive(struct iwl_mvm *mvm,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = iwl_mvm_load_pnvm(mvm);
|
||||
ret = iwl_pnvm_load(mvm->trans, &mvm->notif_wait);
|
||||
if (ret) {
|
||||
IWL_ERR(mvm, "Timeout waiting for PNVM load!\n");
|
||||
iwl_fw_set_current_image(&mvm->fwrt, old_type);
|
||||
|
Loading…
Reference in New Issue
Block a user