[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3c551143-2e49-47c6-93bf-b43d6c62012b@lunn.ch>
Date: Thu, 21 Mar 2024 16:02:54 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Yanteng Si <siyanteng@...ngson.cn>
Cc: Serge Semin <fancer.lancer@...il.com>, hkallweit1@...il.com,
peppe.cavallaro@...com, alexandre.torgue@...s.st.com,
joabreu@...opsys.com, Jose.Abreu@...opsys.com,
chenhuacai@...ngson.cn, linux@...linux.org.uk,
guyinggang@...ngson.cn, netdev@...r.kernel.org,
chris.chenfeiyang@...il.com
Subject: Re: [PATCH net-next v8 08/11] net: stmmac: dwmac-loongson: Fix MAC
speed for GNET
On Thu, Mar 21, 2024 at 05:29:55PM +0800, Yanteng Si wrote:
>
> 在 2024/3/20 01:02, Serge Semin 写道:
> > > > Due to a bug in the chip's internal PHY, the network is still not working after
> > > > the first self-negotiation, and it needs to be self-negotiated again.
> > Then please describe the bug in more details then.
> >
> > Getting back to the code you implemented here. In the in-situ comment
> > you say: "We need to use the PS bit to check if the controller's
> > status is correct and reset PHY if necessary." By calling
> > phy_restart_aneg() you don't reset the PHY.
> >
> > Moreover if "PS" flag is set, then the MAC has been pre-configured to
> > work in the 10/100Mbps mode. Since 1000Mbps speed is requested, the
> > MAC_CTRL_REG.PS flag will be cleared later in the
> > stmmac_mac_link_up() method and then phylink_start() shall cause the
> > link speed re-auto-negotiation. Why do you need the auto-negotiation
> > started for the default MAC config which will be changed just in a
> > moment later? All of that seems weird.
>
> When switching speeds (from 100M to 1000M), the phy cannot output clocks,
>
> resulting in the unavailability of the network card. At this time, a reset
> of the
>
> phy is required.
reset, or restart of autoneg?
> BTW, This bug has been fixed in gnet of 2k2000 (0x10, 7a13).
>
> >
> > Most importantly I have doubts the networking subsystem maintainers
> > will permit you calling the phy_restart_aneg() method from the MAC
> > driver code.
That is O.K. It should have a comment explaining that it is working
around a hardware bug. And you need to take care of locking. But a MAC
driver can call this, e.g. if it implements ethtool nway_reset, it
needs to do exactly this. See phy_ethtool_nway_reset().
Andrew
Powered by blists - more mailing lists