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
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>
+ 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)
+ 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;
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;