From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EEB0BA034D; Mon, 10 Jan 2022 12:35:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2F5641169; Mon, 10 Jan 2022 12:35:38 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2076.outbound.protection.outlook.com [40.107.100.76]) by mails.dpdk.org (Postfix) with ESMTP id 1CA7E4114D for ; Mon, 10 Jan 2022 12:35:37 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iKMaBLWShbbjNlhwGc+cNz2z+2qnCIqg5PFBBXEhXJFl1VvPGihrtEhFTcRmGRM0IH4Qw5vcHMD3NwtCziXkO8GmM3ZeDIZsE9ACsjqy+Crb7pHC8Ig5+4dr5UU93ENwnhfbVMpvLKKp9EgFVXgs9dD0E6MVbWljFVbo5/3dVRKOEUN4fk/biI5/bEfZbkgcEbG4EbnOQGfbXLV4TsR2RufTSrWlroV3fmDPqWv0dkwT+SSRVNyA0wCvEFlfMTva1pKs83ArsuFdqDk8EP08nhN3DhZpLbSJeh+GXFK1/tGhme0ce8IChN51y9ChD4rbFLHsd8ubH/mJ7poG7nFSWg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U6SsUlebNCOLojVCc0nEF+szVML+gsOIhsQI0TJmZJE=; b=JwqnI7eaNnSj6MHKf8rWGpqFS4Nf6bc9mlkRN7HArbfOhDCkDl3s10KRSt2nYV3ZxMGumtQv1Esmw7X103u5TGBhj2Cx+3xQlrpnWA9N6qzI1IU24URSI01JeFJQ1j0VcgOJXv7NIRVuYRTLWyByENvRWCLsMuVEXUVvVEuJF9bbQkMkNbshH6aFa+t6rnbxTpXOMUhItJJHAXc9MEr4Zn+pAwQ1tlK80WJlX51a9L50Uj4bqmb//yDhZrD2Hz7VFQrfHSKQMzU+jw1za5IyjA3thbJb929JTs1QRNSj3tC0nalHSHOXoiBn9Ir7WAnbj0xwM9wwqfIGS10tkrF0hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=U6SsUlebNCOLojVCc0nEF+szVML+gsOIhsQI0TJmZJE=; b=4Qz397lnNHP02qMoa8pAec0OY3va7ySINgXK0mcg5L4R8Wa4n+VJgxfTuT3GdvQd1yfqDNHWLxtjcqm+jEh/MM9cOrEQEcMW40u9nF5x+n404sqhUKMWBqIgzPdEC3JegPlwFjMcD0buJLXr4zdxuz0JhSN/V9Dcqj7NP0S7c+k= Received: from MW4PR03CA0172.namprd03.prod.outlook.com (2603:10b6:303:8d::27) by MWHPR12MB1136.namprd12.prod.outlook.com (2603:10b6:300:f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11; Mon, 10 Jan 2022 11:35:34 +0000 Received: from CO1NAM11FT022.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::c0) by MW4PR03CA0172.outlook.office365.com (2603:10b6:303:8d::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.11 via Frontend Transport; Mon, 10 Jan 2022 11:35:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT022.mail.protection.outlook.com (10.13.175.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 11:35:34 +0000 Received: from cae-Lilac-RMB.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Mon, 10 Jan 2022 05:35:32 -0600 From: To: Subject: [PATCH v1 2/6] net/axgbe: toggle PLL settings during rate change Date: Mon, 10 Jan 2022 17:05:05 +0530 Message-ID: <20220110113509.553184-3-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220110113509.553184-1-ssebasti@amd.com> References: <20220110113509.553184-1-ssebasti@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0966755-0d01-42bc-84fc-08d9d42d50b9 X-MS-TrafficTypeDiagnostic: MWHPR12MB1136:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YgvZiU8uTYEm9TMEWQEFNDtWAUxNJFjkx5jKHc8AfeOSrrL0khrN0DP+vXcSpO9iVBVTxBiOYLQQT8VBrc58ocJaZh7FmEa0jb7XV/Bl8tQKN3Crx8JMMOZf01149jIBCjlFYm1WpTnBNvZJfLAMlnftHwm7wqk2U0Klc9bBfCVEqcPJbIvhz7Po/wetdFxXcPUQ5f8yQdHPwEhiTnCDOluCwv6CIpf0pMpJWq67+8PGS+6YjuE0gG8rA2HFPwbud7dsbRdQuNrtRWm18b4iCgE6n5NPPpifNJLxlvsTSNAKcUxtYTTXA4wHjB9WmswZ4abZ4fQG7Mg0uXOqdouyy5OsmVKMpx1qPiMrnN+pyfESvT5r9R10LlJh6vRiN0ELcq5/jsCZxYkex1t9VQ0/VLPWl42ylQUgvbMGsOkTS2oGpkWU+zp7nXDbP2g8oR2nh3/Wgox3sDVmtYakYY8GxOAYh9qBiYG2Iy0fiwE1uhQV8KKtNygKr330xKNblkGNatYi2FuJrP/vl8qPa7jwagBBZ2N9OzUpzriY0zm3Z3Vx9w61c37kVqW6QM68ztqcAjloQjdB4e3dFp3I6G3TnGeENLTPRBDjdO+f0aCexeFpyFEtLCnt62WLEow4sfymXABDl1DoZtL/sVjF9n4jDt1IkCLXIP0/Waw/wiKG8vZMiF6z/JvN1mpHrzLMxtOvZKKU2KtsUoPp+45HW7YsTZImHTyQjixOXcy6fZyjfdcHKqiAFhnBG5qB9MOoeiQNozxDcqoaVv3Y9ePs1BYEYXd/5YSem6aS4LSs9AfxNAQ= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(6666004)(26005)(2906002)(82310400004)(6916009)(426003)(336012)(186003)(5660300002)(356005)(1076003)(83380400001)(2616005)(70586007)(8936002)(70206006)(36860700001)(16526019)(36756003)(81166007)(47076005)(40460700001)(2876002)(316002)(7696005)(508600001)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2022 11:35:34.1025 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0966755-0d01-42bc-84fc-08d9d42d50b9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT022.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1136 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Selwin Sebastian For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete. Without the PLL control setting, the link up takes longer time in a fixed phy configuration. Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_common.h | 9 +++++++++ drivers/net/axgbe/axgbe_phy_impl.c | 22 ++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h index df0aa21a9b..5a7ac35b6a 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -1314,6 +1314,11 @@ #define MDIO_VEND2_PMA_CDR_CONTROL 0x8056 #endif +#ifndef MDIO_VEND2_PMA_MISC_CTRL0 +#define MDIO_VEND2_PMA_MISC_CTRL0 0x8090 +#endif + + #ifndef MDIO_CTRL1_SPEED1G #define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100) #endif @@ -1392,6 +1397,10 @@ static inline uint32_t high32_value(uint64_t addr) return (addr >> 32) & 0x0ffffffff; } +#define XGBE_PMA_PLL_CTRL_MASK BIT(15) +#define XGBE_PMA_PLL_CTRL_SET BIT(15) +#define XGBE_PMA_PLL_CTRL_CLEAR 0x0000 + /*END*/ /* Bit setting and getting macros diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 02236ec192..dc9489f0aa 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -1196,8 +1196,22 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_port *pdata) axgbe_phy_put_comm_ownership(pdata); } +static void axgbe_phy_pll_ctrl(struct axgbe_port *pdata, bool enable) +{ + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, + XGBE_PMA_PLL_CTRL_MASK, + enable ? XGBE_PMA_PLL_CTRL_SET + : XGBE_PMA_PLL_CTRL_CLEAR); + + /* Wait for command to complete */ + rte_delay_us(150); +} + static void axgbe_phy_start_ratechange(struct axgbe_port *pdata) { + /* Clear the PLL so that it helps in power down sequence */ + axgbe_phy_pll_ctrl(pdata, false); + /* Log if a previous command did not complete */ if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n"); @@ -1213,10 +1227,14 @@ static void axgbe_phy_complete_ratechange(struct axgbe_port *pdata) wait = AXGBE_RATECHANGE_COUNT; while (wait--) { if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) - return; - + goto reenable_pll; rte_delay_us(1500); } + +reenable_pll: + /* Re-enable the PLL control */ + axgbe_phy_pll_ctrl(pdata, true); + PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n"); } -- 2.25.1