From patchwork Fri Feb 12 18:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 12085843 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B9DAC433DB for ; Fri, 12 Feb 2021 18:01:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9D0264E3D for ; Fri, 12 Feb 2021 18:01:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbhBLSBx (ORCPT ); Fri, 12 Feb 2021 13:01:53 -0500 Received: from mail-mw2nam10on2073.outbound.protection.outlook.com ([40.107.94.73]:11840 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231131AbhBLSBv (ORCPT ); Fri, 12 Feb 2021 13:01:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WWQZi3QUa2xeKKVAnd+LFwv6d8Rhv5rZ7q1sdhMkioIMpO9O3TuItxFgpvGRk39Z9EeG9OlkK/wp8iy+3VJexDT/7Rc9yWqnc9WmEaGDUyAvUDax4gcFV6tCuShjOSUzftG7ZNkEB2qKgiqW+aRocyzsE5NfSv4vEiVONSzIOPQ1YsLliu1XkxE/zkxQLFY+7Uo6Zcz2uYILtISwT5VRKOKv+DJUyWVmSpCvFrmXBCK8+4lNlUa6svK442dGj4cHfDR9B8rquyvGarUIKilwYEEKeI2W/Hks2Kq0iapGIuHFtFNx5UyxajBhopIbImttUxSQiw6oPhkXcWAOv9WWIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XqwXqrKLzKGS9LSaWbxj3tjzZqGxcvqKh2pjXHS9cJ0=; b=HwjnkQojSDitSw4Ix9pOdFPyiuMOx++IdSaFa4CBwYTAifoBH+FeCi268WxbNFy0aEOp63O9jmulVKByvcZOr3QeRb08J0ASPw2rEHvIY4ROqdptaM2Ns/nV9khw3XOSfAgiJc9MSolIkk6dufh4UMakQExe5ASGpyReuKjOFnQg3cWyitgLdYFgRAW9jcQZwyMhdztaXPpRwdfx/D9TSwfRjHYVutBAmxdJ/r9iIrETON1e1j1Vg4kv7lKCrkEppZ6IJPtGRlZFEJ7a9jTZR6jo7A+OuphVRgyhNI/4W6Lgj+W8uwz+QurwBdUj/wDepIbmut1eebHIHoBrIyiOHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XqwXqrKLzKGS9LSaWbxj3tjzZqGxcvqKh2pjXHS9cJ0=; b=v+hZ6tvg1d8U7qDDx+R4jU4t6mD+5aMhTMCoiRZDrTeFavpNkSeieHss3NMSOyri2ins5GM+vQxHkcHdEviqtfTvdZBBux9tX80yJpx1zKSjBA3wZV4iX63gUjq0ypEky3WZsnRp3/jlyiY5mnp8X/rd6jOwA0H5fjHU00ZUQN8= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) by SA0PR12MB4397.namprd12.prod.outlook.com (2603:10b6:806:93::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Fri, 12 Feb 2021 18:01:00 +0000 Received: from SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451]) by SN1PR12MB2495.namprd12.prod.outlook.com ([fe80::319c:4e6a:99f1:e451%3]) with mapi id 15.20.3846.027; Fri, 12 Feb 2021 18:01:00 +0000 From: Shyam Sundar S K To: Tom Lendacky , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Cc: Sudheesh.Mavila@amd.com, Shyam Sundar S K , Sudheesh Mavila Subject: [PATCH 4/4] amd-xgbe: Fix network fluctuations when using 1G BELFUSE SFP Date: Fri, 12 Feb 2021 23:30:10 +0530 Message-Id: <20210212180010.221129-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> References: <20210212180010.221129-1-Shyam-sundar.S-k@amd.com> X-Originating-IP: [165.204.156.251] X-ClientProxiedBy: MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) To SN1PR12MB2495.namprd12.prod.outlook.com (2603:10b6:802:32::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from jatayu.amd.com (165.204.156.251) by MAXPR01CA0089.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:49::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Fri, 12 Feb 2021 18:00:57 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6d378727-f3c1-4b58-7ea2-08d8cf802784 X-MS-TrafficTypeDiagnostic: SA0PR12MB4397: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T3J6JpR81Qxy5rkGEZ7DvMBqQDz2MakSsAZ3a3vndiTWtyNr7Uc69jEO16/hBCRhkS6isvkKGXf0EmWfpDALxHaTTL04RP0gpGsdUNmoT67HmnlQ7B3ExpXEH3FEo9PFRjB6GzISMErv/YOHdeJXYEbxQ4RSOJw1CLOhybwFtRsApXI3+d0wvk0SQ5zlTxariM/Dybqkd8NHNu8TIf4uq5+Qi0T8igEfl2ytNlplxVg1WPMaEwnt6sAaBO77j8Bi6IFD3VyYE8k5jowxVqoujjfLS8oNAvuzq0EHyGbCSupjL/hLVQh9R162GKQxZyVfg6+pi82MnF715uM1glKIyKAF37co5SqJTGBnoX3fgyadArG/YH2Wy+8KvWBo/pSFE++stqsicY3F2rTOCKNZQCqseqTomGQamHDgFQHT1aYKuRQreiqRP571akqM3XVdDuhJZ+GIhoVluEizYduKqz3tE7vT2cNM+/evRldBmCobA2EVpzNOLJ9bfAo3r6s5YPC03SfMvOmXdOEHnIFjlw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN1PR12MB2495.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(346002)(376002)(136003)(396003)(366004)(5660300002)(8936002)(8676002)(52116002)(956004)(26005)(2616005)(7696005)(110136005)(6666004)(16526019)(478600001)(2906002)(66476007)(86362001)(6486002)(1076003)(186003)(316002)(66556008)(54906003)(36756003)(4326008)(66946007);DIR:OUT;SFP:1101; X-MS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VEqoSi6CGIo2r8t0aKNlyW4u3Z/a4pyM0fqwMO0vZCjVa14d1t3DFFl1DkAsFoOd6dVfmk3+KWUpQ9ycKK48b44I1akt0tsi/+dPBhoqa3yMWyBjBE5NE60WGrRFf9Eiz3b5aa2NolwB7DaGbatYKXK/KlkDnTZMzQ2iUDbo83O09w3Cx4i2TDziLoFA0X6G/neoS6FPSVXsEAGlIYgDDL1pczf6Rm1fChePzqW5eSDN37hP9VBuRV5mu/etzTb7cSn7fpj+tOpuiAeovTy9NQp2HrFKIod5tk8ha9z3i6oew X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d378727-f3c1-4b58-7ea2-08d8cf802784 X-MS-Exchange-CrossTenant-AuthSource: SN1PR12MB2495.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2021 18:01:00.2651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: e5bipoY0TQTi+M55XVQhaXg6KBo6vtUJaBbpeJmh7nVAgrQ0in6NtRrX/J5I2TP8JU14IIemPWJeBUR8dgFMzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4397 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Frequent link up/down events can happen when a Bel Fuse SFP part is connected to the amd-xgbe device. Try to avoid the frequent link issues by resetting the PHY as documented in Bel Fuse SFP datasheets. Signed-off-by: Sudheesh Mavila Signed-off-by: Shyam Sundar S K Acked-by: Tom Lendacky --- drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c index 1bb468ac9635..e328fd9bd294 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c @@ -922,6 +922,12 @@ static bool xgbe_phy_belfuse_phy_quirks(struct xgbe_prv_data *pdata) if ((phy_id & 0xfffffff0) != 0x03625d10) return false; + /* Reset PHY - wait for self-clearing reset bit to clear */ + reg = phy_read(phy_data->phydev, 0x00); + phy_write(phy_data->phydev, 0x00, reg | 0x8000); + read_poll_timeout(phy_read, reg, !(reg & 0x8000) || reg < 0, + 10000, 50000, true, phy_data->phydev, 0x0); + /* Disable RGMII mode */ phy_write(phy_data->phydev, 0x18, 0x7007); reg = phy_read(phy_data->phydev, 0x18);