[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170613224042.GF15847@lunn.ch>
Date: Wed, 14 Jun 2017 00:40:42 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Salil Mehta <salil.mehta@...wei.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"Zhuangyuzeng (Yisen)" <yisen.zhuang@...wei.com>,
huangdaode <huangdaode@...ilicon.com>,
"lipeng (Y)" <lipeng321@...wei.com>,
"mehta.salil.lnk@...il.com" <mehta.salil.lnk@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linuxarm <linuxarm@...wei.com>
Subject: Re: [PATCH net-next 6/9] net: hns3: Add MDIO support to HNS3
Ethernet driver for hip08 SoC
> > Hum why do you do this? mdiobus_register() will scan through your bus
> > provided that you set an appropriate phy_mask value (here you tell it
> > not to) and you already provide the PHY address to scan for
> >
> I know this looks weird but the reason why it appears as it is in code is:
>
> mdiobus_register() calls mdiobus_scan(). If you see below code leg function
> get_phy_device() assumes to be having supporting Clause 22 so its input
> parameter 'is_c45' is always 'false'.
>
> struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr)
> {
> struct phy_device *phydev;
> int err;
>
> phydev = get_phy_device(bus, addr, false);
> if (IS_ERR(phydev)) ^^^^^
> return phydev;
> [...]
> }
>
> Therefore, to support C45 device we did below:
>
> * disabled the autoscan/mdiobus_scan() Of the PHY devices using the
> phy_mask(= ~0)
> * Now, did almost the same thing what mdiobus_scan does i.e.
> * get_phy_device but with is_c45 (=true/false)
> * register the above phy device with phy_device_register()
>
> There could be some gap in my understanding, please help to correct this?
So this is the question i was asking Florian
Rather than hack around limitations of the core, you should fix the
core. I think we should make the core first try probing using c45. If
that comes back with an error, or does not find a device, try the
probe using c22.
Andrew
Powered by blists - more mailing lists