X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/54023e75037f2310e53f4573e603e0b0ced48ede..18dddc5fe8509a18d8bb800e8e480c33cd0cf8df:/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch?ds=sidebyside diff --git a/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch index c92cd17e0..2444db4bc 100644 --- a/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch +++ b/package/mac80211/patches/407-ath9k-override-mac-address-from-platform-data.patch @@ -1,46 +1,3 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -16,8 +16,10 @@ - - #include - #include -+#include - #include - -+#include "ath9k.h" - #include "hw.h" - #include "rc.h" - #include "initvals.h" -@@ -428,17 +430,23 @@ static int ath9k_hw_rf_claim(struct ath_ - 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; - - sum = 0; -- for (i = 0; i < 3; i++) { -- eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i)); -- 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++) { -+ eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i)); -+ sum += eeval; -+ common->macaddr[2 * i] = eeval >> 8; -+ common->macaddr[2 * i + 1] = eeval & 0xff; -+ } -+ - if (!is_valid_ether_addr(common->macaddr)) { - DECLARE_MAC_BUF(macbuf); - --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h @@ -23,6 +23,7 @@ @@ -51,3 +8,40 @@ }; #endif /* _LINUX_ATH9K_PLATFORM_H */ +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -15,6 +15,7 @@ + */ + + #include ++#include + + #include "ath9k.h" + +@@ -522,6 +523,7 @@ static void ath9k_init_misc(struct ath_s + static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, + const struct ath_bus_ops *bus_ops) + { ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct ath_hw *ah = NULL; + struct ath_common *common; + int ret = 0, i; +@@ -535,7 +537,7 @@ static int ath9k_init_softc(u16 devid, s + ah->hw_version.subsysid = subsysid; + sc->sc_ah = ah; + +- if (!sc->dev->platform_data) ++ if (!pdata) + ah->ah_flags |= AH_USE_EEPROM; + + common = ath9k_hw_common(ah); +@@ -568,6 +570,9 @@ static int ath9k_init_softc(u16 devid, s + if (ret) + goto err_hw; + ++ if (pdata && pdata->macaddr) ++ memcpy(common->macaddr, pdata->macaddr, ETH_ALEN); ++ + ret = ath9k_init_queues(sc); + if (ret) + goto err_queues;