mac80211: update to latest wireless-testing from today
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 407-ath9k-override-mac-address-from-platform-data.patch
1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
3 @@ -16,8 +16,10 @@
4
5 #include <linux/io.h>
6 #include <linux/etherdevice.h>
7 +#include <linux/ath9k_platform.h>
8 #include <asm/unaligned.h>
9
10 +#include "ath9k.h"
11 #include "hw.h"
12 #include "rc.h"
13 #include "initvals.h"
14 @@ -428,17 +430,23 @@ static int ath9k_hw_rf_claim(struct ath_
15 static int ath9k_hw_init_macaddr(struct ath_hw *ah)
16 {
17 struct ath_common *common = ath9k_hw_common(ah);
18 + struct ath_softc *sc = (struct ath_softc *) common->priv;
19 + struct ath9k_platform_data *pdata = sc->dev->platform_data;
20 u32 sum;
21 int i;
22 u16 eeval;
23
24 sum = 0;
25 - for (i = 0; i < 3; i++) {
26 - eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i));
27 - sum += eeval;
28 - common->macaddr[2 * i] = eeval >> 8;
29 - common->macaddr[2 * i + 1] = eeval & 0xff;
30 - }
31 + if (pdata && pdata->macaddr)
32 + memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
33 + else
34 + for (i = 0; i < 3; i++) {
35 + eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i));
36 + sum += eeval;
37 + common->macaddr[2 * i] = eeval >> 8;
38 + common->macaddr[2 * i + 1] = eeval & 0xff;
39 + }
40 +
41 if (!is_valid_ether_addr(common->macaddr)) {
42 DECLARE_MAC_BUF(macbuf);
43
44 --- a/include/linux/ath9k_platform.h
45 +++ b/include/linux/ath9k_platform.h
46 @@ -23,6 +23,7 @@
47
48 struct ath9k_platform_data {
49 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
50 + u8 *macaddr;
51 };
52
53 #endif /* _LINUX_ATH9K_PLATFORM_H */