From: Felix Fietkau Date: Fri, 19 Nov 2010 00:57:35 +0000 (+0000) Subject: ath9k: rework the mac address override patch to not break ath9k_htc X-Git-Tag: reboot~18350 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a9ef165cff0f9c867a0d9db2b150029fa0f1da9c;p=openwrt%2Fstaging%2Fxback.git ath9k: rework the mac address override patch to not break ath9k_htc SVN-Revision: 24031 --- 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 315e7992c5..353419417b 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 -@@ -17,8 +17,10 @@ - #include - #include - #include -+#include - #include - -+#include "ath9k.h" - #include "hw.h" - #include "hw-ops.h" - #include "rc.h" -@@ -434,18 +436,23 @@ static void ath9k_hw_init_defaults(struc - 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; - u32 EEP_MAC[] = { EEP_MAC_LSW, EEP_MAC_MID, EEP_MAC_MSW }; - - sum = 0; -- for (i = 0; i < 3; i++) { -- eeval = ah->eep_ops->get_eeprom(ah, EEP_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, EEP_MAC[i]); -+ sum += eeval; -+ common->macaddr[2 * i] = eeval >> 8; -+ common->macaddr[2 * i + 1] = eeval & 0xff; -+ } - if (!is_valid_ether_addr(common->macaddr)) { - ath_print(common, ATH_DBG_EEPROM, - "eeprom contains invalid mac address: %pM\n", --- a/include/linux/ath9k_platform.h +++ b/include/linux/ath9k_platform.h @@ -23,6 +23,7 @@ @@ -51,3 +8,31 @@ }; #endif /* _LINUX_ATH9K_PLATFORM_H */ +--- a/drivers/net/wireless/ath/ath9k/init.c ++++ b/drivers/net/wireless/ath/ath9k/init.c +@@ -16,6 +16,7 @@ + + #include + #include ++#include + + #include "ath9k.h" + +@@ -520,6 +521,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; +@@ -565,6 +567,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_debug(ah); + if (ret) { + ath_print(common, ATH_DBG_FATAL, diff --git a/package/mac80211/patches/409-ath9k_platform_settings.patch b/package/mac80211/patches/409-ath9k_platform_settings.patch index 8c2a5e606c..c0530fd9fe 100644 --- a/package/mac80211/patches/409-ath9k_platform_settings.patch +++ b/package/mac80211/patches/409-ath9k_platform_settings.patch @@ -1,22 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -17,6 +17,7 @@ - #include - #include - -+#include "linux/ath9k_platform.h" - #include "ath9k.h" - - static char *dev_info = "ath9k"; -@@ -522,6 +523,7 @@ static int ath9k_init_softc(u16 devid, s - { - struct ath_hw *ah = NULL; - struct ath_common *common; -+ struct ath9k_platform_data *pdata; - int ret = 0, i; - int csz = 0; - -@@ -533,8 +535,15 @@ static int ath9k_init_softc(u16 devid, s +@@ -535,8 +535,15 @@ static int ath9k_init_softc(u16 devid, s ah->hw_version.subsysid = subsysid; sc->sc_ah = ah;