linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalle Valo <kvalo@codeaurora.org>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: nbd@nbd.name, linux-wireless@vger.kernel.org,
	lorenzo.bianconi@redhat.com,
	kevin.patrick.schmidt@googlemail.com
Subject: Re: [PATCH] mt76: eeprom: add support for big endian eeprom partition
Date: Mon, 25 Nov 2019 13:53:17 +0000	[thread overview]
Message-ID: <0101016ea2d681fc-d025a829-1e16-4cf1-b9d0-477469cfb704-000000@us-west-2.amazonses.com> (raw)
In-Reply-To: <61e89623446ed8914e5969114c7ae8c623f3e3ba.1574502651.git.lorenzo@kernel.org> (Lorenzo Bianconi's message of "Sat, 23 Nov 2019 11:54:01 +0200")

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

  reply	other threads:[~2019-11-25 13:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23  9:54 [PATCH] mt76: eeprom: add support for big endian eeprom partition Lorenzo Bianconi
2019-11-25 13:53 ` Kalle Valo [this message]
     [not found] ` <87k17o83lk.fsf@tynnyri.adurom.net>
2019-11-25 13:59   ` Lorenzo Bianconi
2019-11-25 14:17     ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0101016ea2d681fc-d025a829-1e16-4cf1-b9d0-477469cfb704-000000@us-west-2.amazonses.com \
    --to=kvalo@codeaurora.org \
    --cc=kevin.patrick.schmidt@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).