[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250515093124.7b7c365a@fedora.home>
Date: Thu, 15 May 2025 09:31:24 +0200
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: <Tristram.Ha@...rochip.com>
Cc: Andrew Lunn <andrew@...n.ch>, Woojung Huh <woojung.huh@...rochip.com>,
Russell King <linux@...linux.org.uk>, Vladimir Oltean <olteanv@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, "Paolo Abeni" <pabeni@...hat.com>,
<UNGLinuxDriver@...rochip.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v3] net: dsa: microchip: Add SGMII port support
to KSZ9477 switch
Hi Tristram,
On Tue, 13 May 2025 15:22:24 -0700
<Tristram.Ha@...rochip.com> wrote:
> From: Tristram Ha <tristram.ha@...rochip.com>
>
> The KSZ9477 switch driver uses the XPCS driver to operate its SGMII
> port. However there are some hardware bugs in the KSZ9477 SGMII
> module so workarounds are needed. There was a proposal to update the
> XPCS driver to accommodate KSZ9477, but the new code is not generic
> enough to be used by other vendors. It is better to do all these
> workarounds inside the KSZ9477 driver instead of modifying the XPCS
> driver.
>
> There are 3 hardware issues. The first is the MII_ADVERTISE register
> needs to be write once after reset for the correct code word to be
> sent. The XPCS driver disables auto-negotiation first before
> configuring the SGMII/1000BASE-X mode and then enables it back. The
> KSZ9477 driver then writes the MII_ADVERTISE register before enabling
> auto-negotiation. In 1000BASE-X mode the MII_ADVERTISE register will
> be set, so KSZ9477 driver does not need to write it.
>
> The second issue is the MII_BMCR register needs to set the exact speed
> and duplex mode when running in SGMII mode. During link polling the
> KSZ9477 will check the speed and duplex mode are different from
> previous ones and update the MII_BMCR register accordingly.
>
> The last issue is 1000BASE-X mode does not work with auto-negotiation
> on. The cause is the local port hardware does not know the link is up
> and so network traffic is not forwarded. The workaround is to write 2
> additional bits when 1000BASE-X mode is configured.
>
> Note the SGMII interrupt in the port cannot be masked. As that
> interrupt is not handled in the KSZ9477 driver the SGMII interrupt bit
> will not be set even when the XPCS driver sets it.
>
> Signed-off-by: Tristram Ha <tristram.ha@...rochip.com>
I was able to test this patch this morning, with both SGMII (copper
SFP) and 1000BaseX (Fibre SFP), hot-swapping and all, it works well :)
Thanks for that !
Reviewed-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Tested-by: Maxime Chevallier <maxime.chevallier@...tlin.com>
Maxime
Powered by blists - more mailing lists