[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8m75N5//L+PHo8f@shell.armlinux.org.uk>
Date: Thu, 19 Jan 2023 21:53:40 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Bjørn Mork <bjorn@...k.no>
Cc: netdev@...r.kernel.org, Felix Fietkau <nbd@....name>,
John Crispin <john@...ozen.org>,
Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Daniel Golle <daniel@...rotopia.org>,
Alexander Couzens <lynxis@...0.eu>
Subject: Re: [PATCH net 2/3] net: mediatek: sgmii: autonegotiation is required
On Thu, Jan 19, 2023 at 08:33:17PM +0100, Bjørn Mork wrote:
> "Russell King (Oracle)" <linux@...linux.org.uk> writes:
> > On Thu, Jan 19, 2023 at 06:12:47PM +0100, Bjørn Mork wrote:
> >> sgmii mode fails if autonegotiation is disabled.
> >>
> >> Signed-off-by: Bjørn Mork <bjorn@...k.no>
> >> ---
> >> drivers/net/ethernet/mediatek/mtk_sgmii.c | 11 +++--------
> >> 1 file changed, 3 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c
> >> index 481f2f1e39f5..d1f2bcb21242 100644
> >> --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c
> >> +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c
> >> @@ -62,14 +62,9 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
> >> * other words, 1000Mbps or 2500Mbps).
> >> */
> >> if (interface == PHY_INTERFACE_MODE_SGMII) {
> >> - sgm_mode = SGMII_IF_MODE_SGMII;
> >> - if (phylink_autoneg_inband(mode)) {
> >> - sgm_mode |= SGMII_REMOTE_FAULT_DIS |
> >> - SGMII_SPEED_DUPLEX_AN;
> >> - use_an = true;
> >> - } else {
> >> - use_an = false;
> >> - }
> >> + sgm_mode = SGMII_IF_MODE_SGMII | SGMII_REMOTE_FAULT_DIS |
> >> + SGMII_SPEED_DUPLEX_AN;
> >> + use_an = true;
> >
> > I wasn't actually suggesting in our discussion that this is something
> > which should be changed.
> >
> > The reference implementation for the expected behaviour is
> > phylink_mii_c22_pcs_config(), and it only enables in-band if "mode"
> > says so. If we have a PHY which has in-band disabled (yes, they do
> > exist) then having SGMII in-band unconditionally enabled breaks them,
> > and yes, those PHYs appear on SFP modules.
> >
> > The proper answer is to use 'managed = "in-band-status";' in your DT
> > to have in-band used with SGMII.
>
> Well, yeah, I'd love to. But then I'm back to the drawing board without
> a link. That just doesn't work for me.
If you have 'managed = "in-band-status";' in your DT, that will set
"mode" to be MLO_AN_INBAND, and phylink_autoneg_inband(mode) will be
true - which should result in the link being programmed for in-band
mode. You should also find that mtk_pcs_get_state() gets called.
Hmm, it looks like setting ss->pcs[i].pcs.poll to true was missed
when support for inband was properly added, so that might be the
issue there - as the mtk ethernet driver doesn't make use of
phylink_mac_change().
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists