aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/eeprom.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-12-02 04:27:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-02 15:17:50 -0500
commit4aa5d783c9e1c72e4950ff34f388077ccecac74a (patch)
tree13e54573b8e38fa8f012d55dbbadddd503683e6e /drivers/net/wireless/ath/ath5k/eeprom.c
parente5b046d86fac609f636d127a38de94a175c7e83b (diff)
ath5k: Use generic eeprom read from common ath_bus_opts struct.
Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/eeprom.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/eeprom.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
index a648957501e..97eaa9a4415 100644
--- a/drivers/net/wireless/ath/ath5k/eeprom.c
+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
@@ -66,40 +66,6 @@ static u16 ath5k_eeprom_bin2freq(struct ath5k_eeprom_info *ee, u16 bin,
66\*********/ 66\*********/
67 67
68/* 68/*
69 * Read from eeprom
70 */
71static int ath5k_hw_eeprom_read(struct ath5k_hw *ah, u32 offset, u16 *data)
72{
73 u32 status, timeout;
74
75 /*
76 * Initialize EEPROM access
77 */
78 if (ah->ah_version == AR5K_AR5210) {
79 AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, AR5K_PCICFG_EEAE);
80 (void)ath5k_hw_reg_read(ah, AR5K_EEPROM_BASE + (4 * offset));
81 } else {
82 ath5k_hw_reg_write(ah, offset, AR5K_EEPROM_BASE);
83 AR5K_REG_ENABLE_BITS(ah, AR5K_EEPROM_CMD,
84 AR5K_EEPROM_CMD_READ);
85 }
86
87 for (timeout = AR5K_TUNE_REGISTER_TIMEOUT; timeout > 0; timeout--) {
88 status = ath5k_hw_reg_read(ah, AR5K_EEPROM_STATUS);
89 if (status & AR5K_EEPROM_STAT_RDDONE) {
90 if (status & AR5K_EEPROM_STAT_RDERR)
91 return -EIO;
92 *data = (u16)(ath5k_hw_reg_read(ah, AR5K_EEPROM_DATA) &
93 0xffff);
94 return 0;
95 }
96 udelay(15);
97 }
98
99 return -ETIMEDOUT;
100}
101
102/*
103 * Initialize eeprom & capabilities structs 69 * Initialize eeprom & capabilities structs
104 */ 70 */
105static int 71static int
@@ -1769,12 +1735,12 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
1769 u16 data; 1735 u16 data;
1770 int octet, ret; 1736 int octet, ret;
1771 1737
1772 ret = ath5k_hw_eeprom_read(ah, 0x20, &data); 1738 ret = ath5k_hw_nvram_read(ah, 0x20, &data);
1773 if (ret) 1739 if (ret)
1774 return ret; 1740 return ret;
1775 1741
1776 for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { 1742 for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) {
1777 ret = ath5k_hw_eeprom_read(ah, offset, &data); 1743 ret = ath5k_hw_nvram_read(ah, offset, &data);
1778 if (ret) 1744 if (ret)
1779 return ret; 1745 return ret;
1780 1746