public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn•ch>
To: Lin Yun Sheng <linyunsheng@huawei•com>
Cc: davem@davemloft•net, f.fainelli@gmail•com,
	huangdaode@hisilicon•com, xuwei5@hisilicon•com,
	liguozhu@hisilicon•com, Yisen.Zhuang@huawei•com,
	gabriele.paoloni@huawei•com, john.garry@huawei•com,
	linuxarm@huawei•com, salil.mehta@huawei•com,
	lipeng321@huawei•com, tremyfr@gmail•com, netdev@vger•kernel.org,
	linux-kernel@vger•kernel.org
Subject: Re: [PATCH NET 2/2] net: hns: Use phy_driver to setup Phy loopback
Date: Fri, 23 Jun 2017 05:20:11 +0200	[thread overview]
Message-ID: <20170623032011.GB5432@lunn.ch> (raw)
In-Reply-To: <1498121613-64572-1-git-send-email-linyunsheng@huawei.com>

On Thu, Jun 22, 2017 at 04:53:33PM +0800, Lin Yun Sheng wrote:
> Use function set_loopback in phy_driver to setup phy loopback
> when doing ethtool self test.
> 
> Signed-off-by: Lin Yun Sheng <linyunsheng@huawei•com>
> ---
>  drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 64 ++++--------------------
>  1 file changed, 10 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> index e95795b..660b51e 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
> @@ -259,66 +259,22 @@ static int hns_nic_set_link_ksettings(struct net_device *net_dev,
>  
>  static int hns_nic_config_phy_loopback(struct phy_device *phy_dev, u8 en)
>  {
> -#define COPPER_CONTROL_REG 0
> -#define PHY_POWER_DOWN BIT(11)
> -#define PHY_LOOP_BACK BIT(14)
> -	u16 val = 0;
>  
> -	if (phy_dev->is_c45) /* c45 branch adding for XGE PHY */
> +	if (phy_dev->is_c45 || !phy_dev->drv)
> +		return -ENOTSUPP;
> +
> +	if (!phy_dev->drv->resume || !phy_dev->drv->suspend ||
> +	    !phy_dev->drv->set_loopback)
>  		return -ENOTSUPP;

No, i said to have a function is phy.c which does this check. The phy
core needs to keep track of if loopback is already enabled, and return
an error if it is attempted to turn it on twice, or disable it when it
is not enabled.

   Andrew

  reply	other threads:[~2017-06-23  3:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22  8:53 [PATCH NET 2/2] net: hns: Use phy_driver to setup Phy loopback Lin Yun Sheng
2017-06-23  3:20 ` Andrew Lunn [this message]
2017-06-23  3:48   ` Yunsheng Lin
2017-06-23  4:05     ` Andrew Lunn

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=20170623032011.GB5432@lunn.ch \
    --to=andrew@lunn$(echo .)ch \
    --cc=Yisen.Zhuang@huawei$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=f.fainelli@gmail$(echo .)com \
    --cc=gabriele.paoloni@huawei$(echo .)com \
    --cc=huangdaode@hisilicon$(echo .)com \
    --cc=john.garry@huawei$(echo .)com \
    --cc=liguozhu@hisilicon$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxarm@huawei$(echo .)com \
    --cc=linyunsheng@huawei$(echo .)com \
    --cc=lipeng321@huawei$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=salil.mehta@huawei$(echo .)com \
    --cc=tremyfr@gmail$(echo .)com \
    --cc=xuwei5@hisilicon$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox