From patchwork Tue Jan 14 16:47:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13938970 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2065.outbound.protection.outlook.com [40.107.247.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B66C23245F; Tue, 14 Jan 2025 16:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.247.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873268; cv=fail; b=N88HTPPu1SV4bMRPsnnhAeOhSHkKXbVUZfJ+hRvkj6/Br6GRn9WOMpsdFTaPIeRfGVOcidyG0seXtztRxHVzLFFu+BXgBQK6P3+VqIfrUoRi98y34NhztdsUdb7B76aRrqa+GlnHKIuBkBv3n1BF6mXSOLpyWk2ol342GfssKAo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736873268; c=relaxed/simple; bh=Ideg3GKQTxywHaEATnmJXotK3Xmb1PJ/b3FEHkW56w8=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=hAO9hv+q0vmeELpyWn+YL9yvKY9JYcFX4Iz9mf9LYkwEaXK/xX2zRCjvijPMhbf8Jf97ZnDJMWQGl5kFkz6VP4myr4HlzQ6gfpv3plpOmHJfdUQSj8/OrROVRzCWBrOZtpbcQRN57vMNqckk1uJV30kZJhxAqXxSctuIKjvBLYw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=O4yKsZo3; arc=fail smtp.client-ip=40.107.247.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="O4yKsZo3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mhoMz42c33++G6nnqsGIopuwgFF4nWVyHJGQym+omCyYOKWbHFvIEUn0WDkm48cg5DDl3epZ5+4/DdL6jGtfGcbRc7qzMYA6Vl0UPuwoxx3xnc7UvZfSFvjfto7Q9PGe9i241uwHZgBoK3JKAy7e+GEBTGvhlPh+MylCNfdT9Q5jqSFiaZV3cvU31uqscdBcuZ4YMrz+JeF97AxpaR5kS96s/Ocuzb2um6ksYwk1U4qY86Qj8n2sckQesGoGTlAO9h8CxIxhAyACTYEk2/KWlGi6YKrE56ORWiUPsgbcuIXOmugGvGnrOMKYvRZmQgAdpeztELQK5Kze6tnLjOjuZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=RcETxrsdQZdZmRlN8+aEk5wgm4Y7acius+plmrO5lQw=; b=LVKR9MDZWJ+K/ZvUZghsYIPoey8dtuzHOAGo6/66PfS6T7oDNpG4UEPAUaIK+Kh4f8JpRT6B0rc/wwmIlA7+iJTpIZtpr9lWLddyjQIWbPFKi4jas9kDlQpRgzQ5Knr6zeizF2fVms/4fVcPODYnL7ks3zFTMk3JgjObaUF456xX20n7zepdv2G3k44kNiMZGhFtwaNf5HMnccb++4AlIwDIdYSsM6diMVtK6dakZe/+yNwWRyFVoKqXl75hZkJvqO2t046R9ac/zZrtIryBoJjb6Mc2JGX5vrNMOXiU1cLIkKDvxUKt3JIbbpQDLBTJ1b2qQbE8kVfjqSxajBJT9A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RcETxrsdQZdZmRlN8+aEk5wgm4Y7acius+plmrO5lQw=; b=O4yKsZo3f1r9aWbHngosrl/mFy3MNlqvYlXGgYs+n3M71uE67k3/4zjGqDr6rI80pQw8O5QsYdIEx5sOxYZtiJlGXslnZBH/BIpmBFJo2te5k4TVcDbvEYJO2O9xEHySiLhn1VZ+ui3h1jDRtGPIHxmGcqlnQvb+Tc4CSRnUWnsXOUf6UX/w5kBCtQqIX9U4cjGWVEmnxMwkmQX08ofWmtN1uOpVFNduwp+AEpLtM3B0itrbUC4RDBctMbscbiQ3BGqhhc1NILfi65Ju8fND+nV6q4e6R/XqwzJrpx6/CxYTeKyyp1Yc7pSkRSlK4m3h/IWqfgjS7e2Kff2EXkHmFA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by AS8PR04MB9205.eurprd04.prod.outlook.com (2603:10a6:20b:44c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.18; Tue, 14 Jan 2025 16:47:44 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8356.010; Tue, 14 Jan 2025 16:47:43 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Russell King (Oracle)" , Voon Weifeng , Michael Sit Wei Hong , linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: pcs: xpcs: fix DW_VR_MII_DIG_CTRL1_2G5_EN bit being set for 1G SGMII w/o inband Date: Tue, 14 Jan 2025 18:47:20 +0200 Message-Id: <20250114164721.2879380-1-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: AM4PR07CA0024.eurprd07.prod.outlook.com (2603:10a6:205:1::37) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8PR04MB7779:EE_|AS8PR04MB9205:EE_ X-MS-Office365-Filtering-Correlation-Id: edbb0d00-6899-4472-d69e-08dd34bb2ab0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: u5HCRXBWAJUWularQt1QwXHSt0hQX7uQZVzQhC2BUblOwvH0qZ4u7qfAwHNuk7aYYUFzvadSGAbEGg2K/RQkoegQ63yuphYQEifuQz2P37AkyGxhRwjV79u9JAUfE0dkzR+jY3tZJJjSiaqYRjaXpfTfVdEuW50Tqd5nb8w7iyeCI4Y+zKKbjLOwUJN+rDUl6EWC8cUsxQ0dcqJk0KTNtK7VsLdNJu8N55X6PFYmMRrTbdBkmBG0gOFb96MspGQqgfm79T84keXxyp6uKpVRSH5g9NPcPT6WuSwu7KgCAJc8O69c6fEi6psKT6vmqXuplanX52Tk0Zei1PsJkl2VxxDbvJJjsl+huQz5E3G3t0dktXR7CWRXa/R2837ENMDC9J5o4cJ2kUk4H0v6dOn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Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W1uqR3GJDP8Or0wT7EfY8XlCBHIKY3vMDQOHEFMkf6rY52BspsM/9i3zSL62kIDBmnDh8xHNiLqzgzmmxUV4PV1QKVFaBjHRshBidoxr0gFB8lidRoSHaFXAsBhnWBgue+k0patFLK79HdJQrpzHwbaW0ktrexBEoUS+sLY/Qa+ZZV5U45IDBLd2CJbckDQnKtRl0/UfTIm54UaHEnCm0u6InbKXTNPLshwy0rrGRp0JRBJyx5N1d778LmMA1hQNYRQyaekoy/EYawJyVMN8l83qrzATVLTtAOKUcWiQoq93PpCj5+riLC/2J1CeLDS+MemmLuDaUW6zwke4vSpCtAK8SUBs7KA+O/Lclb9gCKFpL4gtNf3oohZZFifwIb8OfeDMzwakCQpKBoxW1mDb4K9/vqoessnHM++RKr2NWP2bDI4vz2STxcI6L2sFryoUbAmnTKRn09ylwoa+rcLh6aNoAttoT/d0M7rMwxx17yDDXHa0rMePwXQ+cdth2moAL2Qtab+wEtz3+39KHyRzWQMa78nT3SOsieXucNZMHcYkONbO5V67kKWGGsw7TvF2QIp7xtDjiPbBOrQnPcY4LbGOcXs4Io/wBeeOgEdUT/XUFD+rtC2ozJATHtqfL/I8wUCcsjYvWJAA7ug3V2flSYpM/f92bSDg4L8f2EGRnsL9P6L1l0Jv73oIcpoQbLg0UqzoePgEg9Dmp3CShw8IDtzxdw1zEy1neC8Vg+PmqG8ld5fpxqqgUmgEQkZCE7azWPdi0yA/IPFK9Rm9dHZcF3snhWIzR0XIFaaXovLGohXYWjjBbBzBFjKFB/52S7ezUpfThN/XBy0bg0yUgAxv7XdeSW5MFZKKb38nHr3eqaactywYc8s2XSvrB3IhYXE2qzAL3j4fLY6W9Qc827AlB7HnhtM2Ird/XHij8vBkmG7mSDYHWvHhRizKlYBX6q6H5jINWZ59Ss5g4Mg81/kcSGFDaY316svFWusewtSXavn3SgWH4wdRkbMGBUEWEwTIezOdR4i3I8t6WAqouC3UWnIgx/ZVslSM6GfU5mWJ2bx/OKONKNGVzisQEJQh0s3f8CAFoOg4X7iuzp0xFdaFpkjkGDN/WcoAfE5iUMCnU+EZyANmEU+C7hSfTfJbtFGvuZr15+9NkHyNASk1N55IxzWN6fwYrg+nmam+toZOUnRDYSDx2hs/eA+8B7bQM+gZVtOW10JC1zNhtFFhyGLKNnMvZxpwSqJ8T3XtcZ+iBGFrrzADlP6ZQw+Blkm+COuYZ7sDN3yKts6gxbZrnXPocLEuJuSUFiZ+Uhw+yuTTEm50MyEzUYLyiMbbM81JkguhZvAvEb66v4shBhKlcE95yGOosoeTDOb9LVvnONtYwMgzvlhRi9lr3WQGhtevLsF2SeWZGiLax7Z1BsRm7Xnp5eKrblY0Tjpcsve9BFn8qN2po0g4Sfv7MCTVnlJatqZG896aOO21yIs3OJhj9BA6PDDES67KJP0l3+nyD8Aarz3BSihELDDYhnPYw6wzJu2LqucfQX7UcNCE9d+BqxpdbDLbBJO3lDPqFM4It/Z5VgfkdOJSZLhyWG8vVhsld5cnd+3s+VWsdxuO8uFB/28o6g== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: edbb0d00-6899-4472-d69e-08dd34bb2ab0 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jan 2025 16:47:43.9006 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o5GA3wnKgf3zf1acsM/D6tDl1mjzF2YhuQzyaaq0X2NUojpIUBuLD2RnH0SAZjevUc2Qz4s/WfRPDGQx3wWBpA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9205 X-Patchwork-Delegate: kuba@kernel.org On a port with SGMII fixed-link at SPEED_1000, DW_VR_MII_DIG_CTRL1 gets set to 0x2404. This is incorrect, because bit 2 (DW_VR_MII_DIG_CTRL1_2G5_EN) is set. It comes from the previous write to DW_VR_MII_AN_CTRL, because the "val" variable is reused and is dirty. Actually, its value is 0x4, aka FIELD_PREP(DW_VR_MII_PCS_MODE_MASK, DW_VR_MII_PCS_MODE_C37_SGMII). Resolve the issue by clearing "val" to 0 when writing to a new register. After the fix, the register value is 0x2400. Prior to the blamed commit, when the read-modify-write was open-coded, the code saved the content of the DW_VR_MII_DIG_CTRL1 register in the "ret" variable. Fixes: ce8d6081fcf4 ("net: pcs: xpcs: add _modify() accessors") Signed-off-by: Vladimir Oltean Reviewed-by: Maxime Chevallier Reviewed-by: Russell King (Oracle) --- drivers/net/pcs/pcs-xpcs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index e270a75a988c..3de0a25a1eca 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -728,6 +728,7 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *xpcs, if (ret < 0) return ret; + val = 0; mask = DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW; if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) val = DW_VR_MII_DIG_CTRL1_MAC_AUTO_SW;