[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACWXhKmLRK5aGNwDyt5uc0TK8ZXZKuDQuSXW6jku+Ofh73GUvw@mail.gmail.com>
Date: Fri, 14 Jul 2023 10:24:37 +0800
From: Feiyang Chen <chris.chenfeiyang@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Feiyang Chen <chenfeiyang@...ngson.cn>, hkallweit1@...il.com, peppe.cavallaro@...com,
alexandre.torgue@...s.st.com, joabreu@...opsys.com, chenhuacai@...ngson.cn,
linux@...linux.org.uk, dongbiao@...ngson.cn,
loongson-kernel@...ts.loongnix.cn, netdev@...r.kernel.org,
loongarch@...ts.linux.dev
Subject: Re: [RFC PATCH 10/10] net: stmmac: dwmac-loongson: Add GNET support
On Thu, Jul 13, 2023 at 12:07 PM Andrew Lunn <andrew@...n.ch> wrote:
>
> On Thu, Jul 13, 2023 at 10:49:38AM +0800, Feiyang Chen wrote:
> > Add GNET support. Use the fix_mac_speed() callback to workaround
> > issues with the Loongson PHY.
>
> What are the issues?
>
Hi, Andrew,
There is an issue with the synchronization between the network card
and the PHY. In the case of gigabit operation, if the PHY's speed
changes, the network card's speed remains unaffected. Hence, it is
necessary to initiate a re-negotiation process with the PHY to align
the link speeds properly.
> > +static void loongson_gnet_fix_speed(void *priv, unsigned int speed)
> > +{
> > + struct net_device *ndev = (struct net_device *)(*(unsigned long *)priv);
> > + struct stmmac_priv *ptr = netdev_priv(ndev);
> > +
> > + if (speed == SPEED_1000)
> > + if (readl(ptr->ioaddr + MAC_CTRL_REG) & (1 << 15) /* PS */)
> > + phy_restart_aneg(ndev->phydev);
>
> This needs a comment at least, but if you explain what is actually
> FUBAR in this PHY, we might be able to tell you a better way to work
> around its problems.
>
> > +static int loongson_gnet_data(struct pci_dev *pdev,
> > + struct plat_stmmacenet_data *plat)
> > +{
> > + common_default_data(pdev, plat);
> > +
> > + plat->mdio_bus_data->phy_mask = 0xfffffffb;
> > +
> > + plat->phy_addr = 2;
> > + plat->phy_interface = PHY_INTERFACE_MODE_GMII;
>
> You would normally get this from DT. Is the PHY integrated? Is it
> really using GMII, or would PHY_INTERFACE_MODE_INTERNAL be better?
>
Yes, the PHY is integrated. I'll try to use PHY_INTERFACE_MODE_INTERNAL
later.
Thanks,
Feiyang
> Andrew
Powered by blists - more mailing lists