aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ipw2x00
diff options
context:
space:
mode:
authorStanislav Yakovlev <stas.yakovlev@gmail.com>2012-05-17 15:56:35 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-05 17:15:49 -0400
commitfdbfff73408f99799724f583cbc2a0ce3263c6a7 (patch)
treedfe660b5e2a6bd0ccc5126cc1bae2beedfb8bf3f /drivers/net/wireless/ipw2x00
parent605b73af3273336b2465962d99a937069710e104 (diff)
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: Stanislav Yakovlev <stas.yakovlev@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ipw2x00')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 0036737fe8e3..254b89223276 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2701,6 +2701,20 @@ static void eeprom_parse_mac(struct ipw_priv *priv, u8 * mac)
2701 memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6); 2701 memcpy(mac, &priv->eeprom[EEPROM_MAC_ADDRESS], 6);
2702} 2702}
2703 2703
2704static void ipw_read_eeprom(struct ipw_priv *priv)
2705{
2706 int i;
2707 __le16 *eeprom = (__le16 *) priv->eeprom;
2708
2709 IPW_DEBUG_TRACE(">>\n");
2710
2711 /* read entire contents of eeprom into private buffer */
2712 for (i = 0; i < 128; i++)
2713 eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
2714
2715 IPW_DEBUG_TRACE("<<\n");
2716}
2717
2704/* 2718/*
2705 * Either the device driver (i.e. the host) or the firmware can 2719 * Either the device driver (i.e. the host) or the firmware can
2706 * load eeprom data into the designated region in SRAM. If neither 2720 * 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)
2712static void ipw_eeprom_init_sram(struct ipw_priv *priv) 2726static void ipw_eeprom_init_sram(struct ipw_priv *priv)
2713{ 2727{
2714 int i; 2728 int i;
2715 __le16 *eeprom = (__le16 *) priv->eeprom;
2716 2729
2717 IPW_DEBUG_TRACE(">>\n"); 2730 IPW_DEBUG_TRACE(">>\n");
2718 2731
2719 /* read entire contents of eeprom into private buffer */
2720 for (i = 0; i < 128; i++)
2721 eeprom[i] = cpu_to_le16(eeprom_read_u16(priv, (u8) i));
2722
2723 /* 2732 /*
2724 If the data looks correct, then copy it to our private 2733 If the data looks correct, then copy it to our private
2725 copy. Otherwise let the firmware know to perform the operation 2734 copy. Otherwise let the firmware know to perform the operation
@@ -3643,8 +3652,10 @@ static int ipw_load(struct ipw_priv *priv)
3643 /* ack fw init done interrupt */ 3652 /* ack fw init done interrupt */
3644 ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE); 3653 ipw_write32(priv, IPW_INTA_RW, IPW_INTA_BIT_FW_INITIALIZATION_DONE);
3645 3654
3646 /* read eeprom data and initialize the eeprom region of sram */ 3655 /* read eeprom data */
3647 priv->eeprom_delay = 1; 3656 priv->eeprom_delay = 1;
3657 ipw_read_eeprom(priv);
3658 /* initialize the eeprom region of sram */
3648 ipw_eeprom_init_sram(priv); 3659 ipw_eeprom_init_sram(priv);
3649 3660
3650 /* enable interrupts */ 3661 /* enable interrupts */