public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Peng Li <lipeng321@huawei.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linuxarm@huawei.com,
	salil.mehta@huawei.com
Subject: Re: [PATCH net-next 3/5] net: hns3: add ethtool -p support for phy device
Date: Thu, 18 Jan 2018 15:25:15 +0100	[thread overview]
Message-ID: <20180118142515.GI5894@lunn.ch> (raw)
In-Reply-To: <1516259632-85088-4-git-send-email-lipeng321@huawei.com>

> +static int hclge_set_led_status_phy(struct phy_device *phydev, int value)
> +{
> +	int ret, cur_page;
> +
> +	mutex_lock(&phydev->lock);
> +
> +	ret = phy_read(phydev, HCLGE_PHY_PAGE_REG);
> +	if (ret < 0)
> +		goto out;
> +	else
> +		cur_page = ret;
> +
> +	ret = phy_write(phydev, HCLGE_PHY_PAGE_REG, HCLGE_PHY_PAGE_LED);
> +	if (ret)
> +		goto out;
> +
> +	ret = phy_write(phydev, HCLGE_LED_FC_REG, value);
> +	if (ret)
> +		goto out;
> +
> +	ret = phy_write(phydev, HCLGE_PHY_PAGE_REG, cur_page);
> +
> +out:
> +	mutex_unlock(&phydev->lock);
> +	return ret;
> +}

Sorry, but NACK.

Please add an interface to phylib and the phy driver you are using to
do this.

>  #define HCLGE_PHY_PAGE_MDIX		0
>  #define HCLGE_PHY_PAGE_COPPER		0
> +#define HCLGE_PHY_PAGE_LED		3
>  
>  /* Page Selection Reg. */
>  #define HCLGE_PHY_PAGE_REG		22
> @@ -73,6 +74,15 @@
>  /* Copper Specific Status Register */
>  #define HCLGE_PHY_CSS_REG		17
>  
> +/* LED Function Control Register */
> +#define HCLGE_LED_FC_REG		16
> +
> +/* LED Polarity Control Register */
> +#define HCLGE_LED_PC_REG		17
> +
> +#define HCLGE_LED_FORCE_ON		9
> +#define HCLGE_LED_FORCE_OFF		8
> +

By the looks of these defines, you assume you have a Marvell PHY.
Please make this generic so anybody with a Marvell PHY can use it.

       Andrew

  reply	other threads:[~2018-01-18 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18  7:13 [PATCH net-next 0/5] add some features to hns3 driver Peng Li
2018-01-18  7:13 ` [PATCH net-next 1/5] net: hns3: add support for get_regs Peng Li
2018-01-18  7:13 ` [PATCH net-next 2/5] net: hns3: add manager table initialization for hardware Peng Li
2018-01-18  7:13 ` [PATCH net-next 3/5] net: hns3: add ethtool -p support for phy device Peng Li
2018-01-18 14:25   ` Andrew Lunn [this message]
2018-01-19  2:50     ` lipeng (Y)
2018-01-18  7:13 ` [PATCH net-next 4/5] net: hns3: add ethtool -p support for fiber port Peng Li
2018-01-18  7:13 ` [PATCH net-next 5/5] net: hns3: add net status led " Peng Li

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=20180118142515.GI5894@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox