瀏覽代碼

iwlwifi: power up all devices for EEPROM read

Recent commits "iwlwifi: remove power-wasting calls to apm_ops.init()" and
"iwlagn: power up device before initializing EEPROM" had the goal of
reducing device power consumption from the time the module is loaded until
the interface is brought up and the device's power saving mechanisms kick
in. The idea is that once the module is loaded there is no need for the
device to consume power until the interface is brought up.

With the current solution the device is only powered up during EEPROM read,
and then so also only if the EEPROM type is OTP. We have found that on
certain platforms even non-OTP devices require power to be up during EEPROM
read. On these platforms the driver never loads and the system log contains
the following:

iwlagn 0000:03:00.0: MAC is in deep sleep!.  CSR_GP_CNTRL = 0x080403D8

We thus now power up all devices during EEPROM read.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Reinette Chatre 15 年之前
父節點
當前提交
f8701fe3ae
共有 2 個文件被更改,包括 6 次插入16 次删除
  1. 3 5
      drivers/net/wireless/iwlwifi/iwl-csr.h
  2. 3 11
      drivers/net/wireless/iwlwifi/iwl-eeprom.c

+ 3 - 5
drivers/net/wireless/iwlwifi/iwl-csr.h

@@ -77,8 +77,7 @@
  * The MAC (uCode processor, etc.) does not need to be powered up for accessing
  * The MAC (uCode processor, etc.) does not need to be powered up for accessing
  * the CSR registers.
  * the CSR registers.
  *
  *
- * NOTE:  Newer devices using one-time-programmable (OTP) memory
- *        require device to be awake in order to read this memory
+ * NOTE:  Device does need to be awake in order to read this memory
  *        via CSR_EEPROM and CSR_OTP registers
  *        via CSR_EEPROM and CSR_OTP registers
  */
  */
 #define CSR_BASE    (0x000)
 #define CSR_BASE    (0x000)
@@ -111,9 +110,8 @@
 /*
 /*
  * EEPROM and OTP (one-time-programmable) memory reads
  * EEPROM and OTP (one-time-programmable) memory reads
  *
  *
- * NOTE:  For (newer) devices using OTP, device must be awake, initialized via
- *        apm_ops.init() in order to read.  Older devices (3945/4965/5000)
- *        use EEPROM and do not require this.
+ * NOTE:  Device must be awake, initialized via apm_ops.init(),
+ *        in order to read.
  */
  */
 #define CSR_EEPROM_REG          (CSR_BASE+0x02c)
 #define CSR_EEPROM_REG          (CSR_BASE+0x02c)
 #define CSR_EEPROM_GP           (CSR_BASE+0x030)
 #define CSR_EEPROM_GP           (CSR_BASE+0x030)

+ 3 - 11
drivers/net/wireless/iwlwifi/iwl-eeprom.c

@@ -518,10 +518,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
 	}
 	}
 	e = (u16 *)priv->eeprom;
 	e = (u16 *)priv->eeprom;
 
 
-	if (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP) {
-		/* OTP reads require powered-up chip */
-		priv->cfg->ops->lib->apm_ops.init(priv);
-	}
+	priv->cfg->ops->lib->apm_ops.init(priv);
 
 
 	ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
 	ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
 	if (ret < 0) {
 	if (ret < 0) {
@@ -570,13 +567,6 @@ int iwl_eeprom_init(struct iwl_priv *priv)
 			e[cache_addr / 2] = eeprom_data;
 			e[cache_addr / 2] = eeprom_data;
 			cache_addr += sizeof(u16);
 			cache_addr += sizeof(u16);
 		}
 		}
-
-		/*
-		 * Now that OTP reads are complete, reset chip to save
-		 *   power until we load uCode during "up".
-		 */
-		priv->cfg->ops->lib->apm_ops.stop(priv);
-
 	} else {
 	} else {
 		/* eeprom is an array of 16bit values */
 		/* eeprom is an array of 16bit values */
 		for (addr = 0; addr < sz; addr += sizeof(u16)) {
 		for (addr = 0; addr < sz; addr += sizeof(u16)) {
@@ -603,6 +593,8 @@ done:
 err:
 err:
 	if (ret)
 	if (ret)
 		iwl_eeprom_free(priv);
 		iwl_eeprom_free(priv);
+	/* Reset chip to save power until we load uCode during "up". */
+	priv->cfg->ops->lib->apm_ops.stop(priv);
 alloc_err:
 alloc_err:
 	return ret;
 	return ret;
 }
 }