openwrt/package/kernel/mac80211/patches/rt2x00/602-02-wifi-rt2x00-Add-option-to-pass-EEPROM-file-name-from.patch

44 lines
1.2 KiB
Diff
Raw Normal View History

From 15329d8b206d9c04ffad49aecd37f5d0bfb85768 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Sun, 15 Oct 2023 14:23:19 +0200
Subject: [PATCH 2/5] wifi: rt2x00: Add option to pass EEPROM file name from DT
Add option to pass EEPROM file name from DT using ralink,eeprom binding.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include "rt2x00.h"
#include "rt2x00soc.h"
@@ -18,10 +19,20 @@ static const char *
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
{
struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
+#ifdef CONFIG_OF
+ struct device_node *np;
+ const char *eep;
+#endif
if (pdata && pdata->eeprom_file_name)
return pdata->eeprom_file_name;
+#ifdef CONFIG_OF
+ np = rt2x00dev->dev->of_node;
+ if (np && !of_property_read_string(np, "ralink,eeprom", &eep))
+ return eep;
+#endif
+
return NULL;
}