aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-eeprom.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-10-02 16:44:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:45 -0400
commitf41bb897f202d23a7d896c716002a3d6050b991e (patch)
treed33eb3f81dbe75652d6ae6d4963fef9e34dc7311 /drivers/net/wireless/iwlwifi/iwl-eeprom.c
parent1739d3322008fb95e88ad0530bcc057789107879 (diff)
iwlwifi: validate the signature for EEPROM and OTP
Both 1000 & 6000 series NICs contain on-chip OTP memory that replaces the off-chip EEPROM memory. The nature of OTP means there is a limited number of times a particular board can go through the factory flow and be (re)calibrated. As a consequence there will be some boards that contain EEPROM memory because OTP blocks were full. In the signature validation routine, iwlwifi needs to make sure "select bit" and "EEPROM/OTP signature" agree on the type of NVM to be used to configure the system. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-eeprom.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-eeprom.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 8107132ab66c..e3dbd79cd13e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -215,12 +215,35 @@ static const struct iwl_txpwr_section enhinfo[] = {
215 215
216int iwlcore_eeprom_verify_signature(struct iwl_priv *priv) 216int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
217{ 217{
218 u32 gp = iwl_read32(priv, CSR_EEPROM_GP); 218 u32 gp = iwl_read32(priv, CSR_EEPROM_GP) & CSR_EEPROM_GP_VALID_MSK;
219 if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) { 219 int ret = 0;
220 IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp); 220
221 return -ENOENT; 221 IWL_DEBUG_INFO(priv, "EEPROM signature=0x%08x\n", gp);
222 switch (gp) {
223 case CSR_EEPROM_GP_BAD_SIG_EEP_GOOD_SIG_OTP:
224 if (priv->nvm_device_type != NVM_DEVICE_TYPE_OTP) {
225 IWL_ERR(priv, "EEPROM with bad signature: 0x%08x\n",
226 gp);
227 ret = -ENOENT;
228 }
229 break;
230 case CSR_EEPROM_GP_GOOD_SIG_EEP_LESS_THAN_4K:
231 case CSR_EEPROM_GP_GOOD_SIG_EEP_MORE_THAN_4K:
232 if (priv->nvm_device_type != NVM_DEVICE_TYPE_EEPROM) {
233 IWL_ERR(priv, "OTP with bad signature: 0x%08x\n", gp);
234 ret = -ENOENT;
235 }
236 break;
237 case CSR_EEPROM_GP_BAD_SIGNATURE_BOTH_EEP_AND_OTP:
238 default:
239 IWL_ERR(priv, "bad EEPROM/OTP signature, type=%s, "
240 "EEPROM_GP=0x%08x\n",
241 (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
242 ? "OTP" : "EEPROM", gp);
243 ret = -ENOENT;
244 break;
222 } 245 }
223 return 0; 246 return ret;
224} 247}
225EXPORT_SYMBOL(iwlcore_eeprom_verify_signature); 248EXPORT_SYMBOL(iwlcore_eeprom_verify_signature);
226 249