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 A276B44153; Tue, 4 Jun 2024 14:14:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0778943701; Tue, 4 Jun 2024 14:13:35 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by mails.dpdk.org (Postfix) with ESMTP id 5C0D24356B for ; Tue, 4 Jun 2024 14:13:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aTh98//sw9jvzjOsdVqNYHgxkgRsbuRQ6z8+JfSpY/3PMdkjjZW/rF3P0O0MrgMqJQR5xlv8R6jYwGbkHWjHBr8T8BK2XlK8FXmi765ul2PtsDWxnfVMT6TeNoxEkWMpEC6kyZRoEqcSdNsp7NQI+On3gzmNKhqJVXivLQa0CYygazJIlR8NtTIBGnvU67UJ/+jLD5oIoXnXgsj9Oy+zfMZLwTNLsc8ghQNheO3d9UgCBXlNGxpgfulY7qgzfk/dA3CsZAyosKkpWAl6tGG81OKE0E85WfVNwXGZOvAZlpBM6ZWYfKNyyQvOGMFeDlgYqEzBDSBfI6SdXmMl8bHEKA== 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=L7yW5bkH2KN0MvznMAnv1YDy50IGddhq09SgjqcnwVc=; b=KGMAenrrm6kqi3jSIYYuSxUiww7IDQMwGqjz15G540uLPNFWxBCaRCtTnChm2Enu51UlmqgmUwY/2/jn84olquZzTGApelUJ318xny69uBbmnT2P8C5j2cFIR990ZZ1z7NepggpqkV2h/He6c+uIxJYJ47ocim8SC4RXaLQvchVYvXdC04O7XNXw7oMbmEWeruu4/5hRkOzY4HqlBm2RjhQRCD7epzO0qQohYFjC7ziaEZ8w4IYIdrmqp1IRh3zTrae6UedG45Xe6i4F52V1dKPsYu31kdfGeWHY9R7sa+nERLoa0tCZ2aAkQYPjMWaLYhztxJW1MFT/YihsADklsQ== 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=L7yW5bkH2KN0MvznMAnv1YDy50IGddhq09SgjqcnwVc=; b=T2qtfIv27PZzNIQmJ2G8cCuK/efXUV+XmD4dxqnSQil09LPfUWqlNWBrpnEtmLgy1p0bik+//cYr7JYTEqBAsFd4hqYvAw5VNCj8rItAKgUyO6CYYWTzIzPmTP1Jaqv3yg4flKgqSYcIH67Qq018IlzoOGPq3rYogYOc97CLUsE= Received: from MN2PR18CA0024.namprd18.prod.outlook.com (2603:10b6:208:23c::29) by PH0PR12MB8005.namprd12.prod.outlook.com (2603:10b6:510:26c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Tue, 4 Jun 2024 12:13:26 +0000 Received: from BN3PEPF0000B372.namprd21.prod.outlook.com (2603:10b6:208:23c:cafe::46) by MN2PR18CA0024.outlook.office365.com (2603:10b6:208:23c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Tue, 4 Jun 2024 12:13:25 +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 BN3PEPF0000B372.mail.protection.outlook.com (10.167.243.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Tue, 4 Jun 2024 12:13:25 +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, 4 Jun 2024 07:13:23 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Selwin Sebastian Subject: [PATCH v3 20/25] net/axgbe: separate C22 and C45 transactions Date: Tue, 4 Jun 2024 17:41:52 +0530 Message-ID: <20240604121157.3052-20-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604121157.3052-1-venkatkumar.ande@amd.com> References: <20240507124305.2318-1-VenkatKumar.Ande@amd.com> <20240604121157.3052-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: BN3PEPF0000B372:EE_|PH0PR12MB8005:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c34230e-2bee-495b-93fb-08dc848fbc56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tXwpICq15BfpUzkoolS7UGkPdY2ob5eoGUMZ8XP9K8ImxFXeemEZ8qdKogoH?= =?us-ascii?Q?1n2cRoT+NrdkS2hhPbqqnFogTta2NAXOnSdi/mF/n70ocfgdHPrL9SlSxMjb?= =?us-ascii?Q?Hs71pQCeM1JYKbavV+Hjbu2ed7uq33UEGAmfIiKWpA28IPAv9TI+ZpYMRuHv?= =?us-ascii?Q?vzziyI7fCUmCDuiR37lfd7USfvcB79NdKKIGuVkfSr4GUDmMV6BdwOfOrzVN?= =?us-ascii?Q?LoNL450S6TuNSw7oJPvjohfQY/S55E6sN8YnlDYoWAUKo51qQ6d/PGfL39ck?= =?us-ascii?Q?yR4ObAm7vbaAXzPiz3XgRrMt1NUeR9jXrDP4dU8ZvmTY9U3VKIpU0ef9dlY+?= =?us-ascii?Q?JuO7PjCYhqVsXEvo08cNxhtRcY7PM8vq7iAUX00YCGfhXA0hG8H8BvxfQKpB?= =?us-ascii?Q?uthImfYarsfKw16siMQIO40LpPCBwq33Fd190Z6P1nYpoEgvzIzR7IFAPcwq?= =?us-ascii?Q?rricYajoYxqMOoB2ieAq3cNceD4vAAA5GxYKKlN7PoCsGVpeQqtsKrQBPfYY?= =?us-ascii?Q?AHJAyTf21/TMisalr6eoKxXHXlEc6lMzjgFJod19YO1luHR570oV3BVS0TVq?= =?us-ascii?Q?sr1YuvS9lBxF+TRGxZYg0WE6gsPnX5QibjwGUn8kGHK1UUCIFXcmyJLn4LJg?= =?us-ascii?Q?ZTEcljJnqHyaEruJzkLBtUFGHlwLcOyaSTFYyD6DdEEQwam6Os0mZBUF2qLA?= =?us-ascii?Q?QhOlylIqOsoPrxQ82/65PYSOAw+uT57l1+2NZ3RpZcuUM+Gn66IWbxvc30Ud?= =?us-ascii?Q?rsis6UkgecOTOWmCXIE+s7kmqxnYPl3SpMUyYuA5TBTh8aDn8MCO1F4vg3ga?= =?us-ascii?Q?NwwinLvKDpIT81CDvWq5OFw/D0fjvk8I/KIq/d1CNgkOij3bc5sa8lR8Y0eC?= =?us-ascii?Q?sIJh7z9nlSnDTCE0Ka3DeGP35kum1xmG80DDR7LVnydsnAHy9dmzzvbVycv0?= =?us-ascii?Q?dIEob2zFFZceMXL1fD7f63xxl3Xl4BEbe3LgtDC5e5QZKhPjmas6wMtSnZv2?= =?us-ascii?Q?7d9+ql1Ey/TLjQPBRjhd2egZtM4W/DUFSoEvwtXmbiUcEeOZB+BlTspNqJZR?= =?us-ascii?Q?9hlZgx5qwyklukDX6f7QzNVYlSgP113M0W8myJWmV4cNoAY4/8B/02NuSrcm?= =?us-ascii?Q?3qWtkGGGmF8u2V01MGPFJEhmEudwleSyEDf/d4rU+iPDIyl0O71N2+7mBLFl?= =?us-ascii?Q?DEHms8PLJh4iexo+KZWF3W3chet/SuDXPHVECJMdHGorYT5XWDsFw9eKexzS?= =?us-ascii?Q?v0nmNm6fDcw1hAa3/uiL85Ugnh3C2s7vK4JqC82Eg1b+DuIV9ywql0EanyHq?= =?us-ascii?Q?gp791oLICqP0obuRv/wP/3VSNW4fOr+W1zdhEfUfyQBIPTL5y1DX4OXjD6PV?= =?us-ascii?Q?0ntjn+HEXIlNocpIzCVqdzuIF2dEfpyNHunKR9vhQk1kni/dwg=3D=3D?= 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)(376005)(36860700004)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:13:25.4279 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c34230e-2bee-495b-93fb-08dc848fbc56 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: BN3PEPF0000B372.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8005 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: Venkat Kumar Ande 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 Acked-by: Selwin Sebastian --- 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 5ba7217320..1f45e955c4 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