90055b911f0fff35eefc783b9fb4c1b2d99d2582
[openwrt/openwrt.git] /
1 From 15329d8b206d9c04ffad49aecd37f5d0bfb85768 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sun, 15 Oct 2023 14:23:19 +0200
4 Subject: [PATCH 2/5] wifi: rt2x00: Add option to pass EEPROM file name from DT
5
6 Add option to pass EEPROM file name from DT using ralink,eeprom binding.
7
8 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
9 ---
10 drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 11 +++++++++++
11 1 file changed, 11 insertions(+)
12
13 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
14 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
15 @@ -10,6 +10,7 @@
16
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 +#include <linux/of.h>
20
21 #include "rt2x00.h"
22 #include "rt2x00soc.h"
23 @@ -18,10 +19,20 @@ static const char *
24 rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
25 {
26 struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
27 +#ifdef CONFIG_OF
28 + struct device_node *np;
29 + const char *eep;
30 +#endif
31
32 if (pdata && pdata->eeprom_file_name)
33 return pdata->eeprom_file_name;
34
35 +#ifdef CONFIG_OF
36 + np = rt2x00dev->dev->of_node;
37 + if (np && !of_property_read_string(np, "ralink,eeprom", &eep))
38 + return eep;
39 +#endif
40 +
41 return NULL;
42 }
43