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@outlook.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Christian Marangi 2023-10-18 15:09:41 +02:00 committed by Felix Fietkau
parent 3d96764e6a
commit a1f57685fe
2 changed files with 7 additions and 3 deletions

View File

@ -107,7 +107,8 @@ out_put_node:
}
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 @@ exit:
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

View File

@ -1103,6 +1103,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,