[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58d31b56-8145-419e-b7be-1fd48cfeda88@lunn.ch>
Date: Thu, 21 Aug 2025 04:58:23 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Daniel Golle <daniel@...rotopia.org>
Cc: Hauke Mehrtens <hauke@...ke-m.de>, Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Russell King <linux@...linux.org.uk>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Andreas Schirm <andreas.schirm@...mens.com>,
Lukas Stockmann <lukas.stockmann@...mens.com>,
Alexander Sverdlin <alexander.sverdlin@...mens.com>,
Peter Christen <peter.christen@...mens.com>,
Avinash Jayaraman <ajayaraman@...linear.com>,
Bing tao Xu <bxu@...linear.com>, Liang Xu <lxu@...linear.com>,
Juraj Povazanec <jpovazanec@...linear.com>,
"Fanni (Fang-Yi) Chan" <fchan@...linear.com>,
"Benny (Ying-Tsan) Weng" <yweng@...linear.com>,
"Livia M. Rosu" <lrosu@...linear.com>,
John Crispin <john@...ozen.org>
Subject: Re: [PATCH net-next v3 7/8] net: dsa: lantiq_gswip: store switch API
version in priv
> > + priv->version = le16_to_cpu((__le16 __force)version);
>
> I've researched this a bit more and came to the conclusion that while the
> above works fine because all Lantiq SoCs with built-in switch are
> big-endian machines it is still wrong.
> I base this conclusion on the fact that when dealing with more recent
> MDIO-connected switches (MaxLinear GSW1xx series) the host endian doesn't
> play a role in the driver -- when dealing with 16-bit values on the MDIO
> bus, the bus abstraction takes care of converting from/to host endianess.
I agree that all MDIO bus registers are host endian, 16 bit. The shift
register in the hardware is responsible for putting the bits on the
wire in the correct order for MDIO.
> Hence I believe this should simply be a swab16() which will always result
> in the version being in the right byte order to use comparative operators
> in a meaningful way.
How is this described in the datasheet? And is version special, or do
all registers need swapping?
Andrew
Powered by blists - more mailing lists