devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] add support for big endian eeprom partition to mt76 driver
@ 2019-11-27 14:46 Lorenzo Bianconi
  2019-11-27 14:46 ` [PATCH v2 1/2] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
  2019-11-27 14:46 ` [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property Lorenzo Bianconi
  0 siblings, 2 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2019-11-27 14:46 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, devicetree, lorenzo.bianconi

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(+)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] mt76: eeprom: add support for big endian eeprom partition
  2019-11-27 14:46 [PATCH v2 0/2] add support for big endian eeprom partition to mt76 driver Lorenzo Bianconi
@ 2019-11-27 14:46 ` Lorenzo Bianconi
  2019-11-27 14:46 ` [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property Lorenzo Bianconi
  1 sibling, 0 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2019-11-27 14:46 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, devicetree, lorenzo.bianconi

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

Tested-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/eeprom.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 804224e81103..33d992d5662a 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -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;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property
  2019-11-27 14:46 [PATCH v2 0/2] add support for big endian eeprom partition to mt76 driver Lorenzo Bianconi
  2019-11-27 14:46 ` [PATCH v2 1/2] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
@ 2019-11-27 14:46 ` Lorenzo Bianconi
  2019-12-05 21:48   ` Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2019-11-27 14:46 UTC (permalink / raw)
  To: nbd; +Cc: linux-wireless, devicetree, lorenzo.bianconi

Introduce big-endian property to specify mtd radio partition endianness

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../devicetree/bindings/net/wireless/mediatek,mt76.txt         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
index 7e675dafc256..d4d982f7ab37 100644
--- a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
+++ b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.txt
@@ -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>;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property
  2019-11-27 14:46 ` [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property Lorenzo Bianconi
@ 2019-12-05 21:48   ` Rob Herring
  0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2019-12-05 21:48 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: nbd, linux-wireless, devicetree, lorenzo.bianconi

On Wed, 27 Nov 2019 16:46:34 +0200, Lorenzo Bianconi wrote:
> Introduce big-endian property to specify mtd radio partition endianness
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../devicetree/bindings/net/wireless/mediatek,mt76.txt         | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-05 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 14:46 [PATCH v2 0/2] add support for big endian eeprom partition to mt76 driver Lorenzo Bianconi
2019-11-27 14:46 ` [PATCH v2 1/2] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
2019-11-27 14:46 ` [PATCH v2 2/2] dt-bindings: net: wireless: mt76: introduce big-endian property Lorenzo Bianconi
2019-12-05 21:48   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).