[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2bf45888-98e5-7c3c-1732-05d685d59d54@gmail.com>
Date: Thu, 15 Apr 2021 12:58:48 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Oleksij Rempel <o.rempel@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Fugang Duan <fugang.duan@....com>
Cc: kernel@...gutronix.de, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-imx@....com, Fabio Estevam <festevam@...il.com>,
David Jander <david@...tonic.nl>,
Russell King <linux@...linux.org.uk>,
Philippe Schenker <philippe.schenker@...adex.com>
Subject: Re: [PATCH v2 2/7] net: phy: micrel: KSZ8081 & KSZ9031: add loopback
support
On 4/15/2021 6:07 AM, Oleksij Rempel wrote:
> PHY loopback is needed for the ethernet controller self test support.
> This PHY was tested with the generic net sefltest in combination with
> FEC ethernet controller and SJA1105 switch.
>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
> drivers/net/phy/micrel.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index a14a00328fa3..26066b1e02e5 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1311,6 +1311,7 @@ static struct phy_driver ksphy_driver[] = {
> .get_stats = kszphy_get_stats,
> .suspend = kszphy_suspend,
> .resume = kszphy_resume,
> + .set_loopback = genphy_loopback,
The generic loopback is really generic and is defined by the 802.3
standard, we should just mandate that drivers implement a custom
loopback if the generic one cannot work. I would change the PHY library
to do something like this:
if (phydev->drv->set_loopback)
ret = phydev->drv->set_loopback(phydev, ...)
else
ret = genphy_loopback(phydev, ...)
This would enable many more drivers than that we currently have today.
> }, {
> .phy_id = PHY_ID_KSZ8061,
> .name = "Micrel KSZ8061",
> @@ -1356,6 +1357,7 @@ static struct phy_driver ksphy_driver[] = {
> .get_stats = kszphy_get_stats,
> .suspend = genphy_suspend,
> .resume = kszphy_resume,
> + .set_loopback = genphy_loopback,
> }, {
> .phy_id = PHY_ID_LAN8814,
> .phy_id_mask = MICREL_PHY_ID_MASK,
>
--
Florian
Powered by blists - more mailing lists