All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Fugang Duan <fugang.duan@nxp.com>,
	kernel@pengutronix.de, netdev@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	Fabio Estevam <festevam@gmail.com>,
	David Jander <david@protonic.nl>,
	Russell King <linux@armlinux.org.uk>,
	Philippe Schenker <philippe.schenker@toradex.com>
Subject: Re: [PATCH net-next v1 2/3] net: phy: at803x: AR8085: add loopback support
Date: Tue, 30 Mar 2021 16:49:28 +0200	[thread overview]
Message-ID: <YGM6eIopy5VBHu+T@lunn.ch> (raw)
In-Reply-To: <20210330135407.17010-3-o.rempel@pengutronix.de>

On Tue, Mar 30, 2021 at 03:54:06PM +0200, 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@pengutronix.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);

Auto-neg might of been turned off when entering self test. So you
should leave it off when existing self test.

Or maybe call phy_config_aneg() which should reconfigure the PHY back
how it was.

       Andrew

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Fugang Duan <fugang.duan@nxp.com>,
	kernel@pengutronix.de, netdev@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-imx@nxp.com,
	Fabio Estevam <festevam@gmail.com>,
	David Jander <david@protonic.nl>,
	Russell King <linux@armlinux.org.uk>,
	Philippe Schenker <philippe.schenker@toradex.com>
Subject: Re: [PATCH net-next v1 2/3] net: phy: at803x: AR8085: add loopback support
Date: Tue, 30 Mar 2021 16:49:28 +0200	[thread overview]
Message-ID: <YGM6eIopy5VBHu+T@lunn.ch> (raw)
In-Reply-To: <20210330135407.17010-3-o.rempel@pengutronix.de>

On Tue, Mar 30, 2021 at 03:54:06PM +0200, 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@pengutronix.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);

Auto-neg might of been turned off when entering self test. So you
should leave it off when existing self test.

Or maybe call phy_config_aneg() which should reconfigure the PHY back
how it was.

       Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-03-30 14:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 13:54 [PATCH net-next v1 0/3] provide basic selftest support for the ethernet FEC driver Oleksij Rempel
2021-03-30 13:54 ` Oleksij Rempel
2021-03-30 13:54 ` [PATCH net-next v1 1/3] net: phy: micrel: KSZ8081: add loopback support Oleksij Rempel
2021-03-30 13:54   ` Oleksij Rempel
2021-03-30 14:06   ` Marc Kleine-Budde
2021-03-30 14:06     ` Marc Kleine-Budde
2021-03-30 14:39   ` Andrew Lunn
2021-03-30 14:39     ` Andrew Lunn
2021-03-30 13:54 ` [PATCH net-next v1 2/3] net: phy: at803x: AR8085: " Oleksij Rempel
2021-03-30 13:54   ` Oleksij Rempel
2021-03-30 14:08   ` Marc Kleine-Budde
2021-03-30 14:08     ` Marc Kleine-Budde
2021-03-30 14:49   ` Andrew Lunn [this message]
2021-03-30 14:49     ` Andrew Lunn
2021-03-30 13:54 ` [PATCH net-next v1 3/3] net: fec: add basic selftest support Oleksij Rempel
2021-03-30 13:54   ` Oleksij Rempel
2021-03-31  1:07   ` kernel test robot
2021-03-31  1:07     ` kernel test robot
2021-03-31  1:07     ` kernel test robot
2021-03-31 12:27   ` Andrew Lunn
2021-03-31 12:27     ` Andrew Lunn
2021-04-01  7:47     ` Oleksij Rempel
2021-04-01  7:47       ` Oleksij Rempel
2021-04-01 16:06       ` Florian Fainelli
2021-04-01 16:06         ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YGM6eIopy5VBHu+T@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=david@protonic.nl \
    --cc=f.fainelli@gmail.com \
    --cc=festevam@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=philippe.schenker@toradex.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.