Commit fdddaa52 authored by Christian Marangi's avatar Christian Marangi Committed by Felix Fietkau
Browse files

wifi: mt76: permit to load precal from NVMEM cell for mt7915



Permit to load precal from NVMEM cell for mt7915. The NVMEM cell must be
named "precal" to be correctly loaded.

NVMEM cell must already account the correct offset and be placed after
the EEPROM as the function expect the data right from the start.

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 a1f57685
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)
	u8 *eeprom = mdev->eeprom.data;
	u32 val = eeprom[MT_EE_DO_PRE_CAL];
	u32 offs;
	int ret;

	if (!dev->flash_mode)
		return 0;
@@ -25,7 +26,11 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)

	offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2;

	return mt76_get_of_data_from_mtd(mdev, dev->cal, offs, val);
	ret = mt76_get_of_data_from_mtd(mdev, dev->cal, offs, val);
	if (!ret)
		return ret;

	return mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", val);
}

static int mt7915_check_eeprom(struct mt7915_dev *dev)