[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e491227b-81a1-4363-b810-501511939f1b@lunn.ch>
Date: Thu, 13 Jul 2023 06:07:24 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Feiyang Chen <chenfeiyang@...ngson.cn>
Cc: 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, chris.chenfeiyang@...il.com
Subject: Re: [RFC PATCH 10/10] net: stmmac: dwmac-loongson: Add GNET support
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?
> +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?
Andrew
Powered by blists - more mailing lists