[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231018130942.31187-5-ansuelsmth@gmail.com>
Date: Wed, 18 Oct 2023 15:09:41 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Felix Fietkau <nbd@....name>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Ryder Lee <ryder.lee@...iatek.com>,
Shayne Chen <shayne.chen@...iatek.com>,
Sean Wang <sean.wang@...iatek.com>,
Kalle Valo <kvalo@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Christian Marangi <ansuelsmth@...il.com>,
Alexander Couzens <lynxis@...0.eu>,
Nicolas Cavallari <nicolas.cavallari@...en-communications.fr>,
Daniel Golle <daniel@...rotopia.org>,
linux-wireless@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Cc: Shiji Yang <yangshiji66@...look.com>
Subject: [PATCH v2 5/6] wifi: mt76: permit to use alternative cell name to eeprom NVMEM load
Generilize mt76_get_of_eeprom_from_nvmem to use alternative cell name by
passing the cell name as an arg and expose it.
Rename it to mt76_get_of_data_from_nvmem to better reflect the now more
generic usage.
This is to permit driver to load additional cell, like precal cell.
Tested-by: Shiji Yang <yangshiji66@...look.com>
Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
---
drivers/net/wireless/mediatek/mt76/eeprom.c | 8 +++++---
drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 748f4b643a5e..ac6c0a0e876f 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -107,7 +107,8 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l
}
EXPORT_SYMBOL_GPL(mt76_get_of_data_from_mtd);
-static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int len)
+int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
+ const char *cell_name, int len)
{
struct device_node *np = dev->dev->of_node;
struct nvmem_cell *cell;
@@ -115,7 +116,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le
size_t retlen;
int ret = 0;
- cell = of_nvmem_cell_get(np, "eeprom");
+ cell = of_nvmem_cell_get(np, cell_name);
if (IS_ERR(cell))
return PTR_ERR(cell);
@@ -137,6 +138,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le
return ret;
}
+EXPORT_SYMBOL_GPL(mt76_get_of_data_from_nvmem);
static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
{
@@ -154,7 +156,7 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
if (!ret)
return 0;
- return mt76_get_of_eeprom_from_nvmem(dev, eep, len);
+ return mt76_get_of_data_from_nvmem(dev, eep, "eeprom", len);
}
void
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 41e4f398083e..c9934258c49d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -1096,6 +1096,8 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
int mt76_eeprom_init(struct mt76_dev *dev, int len);
void mt76_eeprom_override(struct mt76_phy *phy);
int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
+int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
+ const char *cell_name, int len);
struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
--
2.40.1
Powered by blists - more mailing lists