netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: "Christian Lamparter" <chunkeey@gmail.com>,
	"Álvaro Fernández Rojas" <noltari@gmail.com>,
	f.fainelli@gmail.com, jonas.gorski@gmail.com, nbd@nbd.name,
	kvalo@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ath9k: fix calibration data endianness
Date: Sun, 16 Apr 2023 12:50:00 +0200	[thread overview]
Message-ID: <874jpgxfs7.fsf@toke.dk> (raw)
In-Reply-To: <03a74fbb-dd77-6283-0b08-6a9145a2f4f6@gmail.com>

Christian Lamparter <chunkeey@gmail.com> writes:

> On 4/15/23 18:02, Christian Lamparter wrote:
>> Hi,
>> 
>> On 4/15/23 17:25, Toke Høiland-Jørgensen wrote:
>>> Álvaro Fernández Rojas <noltari@gmail.com> writes:
>>>
>>>> BCM63xx (Big Endian MIPS) devices store the calibration data in MTD
>>>> partitions but it needs to be swapped in order to work, otherwise it fails:
>>>> ath9k 0000:00:01.0: enabling device (0000 -> 0002)
>>>> ath: phy0: Ignoring endianness difference in EEPROM magic bytes.
>>>> ath: phy0: Bad EEPROM VER 0x0001 or REV 0x00e0
>>>> ath: phy0: Unable to initialize hardware; initialization status: -22
>>>> ath9k 0000:00:01.0: Failed to initialize device
>>>> ath9k: probe of 0000:00:01.0 failed with error -22
>>>
>>> How does this affect other platforms? Why was the NO_EEP_SWAP flag set
>>> in the first place? Christian, care to comment on this?
>> 
>> I knew this would come up. I've written what I know and remember in the
>> pull-request/buglink.
>> 
>> Maybe this can be added to the commit?
>> Link: https://github.com/openwrt/openwrt/pull/12365
>> 
>> | From what I remember, the ah->ah_flags |= AH_NO_EEP_SWAP; was copied verbatim from ath9k_of_init's request_eeprom.
>> 
>> Since the existing request_firmware eeprom fetcher code set the flag,
>> the nvmem code had to do it too.
>> 
>> In theory, I don't think that not setting the AH_NO_EEP_SWAP flag will cause havoc.
>> I don't know if there are devices out there, which have a swapped magic (which is
>> used to detect the endianess), but the caldata is in the correct endiannes (or
>> vice versa - Magic is correct, but data needs swapping).
>> 
>> I can run tests with it on a Netzgear WNDR3700v2 (AR7161+2xAR9220)
>> and FritzBox 7360v2 (Lantiq XWAY+AR9220). (But these worked fine.
>> So I don't expect there to be a new issue there).
>
> Nope! This is a classic self-own!... Well at least, this now gets documented!
>
> Here are my findings. Please excuse the overlong lines.
>
> ## The good news / AVM FritzBox 7360v2 ##
>
> The good news: The AVM FritzBox 7360v2 worked the same as before.

[...]

> ## The not so good news / Netgear WNDR3700v2 ##
>
> But not the Netgar WNDR3700v2. One WiFi (The 2.4G, reported itself now as the 5G @0000:00:11.0 -
> doesn't really work now), and the real 5G WiFi (@0000:00:12.0) failed with:
> "phy1: Bad EEPROM VER 0x0001 or REV 0x06e0"

[...]

Alright, so IIUC, we have a situation where some devices only work
*with* the flag, and some devices only work *without* the flag? So we'll
need some kind of platform-specific setting? Could we put this in the
device trees, or is there a better solution?

-Toke

  reply	other threads:[~2023-04-16 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15 15:05 [PATCH] ath9k: fix calibration data endianness Álvaro Fernández Rojas
2023-04-15 15:25 ` Toke Høiland-Jørgensen
2023-04-15 16:02   ` Christian Lamparter
2023-04-15 19:32     ` Christian Lamparter
2023-04-16 10:50       ` Toke Høiland-Jørgensen [this message]
2023-04-16 13:37         ` Christian Lamparter
2023-04-16 14:28           ` Álvaro Fernández Rojas
2023-04-16 14:44           ` Andrew Lunn
2023-04-16 21:49           ` Toke Høiland-Jørgensen
2023-04-17  5:33             ` Álvaro Fernández Rojas

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=874jpgxfs7.fsf@toke.dk \
    --to=toke@toke.dk \
    --cc=chunkeey@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=pabeni@redhat.com \
    /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).