[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <43227d27d938fad8a2441363d175106e@walle.cc>
Date: Wed, 23 Mar 2022 23:14:11 +0100
From: Michael Walle <michael@...le.cc>
To: Andrew Lunn <andrew@...n.ch>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
"David S . Miller" <davem@...emloft.net>,
Xu Liang <lxu@...linear.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Florian Fainelli <f.fainelli@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC net-next 2/5] net: phy: support indirect c45 access in
get_phy_c45_ids()
Am 2022-03-23 20:39, schrieb Andrew Lunn:
>> +static int mdiobus_probe_mmd_read(struct mii_bus *bus, int prtad, int
>> devad,
>> + u16 regnum)
>> +{
>> + int ret;
>> +
>> + /* For backwards compatibility, treat MDIOBUS_NO_CAP as c45 capable
>> */
>> + if (bus->probe_capabilities == MDIOBUS_NO_CAP ||
>> + bus->probe_capabilities >= MDIOBUS_C45)
>
> Maybe we should do the work and mark up those that are C45 capable. At
> a quick count, see 16 of them.
You mean look at they are MDIOBUS_C45, MDIOBUS_C22_C45 or MDIOBUS_C22
and drop MDIOBUS_NO_CAP?
>
>> + return mdiobus_c45_read(bus, prtad, devad, regnum);
>> +
>> + mutex_lock(&bus->mdio_lock);
>> +
>> + /* Write the desired MMD Devad */
>> + ret = __mdiobus_write(bus, prtad, MII_MMD_CTRL, devad);
>> + if (ret)
>> + goto out;
>> +
>> + /* Write the desired MMD register address */
>> + ret = __mdiobus_write(bus, prtad, MII_MMD_DATA, regnum);
>> + if (ret)
>> + goto out;
>> +
>> + /* Select the Function : DATA with no post increment */
>> + ret = __mdiobus_write(bus, prtad, MII_MMD_CTRL,
>> + devad | MII_MMD_CTRL_NOINCR);
>> + if (ret)
>> + goto out;
>
> Make mmd_phy_indirect() usable, rather then repeat it.
I actually had that. But mmd_phy_indirect() doesn't check
the return code and neither does the __phy_write_mmd() it
actually deliberatly sets "ret = 0". So I wasn't sure. If you
are fine with a changed code flow in the error case, then sure.
I.e. mmd_phy_indirect() always (try to) do three accesses; with
error checks it might end after the first. If you are fine
with the error checks, should __phy_write_mmd() also check the
last mdiobus_write()?
-michael
Powered by blists - more mailing lists