Skip to contentSkip to conversation

add support for big endian eeprom partition to mt76 driver

PATCH In review Lorenzo Bianconi 2 participants 4 messages Nov 27, 2019 – Dec 5, 2019

Subsystems (4)
lore
Share & tools
lore

Lorenzo Bianconi

author maintainer
#0 lore raw

v2 cover add support for big endian eeprom partition to mt76 driver

Introduce the possibility to specify eeprom radio partition endianness since mt76x0e users reported some devices (e.g TP-Link Archer VR200v) have been flashed with big endian calibration data.

Changes since v1:
- Add bing-endian property documentation

Lorenzo Bianconi (2):
mt76: eeprom: add support for big endian eeprom partition
dt-bindings: net: wireless: mt76: introduce big-endian property

 .../devicetree/bindings/net/wireless/mediatek,mt76.txt |  3 +++
 drivers/net/wireless/mediatek/mt76/eeprom.c            | 10 ++++++++++
 2 files changed, 13 insertions(+)
Signature · 1 line
2.21.0
author maintainer
#1 lore raw

PATCH v2 1/2 mt76: eeprom: add support for big endian eeprom partition

mt76x0e users reported some devices (e.g TP-Link Archer VR200v) have been flashed with big endian radio partition. Add the possibility to specify eeprom endianness using big-endian dts property and in case covert eeprom data in little endian

---
 drivers/net/wireless/mediatek/mt76/eeprom.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/wireless/mediatek/mt76/eeprom.c +10 -0
index 804224e81103..33d992d5662a 100644
@@ -64,6 +64,16 @@ mt76_get_of_eeprom(struct mt76_dev *dev, int len)
 		goto out_put_node;
 	}
 
+	if (of_property_read_bool(dev->dev->of_node, "big-endian")) {
+		u8 *data = (u8 *)dev->eeprom.data;
+		int i;
+
+		/* convert eeprom data in Little Endian */
+		for (i = 0; i < round_down(len, 2); i += 2)
+			put_unaligned_le16(get_unaligned_be16(&data[i]),
+					   &data[i]);
+	}
+
 out_put_node:
 	of_node_put(np);
 	return ret;
Signature · 1 line
2.21.0
author maintainer
#2 lore raw

PATCH v2 2/2 dt-bindings: net: wireless: mt76: introduce big-endian property

In reply to Lorenzo Bianconi

Introduce big-endian property to specify mtd radio partition endianness

---
 .../devicetree/bindings/net/wireless/mediatek,mt76.txt         | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt +3 -0
index 7e675dafc256..d4d982f7ab37 100644
@@ -15,6 +15,8 @@ Optional properties:
 
 - ieee80211-freq-limit: See ieee80211.txt
 - mediatek,mtd-eeprom: Specify a MTD partition + offset containing EEPROM data
+- big-endian: if the radio eeprom partition is written in big-endian, specify
+  this property
 
 The MAC address can as well be set with corresponding optional properties
 defined in net/ethernet.txt.
@@ -31,6 +33,7 @@ Optional nodes:
 			reg = <0x0000 0 0 0 0>;
 			ieee80211-freq-limit = <5000000 6000000>;
 			mediatek,mtd-eeprom = <&factory 0x8000>;
+			big-endian;
 
 			led {
 				led-sources = <2>;
Signature · 1 line
2.21.0
maintainer Acked-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property

Quoted 7 lines · Lorenzo Bianconi

Introduce big-endian property to specify mtd radio partition endianness

---
 .../devicetree/bindings/net/wireless/mediatek,mt76.txt         | 3 +++
 1 file changed, 3 insertions(+)