diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-03-19 08:55:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-03-30 14:15:15 -0400 |
commit | 6fb1b1e18fe3d141c54182c5d5b3af823bed455f (patch) | |
tree | 78d4b143bd0ef2368b3e4456f69a78bbe427b259 | |
parent | 691680b8335fa8995b190676f53e3bcef6477b4a (diff) |
ath9k: add support for overriding the MAC address through platform data
On some devices the correct MAC address is not in the EEPROM data, but
stored somewhere else.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 7 | ||||
-rw-r--r-- | include/linux/ath9k_platform.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 79aec983279f..e22e8215d941 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/ath9k_platform.h> | ||
18 | 19 | ||
19 | #include "ath9k.h" | 20 | #include "ath9k.h" |
20 | 21 | ||
@@ -537,6 +538,7 @@ static void ath9k_init_misc(struct ath_softc *sc) | |||
537 | static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | 538 | static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, |
538 | const struct ath_bus_ops *bus_ops) | 539 | const struct ath_bus_ops *bus_ops) |
539 | { | 540 | { |
541 | struct ath9k_platform_data *pdata = sc->dev->platform_data; | ||
540 | struct ath_hw *ah = NULL; | 542 | struct ath_hw *ah = NULL; |
541 | struct ath_common *common; | 543 | struct ath_common *common; |
542 | int ret = 0, i; | 544 | int ret = 0, i; |
@@ -551,7 +553,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
551 | ah->hw_version.subsysid = subsysid; | 553 | ah->hw_version.subsysid = subsysid; |
552 | sc->sc_ah = ah; | 554 | sc->sc_ah = ah; |
553 | 555 | ||
554 | if (!sc->dev->platform_data) | 556 | if (!pdata) |
555 | ah->ah_flags |= AH_USE_EEPROM; | 557 | ah->ah_flags |= AH_USE_EEPROM; |
556 | 558 | ||
557 | common = ath9k_hw_common(ah); | 559 | common = ath9k_hw_common(ah); |
@@ -587,6 +589,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
587 | if (ret) | 589 | if (ret) |
588 | goto err_hw; | 590 | goto err_hw; |
589 | 591 | ||
592 | if (pdata && pdata->macaddr) | ||
593 | memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); | ||
594 | |||
590 | ret = ath9k_init_queues(sc); | 595 | ret = ath9k_init_queues(sc); |
591 | if (ret) | 596 | if (ret) |
592 | goto err_queues; | 597 | goto err_queues; |
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h index b847fc7b93f9..b5f06583a1ba 100644 --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | struct ath9k_platform_data { | 24 | struct ath9k_platform_data { |
25 | u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; | 25 | u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; |
26 | u8 *macaddr; | ||
26 | }; | 27 | }; |
27 | 28 | ||
28 | #endif /* _LINUX_ATH9K_PLATFORM_H */ | 29 | #endif /* _LINUX_ATH9K_PLATFORM_H */ |