Commit a1f57685 authored by Christian Marangi's avatar Christian Marangi Committed by Felix Fietkau

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: default avatarShiji Yang <yangshiji66@outlook.com>
Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 3d96764e
...@@ -107,7 +107,8 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l ...@@ -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); 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 device_node *np = dev->dev->of_node;
struct nvmem_cell *cell; struct nvmem_cell *cell;
...@@ -115,7 +116,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le ...@@ -115,7 +116,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le
size_t retlen; size_t retlen;
int ret = 0; int ret = 0;
cell = of_nvmem_cell_get(np, "eeprom"); cell = of_nvmem_cell_get(np, cell_name);
if (IS_ERR(cell)) if (IS_ERR(cell))
return PTR_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 ...@@ -137,6 +138,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le
return ret; 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) 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) ...@@ -154,7 +156,7 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
if (!ret) if (!ret)
return 0; return 0;
return mt76_get_of_eeprom_from_nvmem(dev, eep, len); return mt76_get_of_data_from_nvmem(dev, eep, "eeprom", len);
} }
void void
......
...@@ -1103,6 +1103,8 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, ...@@ -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); int mt76_eeprom_init(struct mt76_dev *dev, int len);
void mt76_eeprom_override(struct mt76_phy *phy); 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_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 * struct mt76_queue *
mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment