Skip to content
Snippets Groups Projects
Commit 54c61d09 authored by Christian Marangi's avatar Christian Marangi Committed by Oleksii Kutuzov
Browse files

wifi: mt76: fix broken precal loading from MTD for mt7915



Commit ("mt76: mt7915: add support for applying
pre-calibration data") was fundamentally broken and never worked.

The idea (before NVMEM support) was to expand the MTD function and pass
an additional offset. For normal EEPROM load the offset would always be
0. For the purpose of precal loading, an offset was passed that was
internally the size of EEPROM, since precal data is right after the
EEPROM.

Problem is that the offset value passed is never handled and is actually
overwrite by

	offset = be32_to_cpup(list);
	ret = mtd_read(mtd, offset, len, &retlen, eep);

resulting in the passed offset value always ingnored. (and even passing
garbage data as precal as the start of the EEPROM is getting read)

Fix this by adding to the current offset value, the offset from DT to
correctly read the piece of data at the requested location.

Cc: stable@vger.kernel.org
Fixes: ("mt76: mt7915: add support for applying pre-calibration data")
Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 278e34fd
No related branches found
No related tags found
1 merge request!11[UPSTREAM] Add WIFI-related patches from Mediatek's Release 24.0
...@@ -62,7 +62,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) ...@@ -62,7 +62,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len)
goto out_put_node; goto out_put_node;
} }
offset = be32_to_cpup(list); offset += be32_to_cpup(list);
ret = mtd_read(mtd, offset, len, &retlen, eep); ret = mtd_read(mtd, offset, len, &retlen, eep);
put_mtd_device(mtd); put_mtd_device(mtd);
if (mtd_is_bitflip(ret)) if (mtd_is_bitflip(ret))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment