mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2024-11-25 14:36:14 +00:00
6bcd1c2501
Some local patches have been sent to upstream and they are slightly different from the upstream version. So it's better to replace them to avoid conflicts with the new mac80211 backport driver. The different parts have been merged into patch 996. This commit also includes some additional fixes: * Fix watchdog function. * Improve MT7620 register initialization. * Introduce DMA busy watchdog for rt2800. P.S. Sometimes rt2800 series chips may fall into a DMA busy state. The tx queues become very slow and the client cannot connect to the AP. Usually, We can see a lot of hostapd warnings at this point: 'hostapd: IEEE 802.11: did not acknowledge authentication response' The DMA busy watchdog can help the driver automatically recover from this abnormal state. By the way, setting higer 'cell_density' and disabling 'disassoc_low_ack' can significantly reduce the probability of the DMA busy. Signed-off-by: Shiji Yang <yangshiji66@qq.com>
98 lines
2.4 KiB
Diff
98 lines
2.4 KiB
Diff
From 9008cdacdc41f8233f4444b86cf3a17201686e2d Mon Sep 17 00:00:00 2001
|
|
From: Shiji Yang <yangshiji66@outlook.com>
|
|
Date: Tue, 18 Jul 2023 20:18:16 +0800
|
|
Subject: [PATCH 5/5] wifi: rt2x00: support loading eeprom from NVMEM cells
|
|
|
|
This patch allows rt2x00 to load eeprom from "eeprom" NVMEM cell.
|
|
|
|
Example:
|
|
|
|
/* load eeprom from NVMEM provider 'eep' */
|
|
&wmac {
|
|
nvmem-cells = <&eep>;
|
|
nvmem-cell-names = "eeprom";
|
|
};
|
|
|
|
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
---
|
|
.../net/wireless/ralink/rt2x00/rt2x00eeprom.c | 41 ++++++++++++++++++-
|
|
1 file changed, 40 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
|
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
|
|
@@ -14,12 +14,12 @@
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/partitions.h>
|
|
#endif
|
|
+#include <linux/nvmem-consumer.h>
|
|
#include <linux/of.h>
|
|
|
|
#include "rt2x00.h"
|
|
#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;
|
|
@@ -33,6 +33,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)
|
|
{
|
|
int ret = -EINVAL;
|
|
@@ -88,6 +89,40 @@ static int rt2800lib_read_eeprom_mtd(str
|
|
}
|
|
#endif
|
|
|
|
+static int rt2800lib_read_eeprom_nvmem(struct rt2x00_dev *rt2x00dev)
|
|
+{
|
|
+ struct device_node *np = rt2x00dev->dev->of_node;
|
|
+ unsigned int len = rt2x00dev->ops->eeprom_size;
|
|
+ struct nvmem_cell *cell;
|
|
+ const void *data;
|
|
+ size_t retlen;
|
|
+ int ret = 0;
|
|
+
|
|
+ cell = of_nvmem_cell_get(np, "eeprom");
|
|
+ if (IS_ERR(cell))
|
|
+ return PTR_ERR(cell);
|
|
+
|
|
+ data = nvmem_cell_read(cell, &retlen);
|
|
+ nvmem_cell_put(cell);
|
|
+
|
|
+ if (IS_ERR(data))
|
|
+ return PTR_ERR(data);
|
|
+
|
|
+ if (retlen != len) {
|
|
+ dev_err(rt2x00dev->dev, "invalid eeprom size, required: 0x%04x\n", len);
|
|
+ ret = -EINVAL;
|
|
+ goto exit;
|
|
+ }
|
|
+
|
|
+ memcpy(rt2x00dev->eeprom, data, len);
|
|
+
|
|
+ rt2800lib_eeprom_swap(rt2x00dev);
|
|
+
|
|
+exit:
|
|
+ kfree(data);
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static const char *
|
|
rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
|
|
{
|
|
@@ -164,6 +199,10 @@ int rt2x00lib_read_eeprom(struct rt2x00_
|
|
return 0;
|
|
#endif
|
|
|
|
+ ret = rt2800lib_read_eeprom_nvmem(rt2x00dev);
|
|
+ if (!ret)
|
|
+ return 0;
|
|
+
|
|
return rt2x00lib_read_eeprom_file(rt2x00dev);
|
|
}
|
|
EXPORT_SYMBOL_GPL(rt2x00lib_read_eeprom);
|