From 930868fd235e8a74e542e7864df1242bc438852f Mon Sep 17 00:00:00 2001 From: blogic Date: Thu, 4 Apr 2013 14:57:43 +0000 Subject: [mac80211] add a helper that allows loading the eeprom from a MTD partition pointed to by a phandle Signed-off-by: John Crispin git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36194 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...-eeprom-on-SoC-from-a-mtd-device-defines-.patch | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch (limited to 'package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch') diff --git a/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch new file mode 100644 index 000000000..7cb9ca0d6 --- /dev/null +++ b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -0,0 +1,106 @@ +From 339fe73f340161a624cc08e738d2244814852c3e Mon Sep 17 00:00:00 2001 +From: John Crispin +Date: Sun, 17 Mar 2013 00:55:04 +0100 +Subject: [PATCH] rt2x00: load eeprom on SoC from a mtd device defines inside + OF + +Signed-off-by: John Crispin +--- + drivers/net/wireless/rt2x00/Kconfig | 1 + + drivers/net/wireless/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++----- + 2 files changed, 39 insertions(+), 6 deletions(-) + +Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/Kconfig +=================================================================== +--- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/Kconfig 2013-04-04 14:20:02.621776831 +0200 ++++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/Kconfig 2013-04-04 14:20:02.977776837 +0200 +@@ -64,6 +64,7 @@ + select RT2X00_LIB_CRYPTO + select CRC_CCITT + select EEPROM_93CX6 ++ select MTD if SOC_RT288X || SOC_RT305X + ---help--- + This adds support for rt27xx/rt28xx/rt30xx wireless chipset family. + Supported chips: RT2760, RT2790, RT2860, RT2880, RT2890, RT3052, +Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2x00eeprom.c +=================================================================== +--- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2x00eeprom.c 2013-04-04 14:20:02.621776831 +0200 ++++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2x00eeprom.c 2013-04-04 15:23:19.601807539 +0200 +@@ -30,12 +30,77 @@ + #include "rt2x00.h" + #include "rt2x00lib.h" + ++#ifdef CONFIG_OF ++#include ++#include ++#include ++ ++static struct firmware mtd_fw; ++ ++static int rt2800pci_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) ++{ ++ struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL; ++ size_t retlen, len = rt2x00dev->ops->eeprom_size; ++ int ret, size, offset = 0; ++ struct mtd_info *mtd; ++ const char *part; ++ const __be32 *list; ++ phandle phandle; ++ ++ list = of_get_property(np, "ralink,mtd-eeprom", &size); ++ if (!list) { ++ dev_err(rt2x00dev->dev, "failed to load eeprom property\n"); ++ return -ENOENT; ++ } ++ ++ phandle = be32_to_cpup(list++); ++ if (phandle) ++ mtd_np = of_find_node_by_phandle(phandle); ++ if (!mtd_np) { ++ dev_err(rt2x00dev->dev, "failed to load mtd phandle\n"); ++ return -EINVAL; ++ } ++ ++ part = of_get_property(mtd_np, "label", NULL); ++ if (!part) ++ part = mtd_np->name; ++ ++ mtd = get_mtd_device_nm(part); ++ if (IS_ERR(mtd)) { ++ dev_err(rt2x00dev->dev, "failed to get mtd device \"%s\"\n", part); ++ return PTR_ERR(mtd); ++ } ++ ++ if (size > sizeof(*list)) ++ offset = be32_to_cpup(list); ++ ++ ret = mtd_read(mtd, offset, len, &retlen, (u_char *) rt2x00dev->eeprom); ++ put_mtd_device(mtd); ++ ++ if (!ret) { ++ rt2x00dev->eeprom_file = &mtd_fw; ++ mtd_fw.size = len; ++ mtd_fw.data = rt2x00dev->eeprom; ++ } ++ ++ return ret; ++} ++#else ++static inline int rt2800pci_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) ++{ ++ return -EINVAL; ++} ++#endif ++ + static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev) + { + const struct firmware *ee; + char *ee_name; + int retval; + ++ if (!rt2800pci_read_eeprom_mtd(rt2x00dev)) ++ return 0; ++ + ee_name = rt2x00dev->ops->lib->get_eeprom_file_name(rt2x00dev); + if (!ee_name) { + ERROR(rt2x00dev, -- cgit v1.2.3 From a18afedff77ee5626910b8310cbb08b840977868 Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 7 Apr 2013 22:05:36 +0000 Subject: mac80211: merge an idle handling fix (fixes ath9k_htc client mode), refresh patches Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36265 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch') diff --git a/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch index 7cb9ca0d6..c7d40ef7c 100644 --- a/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch +++ b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -10,11 +10,9 @@ Signed-off-by: John Crispin drivers/net/wireless/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 6 deletions(-) -Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/Kconfig -=================================================================== ---- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/Kconfig 2013-04-04 14:20:02.621776831 +0200 -+++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/Kconfig 2013-04-04 14:20:02.977776837 +0200 -@@ -64,6 +64,7 @@ +--- a/drivers/net/wireless/rt2x00/Kconfig ++++ b/drivers/net/wireless/rt2x00/Kconfig +@@ -64,6 +64,7 @@ config RT2800PCI select RT2X00_LIB_CRYPTO select CRC_CCITT select EEPROM_93CX6 @@ -22,10 +20,8 @@ Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/Kconfig ---help--- This adds support for rt27xx/rt28xx/rt30xx wireless chipset family. Supported chips: RT2760, RT2790, RT2860, RT2880, RT2890, RT3052, -Index: compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2x00eeprom.c -=================================================================== ---- compat-wireless-2013-02-22.orig/drivers/net/wireless/rt2x00/rt2x00eeprom.c 2013-04-04 14:20:02.621776831 +0200 -+++ compat-wireless-2013-02-22/drivers/net/wireless/rt2x00/rt2x00eeprom.c 2013-04-04 15:23:19.601807539 +0200 +--- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c @@ -30,12 +30,77 @@ #include "rt2x00.h" #include "rt2x00lib.h" -- cgit v1.2.3 From 28240cc8d2d2d5d345a9459497dfc3c72379b994 Mon Sep 17 00:00:00 2001 From: nbd Date: Fri, 26 Apr 2013 10:52:03 +0000 Subject: mac80211: update to wireless-testing 2013-04-16 + backports Signed-off-by: Felix Fietkau git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36448 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch') diff --git a/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch index c7d40ef7c..dbfd80fab 100644 --- a/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch +++ b/package/mac80211/patches/617-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -12,7 +12,7 @@ Signed-off-by: John Crispin --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig -@@ -64,6 +64,7 @@ config RT2800PCI +@@ -68,6 +68,7 @@ config RT2800PCI select RT2X00_LIB_CRYPTO select CRC_CCITT select EEPROM_93CX6 -- cgit v1.2.3