[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <de73886f-7264-2246-1c63-15e15ea1b17d@pengutronix.de>
Date: Tue, 30 Mar 2021 16:08:09 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Oleksij Rempel <o.rempel@...gutronix.de>,
Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Fugang Duan <fugang.duan@....com>
Cc: Philippe Schenker <philippe.schenker@...adex.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Russell King <linux@...linux.org.uk>, linux-imx@....com,
kernel@...gutronix.de, David Jander <david@...tonic.nl>,
Fabio Estevam <festevam@...il.com>,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH net-next v1 2/3] net: phy: at803x: AR8085: add loopback
support
On 3/30/21 3:54 PM, Oleksij Rempel wrote:
> PHY loopback is needed for the ethernet controller self test support.
> This PHY was tested with the FEC sefltest.
>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
> drivers/net/phy/at803x.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index d7799beb811c..8679738cf2ab 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -326,6 +326,30 @@ static int at803x_resume(struct phy_device *phydev)
> return phy_modify(phydev, MII_BMCR, BMCR_PDOWN | BMCR_ISOLATE, 0);
> }
>
> +static int at803x_loopback(struct phy_device *phydev, bool enable)
> +{
> + int ret;
> +
> + if (enable)
> + ret = phy_clear_bits(phydev, MII_BMCR, BMCR_ANENABLE);
> + else
> + ret = phy_set_bits(phydev, MII_BMCR, BMCR_ANENABLE);
> +
> + if (ret)
> + return ret;
> +
> + ret = genphy_loopback(phydev, enable);
> +
> + /*
> + * Loop back needs some time to start transmitting packets in the loop.
> + * Documentation says nothing about it, so I take time which seems to
> + * work on AR8085.
> + */
/* Keep in mind the net multi line comment
* style.
*/
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists