Commit fdbfff73 authored by Stanislav Yakovlev's avatar Stanislav Yakovlev Committed by John W. Linville

net/wireless: ipw2200: introduce ipw_read_eeprom function

We separate reading of device's eeprom content from writing it back
to the device's sram.
Signed-off-by: default avatarStanislav Yakovlev <stas.yakovlev@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 605b73af
...@@ -2701,6 +2701,20 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) ...@@ -2701,6 +2701,20 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6);
} }
static void ipw_read_eeprom(struct ipw_priv *priv)
{
int i;
__le16 *eeprom = (__le16 *) priv->eeprom;
IPW_DEBUG_TRACE(">>\n");
/* read entire contents of eeprom into private buffer */
for (i = 0; i < 128; i++)
eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
IPW_DEBUG_TRACE("<<\n");
}
/* /*
* Either the device driver (i.e. the host) or the firmware can * Either the device driver (i.e. the host) or the firmware can
* load eeprom data into the designated region in SRAM. If neither * load eeprom data into the designated region in SRAM. If neither
...@@ -2712,14 +2726,9 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac) ...@@ -2712,14 +2726,9 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
static void ipw_eeprom_init_sram(struct ipw_priv *priv) static void ipw_eeprom_init_sram(struct ipw_priv *priv)
{ {
int i; int i;
__le16 *eeprom = (__le16 *) priv->eeprom;
IPW_DEBUG_TRACE(">>\n"); IPW_DEBUG_TRACE(">>\n");
/* read entire contents of eeprom into private buffer */
for (i = 0; i < 128; i++)
eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
/* /*
If the data looks correct, then copy it to our private If the data looks correct, then copy it to our private
copy. Otherwise let the firmware know to perform the operation copy. Otherwise let the firmware know to perform the operation
...@@ -3643,8 +3652,10 @@ static int ipw_load(struct ipw_priv *priv) ...@@ -3643,8 +3652,10 @@ static int ipw_load(struct ipw_priv *priv)
/* ack fw init done interrupt */ /* ack fw init done interrupt */
ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE);
/* read eeprom data and initialize the eeprom region of sram */ /* read eeprom data */
priv->eeprom_delay = 1; priv->eeprom_delay = 1;
ipw_read_eeprom(priv);
/* initialize the eeprom region of sram */
ipw_eeprom_init_sram(priv); ipw_eeprom_init_sram(priv);
/* enable interrupts */ /* enable interrupts */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment