Received: by 10.223.148.5 with SMTP id 5csp7515822wrq; Thu, 18 Jan 2018 06:27:24 -0800 (PST) X-Google-Smtp-Source: ACJfBovSZsLkY71+I4yexTJL2ezzr7D5gwX6uLOcG7Jt5oW4NZ+2pX2swl+2cTBEoBufAdfl2rfI X-Received: by 10.99.149.8 with SMTP id p8mr4667344pgd.186.1516285644188; Thu, 18 Jan 2018 06:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516285644; cv=none; d=google.com; s=arc-20160816; b=lDD7Cw+OXLfgSCEYk+a7U/QZLMdd31QYEaKquODZ/ekGQJLrX8C9mSzAvE1eM8fFm2 PWzXwN1O8vbSgr6G/fVAhV9G+JiXRINMkIeZqKcJo+s1T/Exh5pSdx8TldTInE2vffUr i4ZTlCeS9M644cDjuIPiRkyfDC2FcFlGxiGZVxPrqdplKszUWJ5wrIfhTKgjggcWRw+y 6URHLzn4p6Vmlzsydz1Npv7JXsUum/57QJr+mEtC9zyGKkcQMvXAEBWLAFhSnzs6X2Nk z40G9yD7r89dbDKG/HhjLHwqTWY7Cpl6V0PK6XLKb++AoyaxWwt2danV+9GV0O9MVO4c Pbuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=GpljKpqyYMkOOvQd6mmbn3TslJ1QD1vbC7AMnmKlkKU=; b=0ZUZjvwcTq0veblutMaE3nARuXMDXBQ2NXvsc2PFzi56Y2lW/7gT1KT4bJmWTWTaG+ JPzPe/cRW8fUlzOngcIpXpQcHa0tZu5cyBFsTp5Mzg6VuBWhTxKwUn/YTdQx9t7JDJIL vXfQE1PMCoJQ5BunWnt4XFsCNdTVLlXSUaZTPROeUcIkxdpT6GdCF+nOYHH0P7h8bEe5 YE2pqdnL/oocHJvYaEbzZqBCc9+DsRPa+qntIJESe+j7TaNMt6bS781mZONqekLx8CvP yXBGHz9rks9JQWIkYfboYWC0xoudvvqPlAwOz33RqrtIgUC8CaEt1BkUsQkGDKWaukvu lRfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=jYYRX8Sm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si5993333pgq.530.2018.01.18.06.27.10; Thu, 18 Jan 2018 06:27:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=jYYRX8Sm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756577AbeAROZV (ORCPT + 99 others); Thu, 18 Jan 2018 09:25:21 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:54360 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756522AbeAROZU (ORCPT ); Thu, 18 Jan 2018 09:25:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=GpljKpqyYMkOOvQd6mmbn3TslJ1QD1vbC7AMnmKlkKU=; b=jYYRX8SmDbIhE6L94GbpA+r4Dhwp7/BIPaTFStYSCFZqsHNaLWsMN6mCSv3w4/DVUQrSHZTGIicFaz1Edk4LWyvqgs6mMmupGnVo4ITjhj7sljiXqv1DN7Qen/ceE1ktSGDVmjRLwLFj8dkU452Xzf3kdBsQPz487QR0tW31XM8=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1ecB7z-0001il-6z; Thu, 18 Jan 2018 15:25:15 +0100 Date: Thu, 18 Jan 2018 15:25:15 +0100 From: Andrew Lunn To: Peng Li 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 Message-ID: <20180118142515.GI5894@lunn.ch> References: <1516259632-85088-1-git-send-email-lipeng321@huawei.com> <1516259632-85088-4-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516259632-85088-4-git-send-email-lipeng321@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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