1
0
Fork 0

iwlwifi: pcie: add workaround for power gating in integrated 22000

Add a workaround that forces power gating to be enabled on integrated
22000 devices.  This improves power saving in certain situations.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
alistair/sunxi64-5.4-dsi
Luca Coelho 2019-10-19 13:03:30 +03:00 committed by Kalle Valo
parent 91cf5dede5
commit 9a47cb9883
3 changed files with 31 additions and 0 deletions

View File

@ -279,6 +279,7 @@
* Indicates MAC is entering a power-saving sleep power-down.
* Not a good time to access device-internal resources.
*/
#define CSR_GP_CNTRL_REG_FLAG_INIT_DONE (0x00000004)
#define CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP (0x00000010)
#define CSR_GP_CNTRL_REG_FLAG_XTAL_ON (0x00000400)

View File

@ -449,6 +449,11 @@ enum {
#define PERSISTENCE_BIT BIT(12)
#define PREG_WFPM_ACCESS BIT(12)
#define HPM_HIPM_GEN_CFG 0xA03458
#define HPM_HIPM_GEN_CFG_CR_PG_EN BIT(0)
#define HPM_HIPM_GEN_CFG_CR_SLP_EN BIT(1)
#define HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE BIT(10)
#define UREG_DOORBELL_TO_ISR6 0xA05C04
#define UREG_DOORBELL_TO_ISR6_NMI_BIT BIT(0)
#define UREG_DOORBELL_TO_ISR6_SUSPEND BIT(18)

View File

@ -57,6 +57,24 @@
#include "internal.h"
#include "fw/dbg.h"
static int iwl_pcie_gen2_force_power_gating(struct iwl_trans *trans)
{
iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG,
HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE);
udelay(20);
iwl_set_bits_prph(trans, HPM_HIPM_GEN_CFG,
HPM_HIPM_GEN_CFG_CR_PG_EN |
HPM_HIPM_GEN_CFG_CR_SLP_EN);
udelay(20);
iwl_clear_bits_prph(trans, HPM_HIPM_GEN_CFG,
HPM_HIPM_GEN_CFG_CR_FORCE_ACTIVE);
iwl_trans_sw_reset(trans);
iwl_clear_bit(trans, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
return 0;
}
/*
* Start up NIC's basic functionality after it has been reset
* (e.g. after platform boot, or shutdown via iwl_pcie_apm_stop())
@ -92,6 +110,13 @@ int iwl_pcie_gen2_apm_init(struct iwl_trans *trans)
iwl_pcie_apm_config(trans);
if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_22000 &&
trans->cfg->integrated) {
ret = iwl_pcie_gen2_force_power_gating(trans);
if (ret)
return ret;
}
ret = iwl_finish_nic_init(trans, trans->trans_cfg);
if (ret)
return ret;