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 80E7043FC9; Tue, 7 May 2024 14:45:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0863443400; Tue, 7 May 2024 14:44:33 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2084.outbound.protection.outlook.com [40.107.244.84]) by mails.dpdk.org (Postfix) with ESMTP id 10FF6433FA for ; Tue, 7 May 2024 14:44:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fw6HKrkTVX9JDjvyaxwlFhSWMTXCgdnq/fpq6keut6MYEz8hBqO0GUnNmweqHTTkNClVoV2mSJwvnBYYvZQtoShGMD0iEriYqi0OOUd9EpiNck2FLZbzv4HhfWoZRbJz7QhRitEgkaGzkNjxo+p2SkM7LRJ4sT4GgaMf6dPfmhY713u0tHnfqP55W7cXGYxT5KuYxBnpXLTbfEqOuevaCdAJB5Z6wiW0KyZedO8Vfjgdrj+QijAiD5cSh1kHinenLc1YCJnTgZyK0Yx1B2NCUBPkcnTfja2T3QwLoMehtp1PCdgBA4SA9U3R6TVTZA6ycibVndePgQdMRvJYbK8uzg== 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=AvDa/CC1Z+qxaOzGe5oCjCZFYYT+3KPhUBEhDSHp4sE=; b=G0zsZkzrpwGzDHqrupWtjVeibvAtA8tnY7R4+yv3QjOBUX9OHqFJDQ1/nJQDrRJ1RFIdQSHsJDebHimD+rGD1xkFm4s7m0nDpyHh5acENtXTxF07ZFXIT6WRFWBN6iM9xdd72EPzD5UflOYlSFSZqhChKY9Z3BV6pWaABB1RLvWEfn6ZRaSwHqnmA+Z5W7RdsVxce2Zs7xKL315QwSSXxRll76EtLQEpHSdt273vjAmvjUfY2xTPWdZDrtcHGWKwWKgmoQpNG04ABfPFthMgOUZkfEr6i1pfc86GnkoivjYVtx2+b+YJy1kTxM6fGNSGSYA6jmx6eZPRV68BUhEL+g== 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 (0) 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=AvDa/CC1Z+qxaOzGe5oCjCZFYYT+3KPhUBEhDSHp4sE=; b=HEjFmCDqD0f1YXchtia9f7CO6zUCG6cGWf+McTgsy8ZGCIavLgL8nobabwuXRmHBthf7xz/w9M1sbylCI0aka1nuJWrp/DIFuuqVhj9HSS3NhxbKA9lwCfy3IjrBkfziYzxLbV0SPNW1shT8gWQuckEtUzeQFNb6Nlmrm/BbVuU= Received: from PR2P264CA0014.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::26) by SN7PR12MB6690.namprd12.prod.outlook.com (2603:10b6:806:272::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 12:44:28 +0000 Received: from SN1PEPF00036F42.namprd05.prod.outlook.com (2603:10a6:101:0:cafe::be) by PR2P264CA0014.outlook.office365.com (2603:10a6:101::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41 via Frontend Transport; Tue, 7 May 2024 12:44:26 +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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00036F42.mail.protection.outlook.com (10.167.248.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 7 May 2024 12:44:26 +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.2507.35; Tue, 7 May 2024 07:44:18 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande Subject: [PATCH v2 19/25] net/axgbe: separate C22 and C45 transactions Date: Tue, 7 May 2024 18:12:59 +0530 Message-ID: <20240507124305.2318-19-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240507124305.2318-1-venkatkumar.ande@amd.com> References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@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-TrafficTypeDiagnostic: SN1PEPF00036F42:EE_|SN7PR12MB6690:EE_ X-MS-Office365-Filtering-Correlation-Id: 78e3a9cc-c2c8-49e7-f550-08dc6e936e18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3nUZcmsLlqEk+UzMkX9Gh+0BrAwTowbzIDcFcQ0ZF61gI8/WJFy6WmP0l1ap?= =?us-ascii?Q?z8LURkI6CSrP8/pzxO8RzDfeOLZH2I3rQRzE+ZtBYqTRrziyRD92Ma4GpdTg?= =?us-ascii?Q?qdiRCdKStRbzm7Zz2Z6VQpAxv+K/qY4/6FDO5/bLigRuv5fby/kANaGtEjZc?= =?us-ascii?Q?hPnDZw0CSl0GsJxFovfpg/Wn62t9P8Gvz2B4C+82h5pWvpwroGwSsqaD/fF+?= =?us-ascii?Q?fvypW+lNkszSIn3fNRrXClCGiTAfGqNo9x79t4RnncBJ7AS5iSW/47bWhhUK?= =?us-ascii?Q?jSiwo3ZJJ6FRKMgKqCp5zuYs65+b05hgwB2hhKQkwFOh6iFUc1/yR4Mm+HrC?= =?us-ascii?Q?Vd91fceyHqH6x/uhTZE4EdcXmkQBbXLuYgkF8LRoRlPwTGawcY361JjHm9cV?= =?us-ascii?Q?osesiH3nF1G7fmtal0kCQgl84IL8luz7kM7eHEQRE9USEvadReTccbJlpJ3r?= =?us-ascii?Q?x2VShfsQRjwFBVyspkHdjDOZNm8g0/EPvnEdsMMYKUyOiFFwIkxPsNObo+us?= =?us-ascii?Q?sOoS+DwudrIJDstxxwLSrPLpHdnnFZZSsicHaHsqBZxWvf1LAxztm5FhuuDP?= =?us-ascii?Q?o1GdN5bdIKYfipF89Y5kJtN2yWIFNTnvwI7g3M+3+TbIdva9IzUmgFvufqdV?= =?us-ascii?Q?5kRyFkvWIQXhvGjtB4PS/FY9dw/qFNYVo3XRuzXrgx5UpyJ7MQu3twQ8aHDt?= =?us-ascii?Q?zr5wdQbuzI0dmKwyZNUGWSh1nWpiHASOu52qP8iD1AF9RKmDvweglyP0mNSi?= =?us-ascii?Q?sXG40N4/cBVIwPVfYiLYMg5lMJijEGOrjZGzNbdAX661mb/nVDhGQfT/C3l8?= =?us-ascii?Q?IxSBO25PE37qiJaE2NtdjJDhB/tmlCA5qgTe7nHF31S3G31zMSxIU4GGzyum?= =?us-ascii?Q?0tWiTqHCiyrsfeo/0Qka2o3Xs7awBybXecEWq8STKCz4E2PY3q7FQs5CO1Xb?= =?us-ascii?Q?fbKh0nZ3aVtx2wAK2XnZCdJSYc9sGc27cM2YGRsPG6PAwX8wLlzJvc6YuJjC?= =?us-ascii?Q?VJCnfVcnJZ3rCiR1ahAcS3/gZwTzXgJM58cfFWkNmBgUd67jOK032ayg2Zg3?= =?us-ascii?Q?U/IoE6Yy5KDcpwkC80xIx7ShmUytu4ns4ksxVyQkb3/Ul9etkKP58ZVvsT4B?= =?us-ascii?Q?rX/FbrLJLy5yHQF1+33CDMp6ovs2vo8I6X7oEG+rpYaztfaZzajEO6JNk4C5?= =?us-ascii?Q?iai4R0GKATvo6TbZRgCZQYKccv25jjFFCY39M4c66qHOywBq1Mei1t8Rb8pl?= =?us-ascii?Q?fzVDt46blqpLWFmq7A8enQl4j++mzmoPvVExvC7e6fH70HITval4TgrVY7DB?= =?us-ascii?Q?xrYsieYlH8r90Qhf+QxO5iW1NPRtTk5L6JUG/z7XfDFs65sL53Q/O6r74ORN?= =?us-ascii?Q?XK5/UGs7cbzzmb5oWp3pHYfQpm91?= 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:(13230031)(36860700004)(376005)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 12:44:26.5363 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78e3a9cc-c2c8-49e7-f550-08dc6e936e18 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: SN1PEPF00036F42.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6690 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 The xgbe MDIO bus driver can perform both C22 and C45 transfers, when using its MDIO bus hardware. The SFP I2C mdio bus driver only supports C22. Create separate functions for each and register the C45 versions using the new API calls where appropriate. Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_dev.c | 77 +++++++++++++++++++++++++----- drivers/net/axgbe/axgbe_ethdev.h | 7 ++- drivers/net/axgbe/axgbe_phy_impl.c | 4 +- 3 files changed, 71 insertions(+), 17 deletions(-) diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 6b413160c2..fa7324efa7 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -63,11 +63,20 @@ static int mdio_complete(struct axgbe_port *pdata) return 0; } -static unsigned int axgbe_create_mdio_sca(int port, int reg) +static unsigned int axgbe_create_mdio_sca_c22(int port, int reg) { - unsigned int mdio_sca, da; + unsigned int mdio_sca; - da = (reg & MII_ADDR_C45) ? reg >> 16 : 0; + mdio_sca = 0; + AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); + AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, PA, port); + + return mdio_sca; +} + +static unsigned int axgbe_create_mdio_sca_c45(int port, unsigned int da, int reg) +{ + unsigned int mdio_sca; mdio_sca = 0; AXGMAC_SET_BITS(mdio_sca, MAC_MDIOSCAR, RA, reg); @@ -77,13 +86,12 @@ static unsigned int axgbe_create_mdio_sca(int port, int reg) return mdio_sca; } -static int axgbe_write_ext_mii_regs(struct axgbe_port *pdata, int addr, - int reg, u16 val) +static int axgbe_write_ext_mii_regs(struct axgbe_port *pdata, + unsigned int mdio_sca, u16 val) { - unsigned int mdio_sca, mdio_sccd; + unsigned int mdio_sccd; uint64_t timeout; - mdio_sca = axgbe_create_mdio_sca(addr, reg); AXGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); mdio_sccd = 0; @@ -103,13 +111,34 @@ static int axgbe_write_ext_mii_regs(struct axgbe_port *pdata, int addr, return -ETIMEDOUT; } -static int axgbe_read_ext_mii_regs(struct axgbe_port *pdata, int addr, - int reg) + +static int axgbe_write_ext_mii_regs_c22(struct axgbe_port *pdata, + int addr, int reg, u16 val) +{ + unsigned int mdio_sca; + + mdio_sca = axgbe_create_mdio_sca_c22(addr, reg); + + return axgbe_write_ext_mii_regs(pdata, mdio_sca, val); +} + +static int axgbe_write_ext_mii_regs_c45(struct axgbe_port *pdata, + int addr, int devad, int reg, u16 val) { - unsigned int mdio_sca, mdio_sccd; + unsigned int mdio_sca; + + mdio_sca = axgbe_create_mdio_sca_c45(addr, devad, reg); + + return axgbe_write_ext_mii_regs(pdata, mdio_sca, val); +} + + +static int axgbe_read_ext_mii_regs(struct axgbe_port *pdata, + unsigned int mdio_sca) +{ + unsigned int mdio_sccd; uint64_t timeout; - mdio_sca = axgbe_create_mdio_sca(addr, reg); AXGMAC_IOWRITE(pdata, MAC_MDIOSCAR, mdio_sca); mdio_sccd = 0; @@ -132,6 +161,25 @@ static int axgbe_read_ext_mii_regs(struct axgbe_port *pdata, int addr, return AXGMAC_IOREAD_BITS(pdata, MAC_MDIOSCCDR, DATA); } +static int axgbe_read_ext_mii_regs_c22(struct axgbe_port *pdata, int addr, int reg) +{ + unsigned int mdio_sca; + + mdio_sca = axgbe_create_mdio_sca_c22(addr, reg); + + return axgbe_read_ext_mii_regs(pdata, mdio_sca); +} + +static int axgbe_read_ext_mii_regs_c45(struct axgbe_port *pdata, int addr, + int devad, int reg) +{ + unsigned int mdio_sca; + + mdio_sca = axgbe_create_mdio_sca_c45(addr, devad, reg); + + return axgbe_read_ext_mii_regs(pdata, mdio_sca); +} + static int axgbe_set_ext_mii_mode(struct axgbe_port *pdata, unsigned int port, enum axgbe_mdio_mode mode) { @@ -1373,8 +1421,11 @@ void axgbe_init_function_ptrs_dev(struct axgbe_hw_if *hw_if) hw_if->set_speed = axgbe_set_speed; hw_if->set_ext_mii_mode = axgbe_set_ext_mii_mode; - hw_if->read_ext_mii_regs = axgbe_read_ext_mii_regs; - hw_if->write_ext_mii_regs = axgbe_write_ext_mii_regs; + hw_if->read_ext_mii_regs_c22 = axgbe_read_ext_mii_regs_c22; + hw_if->write_ext_mii_regs_c22 = axgbe_write_ext_mii_regs_c22; + hw_if->read_ext_mii_regs_c45 = axgbe_read_ext_mii_regs_c45; + hw_if->write_ext_mii_regs_c45 = axgbe_write_ext_mii_regs_c45; + /* For FLOW ctrl */ hw_if->config_tx_flow_control = axgbe_config_tx_flow_control; hw_if->config_rx_flow_control = axgbe_config_rx_flow_control; diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index 4dcbf6d9a2..cb3df47a63 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -325,8 +325,11 @@ struct axgbe_hw_if { int (*set_ext_mii_mode)(struct axgbe_port *, unsigned int, enum axgbe_mdio_mode); - int (*read_ext_mii_regs)(struct axgbe_port *, int, int); - int (*write_ext_mii_regs)(struct axgbe_port *, int, int, uint16_t); + int (*read_ext_mii_regs_c22)(struct axgbe_port *pdata, int addr, int reg); + int (*write_ext_mii_regs_c22)(struct axgbe_port *pdata, int addr, int reg, uint16_t val); + int (*read_ext_mii_regs_c45)(struct axgbe_port *pdata, int addr, int devad, int reg); + int (*write_ext_mii_regs_c45)(struct axgbe_port *pdata, int addr, int devad, + int reg, uint16_t val); /* For FLOW ctrl */ int (*config_tx_flow_control)(struct axgbe_port *); diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 9c2c411b4f..d173545e83 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -1148,8 +1148,8 @@ static int axgbe_phy_set_redrv_mode_mdio(struct axgbe_port *pdata, redrv_reg = AXGBE_PHY_REDRV_MODE_REG + (phy_data->redrv_lane * 0x1000); redrv_val = (u16)mode; - return pdata->hw_if.write_ext_mii_regs(pdata, phy_data->redrv_addr, - redrv_reg, redrv_val); + return pdata->hw_if.write_ext_mii_regs_c22(pdata, + phy_data->redrv_addr, redrv_reg, redrv_val); } static int axgbe_phy_set_redrv_mode_i2c(struct axgbe_port *pdata, -- 2.34.1