diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-11-12 22:11:33 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-11-12 22:11:33 +0000 |
commit | d32df2f65a01ea6237d736c3c3c017830f58e781 (patch) | |
tree | a4a1eaea15e95e099378ba823a4b32c754342bde /package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch | |
parent | 23e82fd7ba81f610d46f0ca4ed301b151ca18f4e (diff) | |
download | upstream-d32df2f65a01ea6237d736c3c3c017830f58e781.tar.gz upstream-d32df2f65a01ea6237d736c3c3c017830f58e781.tar.bz2 upstream-d32df2f65a01ea6237d736c3c3c017830f58e781.zip |
mac80211: update to wireless-testing 2013-11-05
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@38783 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch')
-rw-r--r-- | package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch new file mode 100644 index 0000000000..7d999f9c6c --- /dev/null +++ b/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch @@ -0,0 +1,112 @@ +From 339fe73f340161a624cc08e738d2244814852c3e Mon Sep 17 00:00:00 2001 +From: John Crispin <blogic@openwrt.org> +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 <blogic@openwrt.org> +--- + drivers/net/wireless/rt2x00/Kconfig | 1 + + drivers/net/wireless/rt2x00/rt2800pci.c | 44 ++++++++++++++++++++++++++----- + 2 files changed, 39 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/rt2x00/Kconfig ++++ b/drivers/net/wireless/rt2x00/Kconfig +@@ -219,6 +219,7 @@ config RT2800SOC + select RT2X00_LIB_EEPROM + select RT2800_LIB + select RT2800_LIB_MMIO ++ select MTD if SOC_RT288X || SOC_RT305X + ---help--- + This adds support for Ralink WiSoC devices. + Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352. +--- a/drivers/net/wireless/rt2x00/rt2x00eeprom.c ++++ b/drivers/net/wireless/rt2x00/rt2x00eeprom.c +@@ -26,17 +26,72 @@ + + #include <linux/kernel.h> + #include <linux/module.h> ++#include <linux/mtd/mtd.h> ++#include <linux/mtd/partitions.h> + #include <linux/of.h> + + #include "rt2x00.h" + #include "rt2x00lib.h" + ++static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev) ++{ ++ int ret = -EINVAL; ++#ifdef CONFIG_OF ++ static struct firmware mtd_fw; ++ struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL; ++ size_t retlen, len = rt2x00dev->ops->eeprom_size; ++ int 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; ++ } ++#endif ++ ++ return ret; ++} ++ + static const char * + rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev) + { + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data; + struct device_node *np; +- char *eep; ++ const char *eep; + + if (pdata && pdata->eeprom_file_name) + return pdata->eeprom_file_name; +@@ -53,9 +108,12 @@ rt2x00lib_get_eeprom_file_name(struct rt + static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev) + { + const struct firmware *ee; +- char *ee_name; ++ const char *ee_name; + int retval; + ++ if (!rt2800lib_read_eeprom_mtd(rt2x00dev)) ++ return 0; ++ + ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev); + if (!ee_name) { + rt2x00_err(rt2x00dev, |