[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <bd25e13d-7cfd-433b-9640-e077882c510d@loongson.cn>
Date: Thu, 28 Mar 2024 19:41:05 +0800
From: Yanteng Si <siyanteng@...ngson.cn>
To: Andrew Lunn <andrew@...n.ch>
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 06/11] net: stmmac: dwmac-loongson: Add GNET
support
在 2024/3/21 22:55, Andrew Lunn 写道:
>> Because the default return value of gnet's mdio is 0xffff, when scanning for
>> phy,
>>
>> if the return value is not 0, it will be assumed that the phy for that
>> address exists.
> That is not correct. The MDIO bus has a pull up on the data line. If
> there is no device at a given address, that pull up results in 0xffff
> being read. phylib understands this, it knows that a read with the
> value of 0xffff probably means there is no device at that address. So
> it will not create a device.
OK. I've got it.
>
>> Not specifying an address will cause all addresses' phy to be detected, and
>> the
>>
>> lowest address' phy will be selected by default. so then, the network is
>> unavailable.
> Do you have multiple PHYs on the bus? If there is only one PHY the
Only one.
> first PHY should be the PHY you want, and phy_find_first() will do
static int loongson_gnet_data(struct pci_dev *pdev,
struct plat_stmmacenet_data *plat)
{
struct net_device *ndev = dev_get_drvdata(&pdev->dev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct phy_device *phydev;
phydev = phy_find_first(priv->mii);
plat->phy_addr = phydev->mdio.addr;
If I understand your comment correctly, this doesn't seem to work
because the mii hasn't been initialized at this point.
So, how about plat->phy_addr = -1; ?
Thanks,
Yanteng
Powered by blists - more mailing lists