Fix ramips build when CONFIG_RALINK_DEV_GPIO_BUTTONS is not set.
[openwrt.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 @@ -17,8 +17,10 @@
4 #include <linux/io.h>
5 #include <linux/slab.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 "hw-ops.h"
13 #include "rc.h"
14 @@ -441,18 +443,23 @@ static void ath9k_hw_init_defaults(struc
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 u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
24
25 sum = 0;
26 - for (i = 0; i < 3; i++) {
27 - eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
28 - sum += eeval;
29 - common->macaddr[2 * i] = eeval >> 8;
30 - common->macaddr[2 * i + 1] = eeval & 0xff;
31 - }
32 + if (pdata && pdata->macaddr)
33 + memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
34 + else
35 + for (i = 0; i < 3; i++) {
36 + eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
37 + sum += eeval;
38 + common->macaddr[2 * i] = eeval >> 8;
39 + common->macaddr[2 * i + 1] = eeval & 0xff;
40 + }
41 if (!is_valid_ether_addr(common->macaddr)) {
42 ath_print(common, ATH_DBG_EEPROM,
43 "eeprom contains invalid mac address: %pM\n",
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 */
This page took 0.042772 seconds and 5 git commands to generate.