forked from mirror/openwrt
mac80211: rt2x00: remove swap binding
No longer used. If swapping is desired, ralink,mtd-eeprom can be used. Otherwise nvmem. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/22207 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
926991329b
commit
8e711f68c4
3 changed files with 7 additions and 65 deletions
|
|
@ -1,44 +0,0 @@
|
|||
From 9c9a3c27b96e057f3c3f47151d7a170d84e3bb5f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||
Date: Sun, 15 Oct 2023 15:31:47 +0200
|
||||
Subject: [PATCH 4/5] wifi: rt2x00: Support EEPROM swap binding
|
||||
|
||||
Add binding "ralink,eeprom-swap" to swap bytes of EEPROM before using
|
||||
it.
|
||||
|
||||
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||
---
|
||||
drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
@@ -19,6 +19,19 @@
|
||||
#include "rt2x00.h"
|
||||
|
||||
#if IS_ENABLED(CONFIG_MTD)
|
||||
+static void rt2800lib_eeprom_swap(struct rt2x00_dev *rt2x00dev)
|
||||
+{
|
||||
+ struct device_node *np = rt2x00dev->dev->of_node;
|
||||
+ size_t len = rt2x00dev->ops->eeprom_size;
|
||||
+ int i;
|
||||
+
|
||||
+ if (!of_property_present(np, "ralink,eeprom-swap"))
|
||||
+ return;
|
||||
+
|
||||
+ for (i = 0; i < len / sizeof(u16); i++)
|
||||
+ rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]);
|
||||
+}
|
||||
+
|
||||
static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL;
|
||||
@@ -64,6 +77,8 @@ static int rt2800lib_read_eeprom_mtd(str
|
||||
return ret;
|
||||
}
|
||||
|
||||
+ rt2800lib_eeprom_swap(rt2x00dev);
|
||||
+
|
||||
dev_info(rt2x00dev->dev, "loaded eeprom from mtd device \"%s\"\n", part);
|
||||
|
||||
return ret;
|
||||
|
|
@ -21,7 +21,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||
|
||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
@@ -15,10 +15,10 @@
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/mtd/mtd.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#endif
|
||||
|
|
@ -29,19 +29,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||
|
||||
#include "rt2x00.h"
|
||||
|
||||
-#if IS_ENABLED(CONFIG_MTD)
|
||||
static void rt2800lib_eeprom_swap(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
struct device_node *np = rt2x00dev->dev->of_node;
|
||||
@@ -32,6 +32,7 @@ static void rt2800lib_eeprom_swap(struct
|
||||
rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]);
|
||||
}
|
||||
|
||||
+#if IS_ENABLED(CONFIG_MTD)
|
||||
static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
struct device_node *np = rt2x00dev->dev->of_node, *mtd_np = NULL;
|
||||
@@ -85,6 +86,40 @@ static int rt2800lib_read_eeprom_mtd(str
|
||||
@@ -70,6 +71,38 @@ static int rt2800lib_read_eeprom_mtd(str
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -72,8 +60,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||
+
|
||||
+ memcpy(rt2x00dev->eeprom, data, len);
|
||||
+
|
||||
+ rt2800lib_eeprom_swap(rt2x00dev);
|
||||
+
|
||||
+exit:
|
||||
+ kfree(data);
|
||||
+ return ret;
|
||||
|
|
@ -82,7 +68,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|||
static const char *
|
||||
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
@@ -152,6 +187,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_
|
||||
@@ -137,6 +170,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ Signed-off-by: Coia Prant <coiaprant@gmail.com>
|
|||
|
||||
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
||||
@@ -32,6 +32,27 @@ static void rt2800lib_eeprom_swap(struct
|
||||
rt2x00dev->eeprom[i] = swab16(rt2x00dev->eeprom[i]);
|
||||
}
|
||||
@@ -19,6 +19,27 @@
|
||||
|
||||
#include "rt2x00.h"
|
||||
|
||||
+static int rt2800lib_read_eeprom_data(struct rt2x00_dev *rt2x00dev)
|
||||
+{
|
||||
|
|
@ -63,7 +63,7 @@ Signed-off-by: Coia Prant <coiaprant@gmail.com>
|
|||
#if IS_ENABLED(CONFIG_MTD)
|
||||
static int rt2800lib_read_eeprom_mtd(struct rt2x00_dev *rt2x00dev)
|
||||
{
|
||||
@@ -181,6 +202,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_
|
||||
@@ -164,6 +185,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue