* [PATCH] mt76: eeprom: add support for big endian eeprom partition
@ 2019-11-23 9:54 Lorenzo Bianconi
2019-11-25 13:53 ` Kalle Valo
[not found] ` <87k17o83lk.fsf@tynnyri.adurom.net>
0 siblings, 2 replies; 4+ messages in thread
From: Lorenzo Bianconi @ 2019-11-23 9:54 UTC (permalink / raw)
To: nbd; +Cc: linux-wireless, lorenzo.bianconi, kevin.patrick.schmidt
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
* Re: [PATCH] mt76: eeprom: add support for big endian eeprom partition
2019-11-23 9:54 [PATCH] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
@ 2019-11-25 13:53 ` Kalle Valo
[not found] ` <87k17o83lk.fsf@tynnyri.adurom.net>
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-11-25 13:53 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: nbd, linux-wireless, lorenzo.bianconi, kevin.patrick.schmidt
Lorenzo Bianconi <lorenzo@kernel.org> writes:
> 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]);
> + }
What about the bindings documentation? I don't see this "big-endian"
documented in the mt76 doc, at least.
--
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: eeprom: add support for big endian eeprom partition
[not found] ` <87k17o83lk.fsf@tynnyri.adurom.net>
@ 2019-11-25 13:59 ` Lorenzo Bianconi
2019-11-25 14:17 ` Kalle Valo
0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Bianconi @ 2019-11-25 13:59 UTC (permalink / raw)
To: Kalle Valo; +Cc: nbd, linux-wireless, lorenzo.bianconi, kevin.patrick.schmidt
[-- Attachment #1: Type: text/plain, Size: 1550 bytes --]
> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>
> > 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]);
> > + }
>
> What about the bindings documentation? I don't see this "big-endian"
> documented in the mt76 doc, at least.
Right, I will fold a patch for it in v2.
Regards,
Lorenzo
>
> --
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mt76: eeprom: add support for big endian eeprom partition
2019-11-25 13:59 ` Lorenzo Bianconi
@ 2019-11-25 14:17 ` Kalle Valo
0 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-11-25 14:17 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: nbd, linux-wireless, lorenzo.bianconi, kevin.patrick.schmidt
Lorenzo Bianconi <lorenzo@kernel.org> writes:
>> Lorenzo Bianconi <lorenzo@kernel.org> writes:
>>
>> > 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]);
>> > + }
>>
>> What about the bindings documentation? I don't see this "big-endian"
>> documented in the mt76 doc, at least.
>
> Right, I will fold a patch for it in v2.
And remember to CC the devicetree list, we need an ack from them.
--
Kalle Valo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-25 14:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-23 9:54 [PATCH] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
2019-11-25 13:53 ` Kalle Valo
[not found] ` <87k17o83lk.fsf@tynnyri.adurom.net>
2019-11-25 13:59 ` Lorenzo Bianconi
2019-11-25 14:17 ` Kalle Valo
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).