-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Luca Coelho
authored and
Kalle Valo
committed
Oct 8, 2020
1 parent
0fafaa9
commit b3e4c0f
Showing
4 changed files
with
78 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters