2009-11-28 20:01:03 +02:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
2010-04-14 03:09:26 +03:00
|
|
|
@@ -17,8 +17,10 @@
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/slab.h>
|
2009-11-28 20:01:03 +02:00
|
|
|
#include <linux/etherdevice.h>
|
|
|
|
+#include <linux/ath9k_platform.h>
|
|
|
|
#include <asm/unaligned.h>
|
|
|
|
|
|
|
|
+#include "ath9k.h"
|
|
|
|
#include "hw.h"
|
2010-04-10 19:50:15 +03:00
|
|
|
#include "hw-ops.h"
|
2009-11-28 20:01:03 +02:00
|
|
|
#include "rc.h"
|
2010-10-16 05:30:30 +03:00
|
|
|
@@ -434,18 +436,23 @@ static void ath9k_hw_init_defaults(struc
|
2009-11-28 20:01:03 +02:00
|
|
|
static int ath9k_hw_init_macaddr(struct ath_hw *ah)
|
|
|
|
{
|
|
|
|
struct ath_common *common = ath9k_hw_common(ah);
|
|
|
|
+ struct ath_softc *sc = (struct ath_softc *) common->priv;
|
|
|
|
+ struct ath9k_platform_data *pdata = sc->dev->platform_data;
|
|
|
|
u32 sum;
|
|
|
|
int i;
|
|
|
|
u16 eeval;
|
2010-04-10 19:50:15 +03:00
|
|
|
u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW };
|
2009-11-28 20:01:03 +02:00
|
|
|
|
|
|
|
sum = 0;
|
|
|
|
- for (i = 0; i < 3; i++) {
|
2010-04-10 19:50:15 +03:00
|
|
|
- eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
|
2009-11-28 20:01:03 +02:00
|
|
|
- sum += eeval;
|
|
|
|
- common->macaddr[2 * i] = eeval >> 8;
|
|
|
|
- common->macaddr[2 * i + 1] = eeval & 0xff;
|
|
|
|
- }
|
|
|
|
+ if (pdata && pdata->macaddr)
|
|
|
|
+ memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
|
|
|
|
+ else
|
|
|
|
+ for (i = 0; i < 3; i++) {
|
2010-04-10 19:50:15 +03:00
|
|
|
+ eeval = ah->eep_ops->get_eeprom(ah, EEP_MAC[i]);
|
2009-11-28 20:01:03 +02:00
|
|
|
+ sum += eeval;
|
|
|
|
+ common->macaddr[2 * i] = eeval >> 8;
|
|
|
|
+ common->macaddr[2 * i + 1] = eeval & 0xff;
|
|
|
|
+ }
|
|
|
|
if (!is_valid_ether_addr(common->macaddr)) {
|
2010-03-10 03:09:12 +02:00
|
|
|
ath_print(common, ATH_DBG_EEPROM,
|
|
|
|
"eeprom contains invalid mac address: %pM\n",
|
2009-11-28 20:01:03 +02:00
|
|
|
--- a/include/linux/ath9k_platform.h
|
|
|
|
+++ b/include/linux/ath9k_platform.h
|
|
|
|
@@ -23,6 +23,7 @@
|
|
|
|
|
|
|
|
struct ath9k_platform_data {
|
|
|
|
u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
|
|
|
|
+ u8 *macaddr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _LINUX_ATH9K_PLATFORM_H */
|