1 --- a/drivers/net/wireless/ath/ath9k/hw.c
2 +++ b/drivers/net/wireless/ath/ath9k/hw.c
5 #include <linux/slab.h>
6 #include <linux/etherdevice.h>
7 +#include <linux/ath9k_platform.h>
8 #include <asm/unaligned.h>
14 @@ -436,18 +438,23 @@ static void ath9k_hw_init_defaults(struc
15 static int ath9k_hw_init_macaddr(struct ath_hw *ah)
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;
23 u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
26 - for (i = 0; i < 3; i++) {
27 - eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
29 - common->macaddr[2 * i] = eeval >> 8;
30 - common->macaddr[2 * i + 1] = eeval & 0xff;
32 + if (pdata && pdata->macaddr)
33 + memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
35 + for (i = 0; i < 3; i++) {
36 + eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
38 + common->macaddr[2 * i] = eeval >> 8;
39 + common->macaddr[2 * i + 1] = eeval & 0xff;
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
48 struct ath9k_platform_data {
49 u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
53 #endif /* _LINUX_ATH9K_PLATFORM_H */