There is a router that users the MAC address for wireless from the platform data (which gets it from the flash ART partition) and the calibration data from a PCI-e card's EEPROM. Here we add support for this.
Signed-off-by: Daniel Dickinson <dan...@powercloudsystems.com> --- ...-allow-to-disable-bands-via-platform-data.patch | 33 ++++---- ...k-allow-mac-from-data-caldata-from-eeprom.patch | 81 ++++++++++++++++++++ ...-allow-mac-from-pdata-caldata-from-eeprom.patch | 80 +++++++++++++++++++ ...-allow-mac-from-pdata-caldata-from-eeprom.patch | 80 +++++++++++++++++++ 4 files changed, 261 insertions(+), 13 deletions(-) create mode 100644 package/mac80211/patches/b02-ath9k-allow-mac-from-data-caldata-from-eeprom.patch create mode 100644 target/linux/ar71xx/patches-3.3/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch create mode 100644 target/linux/ar71xx/patches-3.6/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch diff --git a/package/mac80211/patches/b01-ath9k-allow-to-disable-bands-via-platform-data.patch b/package/mac80211/patches/b01-ath9k-allow-to-disable-bands-via-platform-data.patch index 0a071ff..b2ea738 100644 --- a/package/mac80211/patches/b01-ath9k-allow-to-disable-bands-via-platform-data.patch +++ b/package/mac80211/patches/b01-ath9k-allow-to-disable-bands-via-platform-data.patch @@ -1,18 +1,21 @@ ---- a/include/linux/ath9k_platform.h -+++ b/include/linux/ath9k_platform.h -@@ -31,6 +31,9 @@ struct ath9k_platform_data { +Index: compat-wireless-2012-09-07/include/linux/ath9k_platform.h +=================================================================== +--- compat-wireless-2012-09-07.orig/include/linux/ath9k_platform.h 2012-11-02 01:00:58.000000000 -0400 ++++ compat-wireless-2012-09-07/include/linux/ath9k_platform.h 2012-11-02 01:02:11.866637863 -0400 +@@ -31,6 +31,8 @@ bool endian_check; bool is_clk_25mhz; + bool disable_2ghz; + bool disable_5ghz; -+ int (*get_mac_revision)(void); int (*external_reset)(void); ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2413,17 +2413,25 @@ int ath9k_hw_fill_cap_info(struct ath_hw +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/hw.c +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/hw.c 2012-11-02 01:00:59.063918071 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/hw.c 2012-11-02 01:00:59.659907593 -0400 +@@ -2413,17 +2413,25 @@ } eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE); @@ -46,9 +49,11 @@ if (AR_SREV_9485(ah) || AR_SREV_9285(ah) || AR_SREV_9330(ah)) chip_chainmask = 1; ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -927,6 +927,8 @@ struct ath_hw { +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/hw.h +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/hw.h 2012-11-02 01:00:59.067917999 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/hw.h 2012-11-02 01:00:59.663907524 -0400 +@@ -927,6 +927,8 @@ bool is_clk_25mhz; int (*get_mac_revision)(void); int (*external_reset)(void); @@ -57,9 +62,11 @@ }; struct ath_bus_ops { ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -537,6 +537,8 @@ static int ath9k_init_softc(u16 devid, s +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/init.c +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/init.c 2012-11-02 01:00:58.863921587 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/init.c 2012-11-02 01:00:59.663907524 -0400 +@@ -537,6 +537,8 @@ ah->is_clk_25mhz = pdata->is_clk_25mhz; ah->get_mac_revision = pdata->get_mac_revision; ah->external_reset = pdata->external_reset; diff --git a/package/mac80211/patches/b02-ath9k-allow-mac-from-data-caldata-from-eeprom.patch b/package/mac80211/patches/b02-ath9k-allow-mac-from-data-caldata-from-eeprom.patch new file mode 100644 index 0000000..6d14366 --- /dev/null +++ b/package/mac80211/patches/b02-ath9k-allow-mac-from-data-caldata-from-eeprom.patch @@ -0,0 +1,81 @@ +Index: compat-wireless-2012-09-07/include/linux/ath9k_platform.h +=================================================================== +--- compat-wireless-2012-09-07.orig/include/linux/ath9k_platform.h 2012-11-02 01:02:11.000000000 -0400 ++++ compat-wireless-2012-09-07/include/linux/ath9k_platform.h 2012-11-02 01:05:31.563122751 -0400 +@@ -33,6 +33,8 @@ + bool is_clk_25mhz; + bool disable_2ghz; + bool disable_5ghz; ++ bool no_eeprom_data; ++ + int (*get_mac_revision)(void); + int (*external_reset)(void); + +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/pci.c +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/pci.c 2012-09-08 06:00:11.000000000 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/pci.c 2012-11-02 01:03:23.005386245 -0400 +@@ -67,8 +67,13 @@ + { + struct ath_softc *sc = (struct ath_softc *) common->priv; + struct ath9k_platform_data *pdata = sc->dev->platform_data; ++ bool no_eeprom_data = false; + + if (pdata) { ++ no_eeprom_data = pdata->no_eeprom_data; ++ } ++ ++ if (pdata && !no_eeprom_data) { + if (off >= (ARRAY_SIZE(pdata->eeprom_data))) { + ath_err(common, + "%s: eeprom read failed, offset %08x is out of range\n", +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/gpio.c +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/gpio.c 2012-11-02 01:00:58.883921232 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/gpio.c 2012-11-02 01:03:23.005386245 -0400 +@@ -126,6 +126,11 @@ + char led_name[32]; + const char *trigger; + int i; ++ bool no_eeprom_data = false; ++ ++ if (pdata) { ++ no_eeprom_data = pdata->no_eeprom_data; ++ } + + INIT_LIST_HEAD(&sc->leds); + +@@ -155,7 +160,7 @@ + + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, 1); + +- if (!pdata) ++ if (!pdata || no_eeprom_data) + return; + + for (i = 0; i < pdata->num_leds; i++) +Index: compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/init.c +=================================================================== +--- compat-wireless-2012-09-07.orig/drivers/net/wireless/ath/ath9k/init.c 2012-11-02 01:00:59.663907524 -0400 ++++ compat-wireless-2012-09-07/drivers/net/wireless/ath/ath9k/init.c 2012-11-02 01:03:23.009386175 -0400 +@@ -512,6 +512,11 @@ + struct ath_common *common; + int ret = 0, i; + int csz = 0; ++ bool no_eeprom_data = false; ++ ++ if (pdata) { ++ no_eeprom_data = pdata->no_eeprom_data; ++ } + + ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL); + if (!ah) +@@ -527,7 +532,7 @@ + + sc->dfs_detector = dfs_pattern_detector_init(NL80211_DFS_UNSET); + +- if (!pdata) { ++ if (!pdata || no_eeprom_data) { + ah->ah_flags |= AH_USE_EEPROM; + sc->sc_ah->led_pin = -1; + } else { diff --git a/target/linux/ar71xx/patches-3.3/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch b/target/linux/ar71xx/patches-3.3/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch new file mode 100644 index 0000000..9c85d05 --- /dev/null +++ b/target/linux/ar71xx/patches-3.3/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch @@ -0,0 +1,80 @@ +Index: linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.c +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-ap9x-pci.c 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.c 2012-11-01 22:13:19.162809943 -0400 +@@ -20,9 +20,11 @@ + + static struct ath9k_platform_data ap9x_wmac0_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + static struct ath9k_platform_data ap9x_wmac1_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + static char ap9x_wmac0_mac[6]; + static char ap9x_wmac1_mac[6]; +@@ -38,6 +40,19 @@ + break; + } + } ++ ++__init void ap9x_pci_setup_no_eeprom_data(unsigned wmac, bool no_eeprom_data) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.no_eeprom_data = no_eeprom_data; ++ break; ++ case 1: ++ ap9x_wmac1_data.no_eeprom_data = no_eeprom_data; ++ break; ++ } ++} ++ + + __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { +Index: linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.h +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-ap9x-pci.h 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.h 2012-11-01 22:13:19.162809943 -0400 +@@ -19,6 +19,7 @@ + void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); + void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, + int num_leds); ++void ap9x_pci_setup_no_eeprom_data(unsigned wmac, bool no_eeprom_data); + struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); + + void ap91_pci_init(u8 *cal_data, u8 *mac_addr); +@@ -32,6 +34,7 @@ + static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, + struct gpio_led *leds, + int num_leds) {} ++static inline void ap9x_pci_setup_is_clk_25mhz(unsigned wmac, bool is_clk_25mhz) {} + static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { + return NULL; +Index: linux-3.3.8/include/linux/ath9k_platform.h +=================================================================== +--- linux-3.3.8.orig/include/linux/ath9k_platform.h 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/include/linux/ath9k_platform.h 2012-11-01 22:14:03.273992130 -0400 +@@ -33,6 +33,7 @@ + bool is_clk_25mhz; + bool disable_2ghz; + bool disable_5ghz; ++ bool no_eeprom_data; + + int (*get_mac_revision)(void); + int (*external_reset)(void); +Index: linux-3.3.8/arch/mips/ath79/dev-wmac.c +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-wmac.c 2012-11-01 22:04:55.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-wmac.c 2012-11-01 22:13:19.162809943 -0400 +@@ -27,6 +27,7 @@ + + static struct ath9k_platform_data ath79_wmac_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + + static struct resource ath79_wmac_resources[] = { diff --git a/target/linux/ar71xx/patches-3.6/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch b/target/linux/ar71xx/patches-3.6/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch new file mode 100644 index 0000000..9c85d05 --- /dev/null +++ b/target/linux/ar71xx/patches-3.6/670-MIPS-ath79-allow-mac-from-pdata-caldata-from-eeprom.patch @@ -0,0 +1,80 @@ +Index: linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.c +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-ap9x-pci.c 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.c 2012-11-01 22:13:19.162809943 -0400 +@@ -20,9 +20,11 @@ + + static struct ath9k_platform_data ap9x_wmac0_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + static struct ath9k_platform_data ap9x_wmac1_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + static char ap9x_wmac0_mac[6]; + static char ap9x_wmac1_mac[6]; +@@ -38,6 +40,19 @@ + break; + } + } ++ ++__init void ap9x_pci_setup_no_eeprom_data(unsigned wmac, bool no_eeprom_data) ++{ ++ switch (wmac) { ++ case 0: ++ ap9x_wmac0_data.no_eeprom_data = no_eeprom_data; ++ break; ++ case 1: ++ ap9x_wmac1_data.no_eeprom_data = no_eeprom_data; ++ break; ++ } ++} ++ + + __init struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { +Index: linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.h +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-ap9x-pci.h 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-ap9x-pci.h 2012-11-01 22:13:19.162809943 -0400 +@@ -19,6 +19,7 @@ + void ap9x_pci_setup_wmac_gpio(unsigned wmac, u32 mask, u32 val); + void ap9x_pci_setup_wmac_leds(unsigned wmac, struct gpio_led *leds, + int num_leds); ++void ap9x_pci_setup_no_eeprom_data(unsigned wmac, bool no_eeprom_data); + struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac); + + void ap91_pci_init(u8 *cal_data, u8 *mac_addr); +@@ -32,6 +34,7 @@ + static inline void ap9x_pci_setup_wmac_leds(unsigned wmac, + struct gpio_led *leds, + int num_leds) {} ++static inline void ap9x_pci_setup_is_clk_25mhz(unsigned wmac, bool is_clk_25mhz) {} + static inline struct ath9k_platform_data *ap9x_pci_get_wmac_data(unsigned wmac) + { + return NULL; +Index: linux-3.3.8/include/linux/ath9k_platform.h +=================================================================== +--- linux-3.3.8.orig/include/linux/ath9k_platform.h 2012-11-01 16:53:21.000000000 -0400 ++++ linux-3.3.8/include/linux/ath9k_platform.h 2012-11-01 22:14:03.273992130 -0400 +@@ -33,6 +33,7 @@ + bool is_clk_25mhz; + bool disable_2ghz; + bool disable_5ghz; ++ bool no_eeprom_data; + + int (*get_mac_revision)(void); + int (*external_reset)(void); +Index: linux-3.3.8/arch/mips/ath79/dev-wmac.c +=================================================================== +--- linux-3.3.8.orig/arch/mips/ath79/dev-wmac.c 2012-11-01 22:04:55.000000000 -0400 ++++ linux-3.3.8/arch/mips/ath79/dev-wmac.c 2012-11-01 22:13:19.162809943 -0400 +@@ -27,6 +27,7 @@ + + static struct ath9k_platform_data ath79_wmac_data = { + .led_pin = -1, ++ .no_eeprom_data = false, + }; + + static struct resource ath79_wmac_resources[] = { -- 1.7.9.5 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel