aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index a79e8c383a39..dc55ff294b73 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -38,6 +38,7 @@
38#include <linux/etherdevice.h> 38#include <linux/etherdevice.h>
39#include <asm/unaligned.h> 39#include <asm/unaligned.h>
40 40
41#include "iwl-eeprom.h"
41#include "iwl-core.h" 42#include "iwl-core.h"
42#include "iwl-4965.h" 43#include "iwl-4965.h"
43#include "iwl-helpers.h" 44#include "iwl-helpers.h"
@@ -4824,10 +4825,23 @@ void iwl4965_hw_cancel_deferred_work(struct iwl4965_priv *priv)
4824 cancel_delayed_work(&priv->init_alive_start); 4825 cancel_delayed_work(&priv->init_alive_start);
4825} 4826}
4826 4827
4828static struct iwl_lib_ops iwl4965_lib = {
4829 .eeprom_ops = {
4830 .verify_signature = iwlcore_eeprom_verify_signature,
4831 .acquire_semaphore = iwlcore_eeprom_acquire_semaphore,
4832 .release_semaphore = iwlcore_eeprom_release_semaphore,
4833 },
4834};
4835
4836static struct iwl_ops iwl4965_ops = {
4837 .lib = &iwl4965_lib,
4838};
4839
4827static struct iwl_cfg iwl4965_agn_cfg = { 4840static struct iwl_cfg iwl4965_agn_cfg = {
4828 .name = "4965AGN", 4841 .name = "4965AGN",
4829 .fw_name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode", 4842 .fw_name = "iwlwifi-4965" IWL4965_UCODE_API ".ucode",
4830 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N, 4843 .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
4844 .ops = &iwl4965_ops,
4831}; 4845};
4832 4846
4833struct pci_device_id iwl4965_hw_card_ids[] = { 4847struct pci_device_id iwl4965_hw_card_ids[] = {
@@ -4836,35 +4850,4 @@ struct pci_device_id iwl4965_hw_card_ids[] = {
4836 {0} 4850 {0}
4837}; 4851};
4838 4852
4839/*
4840 * The device's EEPROM semaphore prevents conflicts between driver and uCode
4841 * when accessing the EEPROM; each access is a series of pulses to/from the
4842 * EEPROM chip, not a single event, so even reads could conflict if they
4843 * weren't arbitrated by the semaphore.
4844 */
4845int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv)
4846{
4847 u16 count;
4848 int rc;
4849
4850 for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
4851 /* Request semaphore */
4852 iwl4965_set_bit(priv, CSR_HW_IF_CONFIG_REG,
4853 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);
4854
4855 /* See if we got it */
4856 rc = iwl4965_poll_bit(priv, CSR_HW_IF_CONFIG_REG,
4857 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
4858 CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
4859 EEPROM_SEM_TIMEOUT);
4860 if (rc >= 0) {
4861 IWL_DEBUG_IO("Acquired semaphore after %d tries.\n",
4862 count+1);
4863 return rc;
4864 }
4865 }
4866
4867 return rc;
4868}
4869
4870MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids); 4853MODULE_DEVICE_TABLE(pci, iwl4965_hw_card_ids);