summaryrefslogtreecommitdiff
path: root/package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
diff options
context:
space:
mode:
authorMathias Kresin <dev@kresin.me>2016-11-04 07:43:39 +0100
committerJohn Crispin <john@phrozen.org>2016-11-08 11:17:10 +0100
commit7f235df5713765a64c1ea87c425fb1b0841a20df (patch)
tree2070e48e29947126152aa53e114eb565e0655c0d /package/kernel/mac80211/patches/605-rt2x00-load-eeprom-on-SoC-from-a-mtd-device-defines-.patch
parent2516c0572efe2d362f48a54af64400876a799b26 (diff)
downloadmtk-20170518-7f235df5713765a64c1ea87c425fb1b0841a20df.zip
mtk-20170518-7f235df5713765a64c1ea87c425fb1b0841a20df.tar.gz
mtk-20170518-7f235df5713765a64c1ea87c425fb1b0841a20df.tar.bz2
mac80211: rt2x00: remove eeprom filename dependency from mtd-eeprom
The ralink,mtd-eeprom device tree property doesn't require the ralink,eeprom property to work. Rework the error handling and user notification as well. Do not log an error if the mtd-eeprom parameter isn't used. It could be intentional and should not scare the user. Check if the number of bytes read from the mtd devices matches the requested number of bytes. In case of an mtd read error, give a hint to the user which partition was tried to read from. In case everything is fine, notify the user as well. Signed-off-by: Mathias Kresin <dev@kresin.me>
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-.patch27
1 files changed, 15 insertions, 12 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 5097304..6c264ef 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
@@ -6,9 +6,9 @@ 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/rt2800pci.c | 44 ++++++++++++++++++++++++++-----
- 2 files changed, 39 insertions(+), 6 deletions(-)
+ drivers/net/wireless/ralink/rt2x00/Kconfig | 1 +
+ drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 61 +++++++++++++++++++++++
+ 2 files changed, 62 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,66 @@
+@@ -26,11 +26,69 @@
#include <linux/kernel.h>
#include <linux/module.h>
@@ -47,10 +47,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ phandle phandle;
+
+ list = of_get_property(np, "ralink,mtd-eeprom", &size);
-+ if (!list) {
-+ dev_err(rt2x00dev->dev, "failed to load eeprom property\n");
++ if (!list)
+ return -ENOENT;
-+ }
+
+ phandle = be32_to_cpup(list++);
+ if (phandle)
@@ -76,11 +74,16 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ 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 = (const u8 *) rt2x00dev->eeprom;
++ if ((retlen != rt2x00dev->ops->eeprom_size) || ret) {
++ dev_err(rt2x00dev->dev, "failed to load eeprom from device \"%s\"\n", part);
++ return ret;
+ }
++
++ rt2x00dev->eeprom_file = &mtd_fw;
++ mtd_fw.size = len;
++ mtd_fw.data = (const u8 *) rt2x00dev->eeprom;
++
++ dev_info(rt2x00dev->dev, "loaded eeprom from mtd device \"%s\"\n", part);
+#endif
+
+ return ret;
@@ -89,7 +92,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
-@@ -58,6 +113,9 @@ static int rt2x00lib_request_eeprom_file
+@@ -58,6 +116,9 @@ static int rt2x00lib_request_eeprom_file
const char *ee_name;
int retval;