mac80211: rt2x00: fix eeprom load issue for PCIe NICs

The support for assigning PCIe eeprom via device tree was
accidentally removed when adding NVMEM eeprom patches.

Fixes: bea4f5020790 ("mac80211: rt2x00: improve EEPROM load patches")
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/16318
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Shiji Yang 2024-08-17 12:04:43 +08:00 committed by Hauke Mehrtens
parent 656c9847d5
commit 9a157292e2
2 changed files with 20 additions and 8 deletions

View File

@ -198,11 +198,23 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
retval = rt2x00soc_alloc_reg(rt2x00dev);
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
@@ -26,4 +26,13 @@ int rt2x00soc_resume(struct platform_dev
#define rt2x00soc_resume NULL
#endif /* CONFIG_PM */
--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
@@ -278,6 +278,9 @@ static int rt2800pci_read_eeprom(struct
{
int retval;
+ if (!rt2x00lib_read_eeprom(rt2x00dev))
+ return 0;
+
if (rt2800pci_efuse_detect(rt2x00dev))
retval = rt2800pci_read_eeprom_efuse(rt2x00dev);
else
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
@@ -270,4 +270,13 @@ void rt2800_get_txwi_rxwi_size(struct rt
unsigned short *rxwi_size);
void rt2800_pre_reset_hw(struct rt2x00_dev *rt2x00dev);
+/*
+ * EEPROM file handlers.
@ -213,4 +225,4 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+#define rt2x00lib_read_eeprom NULL
+#endif /* CPTCFG_RT2X00_LIB_EEPROM */
+
#endif /* RT2X00SOC_H */
#endif /* RT2800LIB_H */

View File

@ -40,7 +40,7 @@
const u8 arg0, const u8 arg1);
--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c
@@ -286,6 +286,10 @@ static int rt2800pci_read_eeprom(struct
@@ -289,6 +289,10 @@ static int rt2800pci_read_eeprom(struct
return retval;
}
@ -51,7 +51,7 @@
static const struct ieee80211_ops rt2800pci_mac80211_ops = {
.add_chanctx = ieee80211_emulate_add_chanctx,
.remove_chanctx = ieee80211_emulate_remove_chanctx,
@@ -333,6 +337,9 @@ static const struct rt2800_ops rt2800pci
@@ -336,6 +340,9 @@ static const struct rt2800_ops rt2800pci
.drv_init_registers = rt2800mmio_init_registers,
.drv_get_txwi = rt2800mmio_get_txwi,
.drv_get_dma_done = rt2800mmio_get_dma_done,