Skip to content

Commit

Permalink
iwlegacy: merge iwl-4965-eeprom.c into 4965.c
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
  • Loading branch information
Stanislaw Gruszka committed Nov 15, 2011
1 parent ecce1f0 commit 56e7a8c
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 151 deletions.
74 changes: 74 additions & 0 deletions drivers/net/wireless/iwlegacy/4965.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,80 @@
#include "iwl-4965.h"
#include "iwl-4965-debugfs.h"

/******************************************************************************
*
* EEPROM related functions
*
******************************************************************************/

/*
* The device's EEPROM semaphore prevents conflicts between driver and uCode
* when accessing the EEPROM; each access is a series of pulses to/from the
* EEPROM chip, not a single event, so even reads could conflict if they
* weren't arbitrated by the semaphore.
*/
int il4965_eeprom_acquire_semaphore(struct il_priv *il)
{
u16 count;
int ret;

for (count = 0; count < EEPROM_SEM_RETRY_LIMIT; count++) {
/* Request semaphore */
il_set_bit(il, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);

/* See if we got it */
ret = _il_poll_bit(il, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
EEPROM_SEM_TIMEOUT);
if (ret >= 0)
return ret;
}

return ret;
}

void il4965_eeprom_release_semaphore(struct il_priv *il)
{
il_clear_bit(il, CSR_HW_IF_CONFIG_REG,
CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM);

}

int il4965_eeprom_check_version(struct il_priv *il)
{
u16 eeprom_ver;
u16 calib_ver;

eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
calib_ver = il_eeprom_query16(il,
EEPROM_4965_CALIB_VERSION_OFFSET);

if (eeprom_ver < il->cfg->eeprom_ver ||
calib_ver < il->cfg->eeprom_calib_ver)
goto err;

IL_INFO("device EEPROM VER=0x%x, CALIB=0x%x\n",
eeprom_ver, calib_ver);

return 0;
err:
IL_ERR("Unsupported (too old) EEPROM VER=0x%x < 0x%x "
"CALIB=0x%x < 0x%x\n",
eeprom_ver, il->cfg->eeprom_ver,
calib_ver, il->cfg->eeprom_calib_ver);
return -EINVAL;

}

void il4965_eeprom_get_mac(const struct il_priv *il, u8 *mac)
{
const u8 *addr = il_eeprom_query_addr(il,
EEPROM_MAC_ADDRESS);
memcpy(mac, addr, ETH_ALEN);
}

/* Send led command */
static int
il4965_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlegacy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj-$(CONFIG_IWL4965) += iwl4965.o
iwl4965-objs := 4965.o 4965-mac.o iwl-4965-rs.o
iwl4965-objs += iwl-4965-ucode.o iwl-4965-tx.o
iwl4965-objs += iwl-4965-lib.o iwl-4965-rx.o iwl-4965-calib.o
iwl4965-objs += iwl-4965-sta.o iwl-4965-eeprom.o
iwl4965-objs += iwl-4965-sta.o
iwl4965-$(CONFIG_IWLEGACY_DEBUGFS) += iwl-4965-debugfs.o

# 3945
Expand Down
150 changes: 0 additions & 150 deletions drivers/net/wireless/iwlegacy/iwl-4965-eeprom.c

This file was deleted.

0 comments on commit 56e7a8c

Please sign in to comment.