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 35A98A0352; Tue, 25 Jan 2022 13:19:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 394BA426DF; Tue, 25 Jan 2022 13:19:40 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2060.outbound.protection.outlook.com [40.107.220.60]) by mails.dpdk.org (Postfix) with ESMTP id 1B107429A0 for ; Tue, 25 Jan 2022 13:19:38 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OFctedVR4/oI6srUvX6C7l5QpuVe6KZO2Gshwxadzk6yAbSmzCyqo05Oc25NMUWiRkx6Mv34wm+jFartxmlB0WzNw9Ks81Ncdj2YzGsVhIsw/cZiu3uu9bARykIULuwbM3YXZSTnL1fd4nuVXVxKS7WKKLH+xEEzC51qvX8m/6Tbu5JN/Ps5Lesfsbq8Rj8DiAmy/qmsKCZmSliniuCqJo8ZYLxWNee3QbxJWTXYwkRMpd0e4gdojqZUF5Q0c5BDJd+K7rY4tDLXZp2T5xbkXL+TVKryrY942TQM0IIorGm4MFaqPj5W5E5/uR8nYhBOAClo+ke2woS5eeDmWAJyGw== 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=r6p6ZCaGbynuImT6bwd9HhRAPPyZ+v6qhcudK8eoOJI=; b=KFgQe71QWcsxTqNu25D3opuMz0VgGdLdf96qErloacmezCvpp9hxGatfR7D+LeAHk8fuQoF/oAPExcrY7GenRFBcUbEz3Miw5SXQVA9KugqOAG6qE2pAV9+GO4qId/Iwe9TLXONP1fm29Zjh8cN5up6/TZH+iq6hpa0IvM9LixW70sy0qGKbrScrTzbp4xgGGPY/3rr6P1fSdWL+Q7tSKdzW7MQWPbxJ9l9WXXY1zeqzSNzD6w1dPU3kwoBW5cMVhjRi9gmnXNeu4SQam01/b0Q/N/H2dreGMFbihwBWZrZJObGrdJ/LS9UAB7BhfyUjsnJQkco4McAuLX1J4Fehtg== 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=r6p6ZCaGbynuImT6bwd9HhRAPPyZ+v6qhcudK8eoOJI=; b=Gs3ut1ag9ve/oQSEuoJdxKVAfTea4GBaaPfkCJHlsqFsQn+UBhQpohFXf/+tnGXpbkQGJ93MdoKa50tGCVb/e5sQIDg2o7QBJzA3kulgUmjiHqUiloOTcluN9b7qXNGPruM3vdmSR1KQhdH8aKNJVTEdBFQbKoar/IZOU+dCT0Y= Received: from BN9P222CA0016.NAMP222.PROD.OUTLOOK.COM (2603:10b6:408:10c::21) by BN6PR12MB1841.namprd12.prod.outlook.com (2603:10b6:404:103::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.14; Tue, 25 Jan 2022 12:19:35 +0000 Received: from BN8NAM11FT055.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10c:cafe::73) by BN9P222CA0016.outlook.office365.com (2603:10b6:408:10c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15 via Frontend Transport; Tue, 25 Jan 2022 12:19:35 +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 BN8NAM11FT055.mail.protection.outlook.com (10.13.177.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4909.7 via Frontend Transport; Tue, 25 Jan 2022 12:19:35 +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.18; Tue, 25 Jan 2022 06:19:33 -0600 From: To: Subject: [PATCH v2 2/6] net/axgbe: toggle PLL settings during rate change Date: Tue, 25 Jan 2022 17:47:43 +0530 Message-ID: <20220125121747.344631-3-ssebasti@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220125121747.344631-1-ssebasti@amd.com> References: <20220125121747.344631-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: 3fb3b8a7-e090-4f21-7191-08d9dffcf304 X-MS-TrafficTypeDiagnostic: BN6PR12MB1841: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: 4xrZ7VSB3NftOvnB3ms6FHddIyrkPWmJdlCGKNV2qKDkPLUGJN1oV8+IIMPAphCx4LRzfLgNf08XFu5EjKp1M/KbvsPsBH4yGcnSxQct97VjBXagSiSlRGroYfdNsTrroMfOPq55a5R0wlhlT8gCD+Dp8+7Ts84p9zMBVnfmU24G9bzJiuGGNwO1zspKPblfu8PN+6niRwlpu4iF6+hUjv4Z0tSyeZCG+01YU7K1j6xqDuhvjqOW+pi2SLS1eEublUjlJVXveXXvTO7oKjeWQTj5q22l0SvbHB1aJNvD3KL8HpRVF+MSdeHSgsxsTgqZfgs73RSDxZBFh+Rm+hWKJLlcRV3DrZj3RWQz0gBZCYsbTQNeb4qkRfVKyKvwfl8BRBfx+guhdO23JLkfO3AxwR3EXCUGXCqLh92okjknH+9NO1z4jXdNaz+ysUkBLI1BZeq/Kk88SEZn0dbT6BNvQ3fK0qgs1xBmC1V+uOS878v3ViZa1+Tnn6ATw/XjP77JHjrPzTC+V1eeZ6ibcCsHPCFwxn8ko2GVOPNyz7AeffJ8yNN99FK+PLliouQVxRVdvH8EErGSXtn70nSxtdgjL/aN957ckQfr/2E23SmlSkE2kV/EZ7sZ8YChli6Vd+FSAfGv9nUhW7LIIU7GkCwU10EEambTYrYLXgDOdpQ2Jr6IHMuYQGRbRyCtpVsFueDQYSxr0Ds+pBCOVhE0XG4zKEipU4ku1KTQBRhrsbmk7NAIcjvx20NgG3YEHIusdLryf+uCXci3OdJ4UFVshF6uHFg1yO35QRr5ekrRt/sYGss= 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)(46966006)(40470700004)(36840700001)(7696005)(2906002)(186003)(47076005)(36860700001)(81166007)(8676002)(1076003)(16526019)(82310400004)(2876002)(316002)(356005)(26005)(40460700003)(508600001)(336012)(5660300002)(70206006)(6916009)(70586007)(36756003)(6666004)(2616005)(426003)(83380400001)(8936002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2022 12:19:35.1074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3fb3b8a7-e090-4f21-7191-08d9dffcf304 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: BN8NAM11FT055.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1841 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 72104f8a3f..08d3484a11 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