[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6fc3ef55-68f7-4b1a-aa8f-70dc8ffdba3e@lunn.ch>
Date: Fri, 25 Jul 2025 14:27:39 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Tristram.Ha@...rochip.com
Cc: Woojung Huh <woojung.huh@...rochip.com>,
Vladimir Oltean <olteanv@...il.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Maxime Chevallier <maxime.chevallier@...tlin.com>,
Simon Horman <horms@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Marek Vasut <marex@...x.de>, UNGLinuxDriver@...rochip.com,
devicetree@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v6 2/6] net: dsa: microchip: Add KSZ8463 switch
support to KSZ DSA driver
> On Thu, Jul 24, 2025 at 05:17:49PM -0700, Tristram.Ha@...rochip.com wrote:
> From: Tristram Ha <tristram.ha@...rochip.com>
>
> KSZ8463 switch is a 3-port switch based from KSZ8863. Its major
> difference from other KSZ SPI switches is its register access is not a
> simple continual 8-bit transfer with automatic address increase but uses
> a byte-enable mechanism specifying 8-bit, 16-bit, or 32-bit access. Its
> registers are also defined in 16-bit format because it shares a design
> with a MAC controller using 16-bit access. As a result some common
> register accesses need to be re-arranged.
>
> This patch adds the basic structure for using KSZ8463. It cannot use the
> same regmap table for other KSZ switches as it interprets the 16-bit
> value as little-endian and its SPI commands are different.
>
> KSZ8463 uses a byte-enable mechanism to specify 8-bit, 16-bit, and 32-bit
> access. The register is first shifted right by 2 then left by 4. Extra
> 4 bits are added. If the access is 8-bit one of the 4 bits is set. If
> the access is 16-bit two of the 4 bits are set. If the access is 32-bit
> all 4 bits are set. The SPI command for read or write is then added.
>
> Because of this register transformation separate SPI read and write
> functions are provided for KSZ8463.
>
> KSZ8463's internal PHYs use standard PHY register definitions so there is
> no need to remap things. However, the hardware has a bug that the high
> word and low word of the PHY id are swapped. In addition the port
> registers are arranged differently so KSZ8463 has its own mapping for
> port registers and PHY registers. Therefore the PORT_CTRL_ADDR macro is
> replaced with the get_port_addr helper function.
>
> Signed-off-by: Tristram Ha <tristram.ha@...rochip.com>
Thanks for keeping working on regmap. The end result is a lot better,
smaller.
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists