Received: by 10.213.65.68 with SMTP id h4csp2119809imn; Sun, 8 Apr 2018 20:11:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Sing4WmETeOSq1vj450aBNPPTgul46Wtz0paCTOs8SYzKQQj4OEBmlxqncUfbtCFPIblX X-Received: by 2002:a17:902:407:: with SMTP id 7-v6mr36562445ple.47.1523243501711; Sun, 08 Apr 2018 20:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243501; cv=none; d=google.com; s=arc-20160816; b=Z4kYtlNHRmDlSUmkNm20nadoiuZdlD/VgetJYYON730EPhWGyTmUEkOOSkyJcSVc4e aphFQ21pRdYHyLoyNbQ0TjeH7cA1bZhtEuCchCJXr57Nyei8BHv+Z3SO7vzAdtLFBh6Q ID3KIOaHqKW/k76ZuP105xNbCEaNzXG0QHLTnina16rw+x1MIW3uNX30oZZx7LPyqULv B8Rla7w7P9RL5S4Nlwbmtwqf7NO7Z0+CvWZWNCHL5druHrf/mk7FAkRQKAgl7PuUi+lH 7jmMRQZvAxi5jq3BuDIb/xoDMJe4FB88bK8eLmV2wyk3rDEo5XrwoerCwJZtDb5PAvwi /7lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=lMy1Rx8SR3C8GxJUxWOMR1BqgkHBF1BXY14XYTsrXeo=; b=HMGjwjCV6D96ZqfjxiYq9b7rszwdm4efnDIAPxWF5pvyARx9vbc5ZJW9yCosTZDZG5 nWPb9/ugvY3HMaxr5+WeIM0ehLTijWb5udZsQhzGppRuHko5ExrqQOhqsfFB6KY7zXD6 sPA53WF0weXzf59XjxdccGkIIimp9X5i6NOfVe5FDKXhicSYcdYFwsrX0KRSwosQCwXO IpYDhgGsl4krzX0nS+YLFz6dUxc0IByTBrHiA8tWbwSQ/FSRo7Lj7j39iy8/qOSdGy2j efXRD5TdvR2kaK10XkInELZNQ8ypjzHqI7mzyxTy+kNg4wz4jWKLy0GKAwnsmoZNuR6u YHiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=NbS2FBzv; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11-v6si15985101plg.173.2018.04.08.20.11.05; Sun, 08 Apr 2018 20:11:41 -0700 (PDT) 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=@microsoft.com header.s=selector1 header.b=NbS2FBzv; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756446AbeDIC0m (ORCPT + 99 others); Sun, 8 Apr 2018 22:26:42 -0400 Received: from mail-by2nam03on0120.outbound.protection.outlook.com ([104.47.42.120]:61603 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753163AbeDIA3L (ORCPT ); Sun, 8 Apr 2018 20:29:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lMy1Rx8SR3C8GxJUxWOMR1BqgkHBF1BXY14XYTsrXeo=; b=NbS2FBzv9aPWTbfiZgArkTBBYGMkxa0oA/LbQHzju6zMtSsyjsxS1DVWj9J6mDXQYXm5vy5XGvvl5FsiPn38WPj+QgXXabjyf6f6jLEL4nNlp6N0xWAt9zuw/Z9RkDl5dVed3CNW3Jwl5fUA2FsR8zSdJe3V8HvoC8+GQaSolK8= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0967.namprd21.prod.outlook.com (52.132.133.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:29:09 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:29:09 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Lin Yun Sheng , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 094/293] net/hns:bugfix of ethtool -t phy self_test Thread-Topic: [PATCH AUTOSEL for 4.9 094/293] net/hns:bugfix of ethtool -t phy self_test Thread-Index: AQHTz5kSmP4t9d1uLEe03Z80aaxvCw== Date: Mon, 9 Apr 2018 00:24:07 +0000 Message-ID: <20180409002239.163177-94-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0967;7:yokSKvEl0vuk6xoOWnlRhUz8OOvFYw7cu3OJ2dqNmsVlf0Wr/QQ0Sz9/0OX/5TiJPl4bi1RhWTxVfQ5hm5z5lyw8Vuakm2kaB6E97LWggsj9KIPxi2mN0B2Fl/WTdOs2Gsw4R4mAz+XTh6i8iieth41b9g3uXcWKiXqIT3n+wPyybyTL6qejtK7OybH5k6u4VDD8V8IKNHZe8apH01VEHhqO2Lzae+EyXZAKCusp1njzjaehpIB4OJsRGEyLiqqn;20:960XV3Tv+6zoTWc09krxGFwjAp+87+fISSiWSHWsAwr4PGwKlWEwBFQbY0pcbQDHyMDNYxa3b7YQAUSrXToSJ9mjri4HlawYXF1cYP9LQyS27Tx7N73qqezHXaSRCenTDxOy97YEN2IgYNNUrigS6H5ZF7cFKwCPaNPm0DZAHOM= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 4d4011b8-c0ac-41f9-e575-08d59db0e91d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0967; x-ms-traffictypediagnostic: DM5PR2101MB0967: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(50582790962513); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0967;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0967; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(366004)(376002)(39380400002)(346002)(199004)(189003)(6506007)(486006)(86362001)(14454004)(68736007)(102836004)(99286004)(26005)(3846002)(6116002)(186003)(476003)(2616005)(1076002)(3280700002)(86612001)(72206003)(4326008)(446003)(54906003)(76176011)(11346002)(2906002)(22452003)(3660700001)(110136005)(97736004)(316002)(5660300001)(478600001)(8676002)(6512007)(8936002)(107886003)(6486002)(53936002)(81166006)(36756003)(81156014)(10290500003)(6436002)(10090500001)(25786009)(66066001)(106356001)(305945005)(7736002)(2501003)(5250100002)(105586002)(2900100001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0967;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: C6YtgsWrJuIAAsutiRYh51KKRNZ1ktynzWaFv7KYF+32iabXb4nqp/exWPAOVXPQWoMZiTBYT1cuiMdLHvn0+NDuvN3/mnhXJiXbhDizJT1s939fp2bbnTKhvazoAz45etfaid6KwvjQRact77aHCKspPlIXUFfUPZM1E93C9Wd1emz2lH4jBALWgVBjCcUy3C0RwDmC+kzFF1/lrWPZ5Qp/OznRIOZUcU6qgwRpO8HBrRjm8gp+n8Y82YlbOxcNcmjh3rqXMmwjRTXGevLf4NUQwwBT92Wd1Gg3BIwQoY9Gcpiq7Gu6XPqN2nFDZzy6TfLJbPcsE5OsO3kBzfTxsXH2NO7mnSja7ggrmLIXR2XufZ0gdILp6pUbFLsjU2UuSqTvX2uYura8Xyp+55SvYPecEBkZi7W6m3QkLfofd18= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d4011b8-c0ac-41f9-e575-08d59db0e91d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:07.3312 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0967 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Yun Sheng [ Upstream commit 7fe5b914313ff67d71cb2b5aa4b850e0884e75dd ] This patch fixes the phy loopback self_test failed issue. when Marvell Phy Module is loaded, it will powerdown fiber when doing phy loopback self test, which cause phy loopback self_test fail. Signed-off-by: Lin Yun Sheng Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns/hns_ethtool.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net= /ethernet/hisilicon/hns/hns_ethtool.c index 86a496d71995..ea5f7bd14b80 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c @@ -288,9 +288,15 @@ static int hns_nic_config_phy_loopback(struct phy_devi= ce *phy_dev, u8 en) =20 /* Force 1000M Link, Default is 0x0200 */ phy_write(phy_dev, 7, 0x20C); - phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); =20 - /* Enable PHY loop-back */ + /* Powerup Fiber */ + phy_write(phy_dev, HNS_PHY_PAGE_REG, 1); + val =3D phy_read(phy_dev, COPPER_CONTROL_REG); + val &=3D ~PHY_POWER_DOWN; + phy_write(phy_dev, COPPER_CONTROL_REG, val); + + /* Enable Phy Loopback */ + phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); val =3D phy_read(phy_dev, COPPER_CONTROL_REG); val |=3D PHY_LOOP_BACK; val &=3D ~PHY_POWER_DOWN; @@ -299,6 +305,12 @@ static int hns_nic_config_phy_loopback(struct phy_devi= ce *phy_dev, u8 en) phy_write(phy_dev, HNS_PHY_PAGE_REG, 0xFA); phy_write(phy_dev, 1, 0x400); phy_write(phy_dev, 7, 0x200); + + phy_write(phy_dev, HNS_PHY_PAGE_REG, 1); + val =3D phy_read(phy_dev, COPPER_CONTROL_REG); + val |=3D PHY_POWER_DOWN; + phy_write(phy_dev, COPPER_CONTROL_REG, val); + phy_write(phy_dev, HNS_PHY_PAGE_REG, 0); phy_write(phy_dev, 9, 0xF00); =20 --=20 2.15.1