mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 01:59:02 +00:00
45 lines
1.3 KiB
Diff
45 lines
1.3 KiB
Diff
|
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
|
||
|
@@ -20,6 +20,19 @@
|
||
|
#include "rt2x00soc.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_find_property(np, "ralink,eeprom-swap", NULL))
|
||
|
+ 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)
|
||
|
{
|
||
|
int ret = -EINVAL;
|
||
|
@@ -66,6 +79,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);
|
||
|
#endif
|
||
|
|