diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-04-13 15:56:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-14 15:35:09 -0400 |
commit | fa9bfd61e03e8dbcf110a93b373234d17a732233 (patch) | |
tree | d2d3b0e6ac74ffba6eda683246098bb7d34016a5 /drivers/net/wireless/ath/ath5k/eeprom.c | |
parent | 0cb9e06b6359bfa82f46c38a0b43e72d90b84081 (diff) |
ath5k: add a new bus op for reading the mac address
On AHB, the calibration data usually does not contain a valid MAC address,
the correct MAC address is stored in the board config.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.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.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c index fb12027e034..e9263e4c7f3 100644 --- a/drivers/net/wireless/ath/ath5k/eeprom.c +++ b/drivers/net/wireless/ath/ath5k/eeprom.c | |||
@@ -1732,35 +1732,6 @@ ath5k_eeprom_read_spur_chans(struct ath5k_hw *ah) | |||
1732 | return ret; | 1732 | return ret; |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | /* | ||
1736 | * Read the MAC address from eeprom | ||
1737 | */ | ||
1738 | int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac) | ||
1739 | { | ||
1740 | u8 mac_d[ETH_ALEN] = {}; | ||
1741 | u32 total, offset; | ||
1742 | u16 data; | ||
1743 | int octet; | ||
1744 | |||
1745 | AR5K_EEPROM_READ(0x20, data); | ||
1746 | |||
1747 | for (offset = 0x1f, octet = 0, total = 0; offset >= 0x1d; offset--) { | ||
1748 | AR5K_EEPROM_READ(offset, data); | ||
1749 | |||
1750 | total += data; | ||
1751 | mac_d[octet + 1] = data & 0xff; | ||
1752 | mac_d[octet] = data >> 8; | ||
1753 | octet += 2; | ||
1754 | } | ||
1755 | |||
1756 | if (!total || total == 3 * 0xffff) | ||
1757 | return -EINVAL; | ||
1758 | |||
1759 | memcpy(mac, mac_d, ETH_ALEN); | ||
1760 | |||
1761 | return 0; | ||
1762 | } | ||
1763 | |||
1764 | 1735 | ||
1765 | /***********************\ | 1736 | /***********************\ |
1766 | * Init/Detach functions * | 1737 | * Init/Detach functions * |