aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
diff options
context:
space:
mode:
authorDon Fry <donald.h.fry@intel.com>2011-04-20 18:25:14 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-04-30 11:56:59 -0400
commit16b80b714f8ef86d47680e4afa0eeb8cc61daef4 (patch)
treefe12b355a891131b19946d308339ee394cfe4baf /drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
parent9d143e9a0d68025efe902d86eb6207cbec36dcdb (diff)
iwlagn: semaphore and calib cleanup
All agn devices use the same eeprom semaphore and calib version routines. Delete the indirection and move the semaphore routines to where they are used and make static. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
index 3bcaa10f9929..2ef9448b1c20 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-eeprom.c
@@ -81,52 +81,13 @@
81 * 81 *
82******************************************************************************/ 82******************************************************************************/
83 83
84/*
85 * The device's EEPROM semaphore prevents conflicts between driver and uCode
86 * when accessing the EEPROM; each access is a series of pulses to/from the
87 * EEPROM chip, not a single event, so even reads could conflict if they
88 * weren't arbitrated by the semaphore.
89 */
90int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv)
91{
92 u16 count;
93 int ret;
94
95 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
96 /* Request semaphore */
97 iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
98 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
99
100 /* See if we got it */
101 ret = iwl_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
102 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
103 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
104 EEPROM_SEM_TIMEOUT);
105 if (ret >= 0) {
106 IWL_DEBUG_EEPROM(priv,
107 "Acquired semaphore after %d tries.\n",
108 count+1);
109 return ret;
110 }
111 }
112
113 return ret;
114}
115
116void iwlcore_eeprom_release_semaphore(struct iwl_priv *priv)
117{
118 iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
119 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
120
121}
122
123int iwl_eeprom_check_version(struct iwl_priv *priv) 84int iwl_eeprom_check_version(struct iwl_priv *priv)
124{ 85{
125 u16 eeprom_ver; 86 u16 eeprom_ver;
126 u16 calib_ver; 87 u16 calib_ver;
127 88
128 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION); 89 eeprom_ver = iwl_eeprom_query16(priv, EEPROM_VERSION);
129 calib_ver = priv->cfg->ops->lib->eeprom_ops.calib_version(priv); 90 calib_ver = iwlagn_eeprom_calib_version(priv);
130 91
131 if (eeprom_ver < priv->cfg->eeprom_ver || 92 if (eeprom_ver < priv->cfg->eeprom_ver ||
132 calib_ver < priv->cfg->eeprom_calib_ver) 93 calib_ver < priv->cfg->eeprom_calib_ver)