summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2016-11-04 07:43:40 +0100
committerJohn Crispin <john@phrozen.org>2016-11-08 11:17:11 +0100
commit4f7a0601e665b863a5e4157de33b3d78b6393d3c (patch)
tree928db13b69bea872bcfa28f6d56b3128678e4340
parent7f235df5713765a64c1ea87c425fb1b0841a20df (diff)
downloadmtk-20170518-4f7a0601e665b863a5e4157de33b3d78b6393d3c.zip
mtk-20170518-4f7a0601e665b863a5e4157de33b3d78b6393d3c.tar.gz
mtk-20170518-4f7a0601e665b863a5e4157de33b3d78b6393d3c.tar.bz2
mac80211: rt2x00: add mtd-eeprom swab function
Most of the lantiq devices with ralink wifi have the EEPROM stored in big endian byte order in flash, but the driver expects the EEPROM to be in little endian. Signed-off-by: Mathias Kresin <dev@kresin.me>
-rw-r--r--package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch14
1 files changed, 9 insertions, 5 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
index 6c264ef..a98b49c 100644
--- 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
@@ -7,8 +7,8 @@ Subject: [PATCH] rt2x00: load eeprom on SoC from a mtd device defines inside
Signed-off-by: John Crispin <blogic@openwrt.org>
---
drivers/net/wireless/ralink/rt2x00/Kconfig | 1 +
- drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 61 +++++++++++++++++++++++
- 2 files changed, 62 insertions(+)
+ drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 65 +++++++++++++++++++++++
+ 2 files changed, 66 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -22,7 +22,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
-@@ -26,11 +26,69 @@
+@@ -26,11 +26,73 @@
#include <linux/kernel.h>
#include <linux/module.h>
@@ -40,7 +40,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ 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;
++ int i, size, offset = 0;
+ struct mtd_info *mtd;
+ const char *part;
+ const __be32 *list;
@@ -79,6 +79,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ return ret;
+ }
+
++ if (of_find_property(np, "ralink,mtd-eeprom-swap", NULL))
++ for (i = 0; i < len/sizeof(u16); i++)
++ rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]);
++
+ rt2x00dev->eeprom_file = &mtd_fw;
+ mtd_fw.size = len;
+ mtd_fw.data = (const u8 *) rt2x00dev->eeprom;
@@ -92,7 +96,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
-@@ -58,6 +116,9 @@ static int rt2x00lib_request_eeprom_file
+@@ -58,6 +120,9 @@ static int rt2x00lib_request_eeprom_file
const char *ee_name;
int retval;