@ -22,17 +22,20 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352.
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
@@ -26,11 +26,7 2 @@
@@ -26,11 +26,7 6 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
+#if IS_ENABLED(CONFIG_MTD)
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/partitions.h>
+#endif
#include <linux/of.h>
#include <linux/of.h>
#include "rt2x00.h"
#include "rt2x00.h"
#include "rt2x00lib.h"
#include "rt2x00lib.h"
+#if IS_ENABLED(CONFIG_MTD)
+static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
+static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
+{
+{
+ int ret = -EINVAL;
+ int ret = -EINVAL;
@ -91,16 +94,19 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+
+ return ret;
+ return ret;
+}
+}
+#endif
+
+
static const char *
static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
{
@@ -58,6 +1 19,9 @@ static int rt2x00lib_request_eeprom_file
@@ -58,6 +1 23,1 1 @@ static int rt2x00lib_request_eeprom_file
const char *ee_name;
const char *ee_name;
int retval;
int retval;
+#if IS_ENABLED(CONFIG_MTD)
+ if (!rt2800lib_read_eeprom_mtd(rt2x00dev))
+ if (!rt2800lib_read_eeprom_mtd(rt2x00dev))
+ return 0;
+ return 0;
+#endif
+
+
ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev);
ee_name = rt2x00lib_get_eeprom_file_name(rt2x00dev);
if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) {
if (!ee_name && test_bit(REQUIRE_EEPROM_FILE, &rt2x00dev->cap_flags)) {