From patchwork Sat Feb 3 13:11:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Pambor X-Patchwork-Id: 196304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp1018264dyc; Sat, 3 Feb 2024 05:31:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiMIyTLYsTivdQnUS7uAEimxbzzxjyFIhtTsVC7PB+l19efTL+kCnUJiYsP6tw/oNdt/yz X-Received: by 2002:a50:f696:0:b0:560:2acf:5846 with SMTP id d22-20020a50f696000000b005602acf5846mr984024edn.19.1706967095763; Sat, 03 Feb 2024 05:31:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706967095; cv=pass; d=google.com; s=arc-20160816; b=T9mciRR6EXGY6s29gXA7rAvNZ3qkHi+ZjUYT4V1LKy2cx4QIWERT5mQnSggSWFLz5T mNyOC+81eSs+ArUs7elRFZwT+IFBsoHXp1YfncOS0dddnuQNQcS3cGgm3LWGXTXH0UhT 0EYaPtGvaiOzDEeabSkt84NUm82zORJZXMDeXKvyY3m70zjfph94FH00iJi8JfiV4mnP +vXlo1ZrrdLs5tevDa/aJLZWF2+X2U4V3DAXaMnYmCN/jz0avdOc7b8g8KVxCxfTGQKC QX0waTVM+Ik+E6WB5c7+vfa2Ym18SJ2D7fmJukVGVvumLfsNxMWnaVtE2kapNnSwCU1m N4Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=MaweUmViY0twzYSrq7d+8WJoT68CLoIktvfpNycFtGM=; fh=MNemY61IO4eCpV0vmAIIrtK8lcQLddnHgElNwX7scoc=; b=iAr8YGpnfF0xf5vnTZvGVsK8qfETiawRF5/AJ/CNKQeH6Y7rqL86x0jlLHGz9XXsfp vhDzfjZf0GDYz2iwBaOdZlcFpu7XkD8AnyUFJPz949gmrzXzBOI1sf5gxkHNcDyqGZSD kZSTLzc+scW3dt/1AsNIiUxVtM6w79US+YUkh3B3v1Pm6JzyN2cGrBPWhxoEO/s1j413 g8FQGU/RDouYBMhXFd1EDxpULMZrWdpjbh0oDQt4IYZUWtUhPW60/G012ontIPpU8Ac/ 6F6DbTRPNaqPLW3WnRBYT+2CcnPHDLTt6VA45Mf9FM/U5E8xi9IS/pm/dENmzD787mQU BqhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@osasysteme.de header.s=19022017 header.b=rL9qRFRt; arc=pass (i=1 spf=pass spfdomain=osasysteme.de dkim=pass dkdomain=osasysteme.de); spf=pass (google.com: domain of linux-kernel+bounces-51103-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51103-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU2Qyd5z2SoGkI8vn/mGhPBI3yeXK7qUFL225LP6mmdRWO9l1IByzhC/BDb2iUEOjCnKBZje/Rc81rv3Vv2DbU5Y4NIpg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y42-20020a50bb2d000000b0055ef64fe00esi1885871ede.675.2024.02.03.05.31.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 05:31:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51103-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@osasysteme.de header.s=19022017 header.b=rL9qRFRt; arc=pass (i=1 spf=pass spfdomain=osasysteme.de dkim=pass dkdomain=osasysteme.de); spf=pass (google.com: domain of linux-kernel+bounces-51103-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51103-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2466B1F245E3 for ; Sat, 3 Feb 2024 13:22:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C04395DF2C; Sat, 3 Feb 2024 13:21:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osasysteme.de header.i=@osasysteme.de header.b="rL9qRFRt" Received: from secondary.pambor.com (secondary.pambor.com [46.38.233.203]) (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 C70E24F20C; Sat, 3 Feb 2024 13:21:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.38.233.203 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706966504; cv=none; b=rDYpI4WBXZDivCdMSnjQq1/WI76ZbnO9o7nvyB6Ve6TozLH7voTaVmIFl7A7sVxL6GWD7c52Oy+yGgRf7269vComLVS2QUvdPqPu8n09pkqWf8wKXzdWA6fX09KK0hYUFgFTu2vXaXPMM7sQCTpeq1dd5L7dJGXR8SvU8LNs+zU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706966504; c=relaxed/simple; bh=DKL9b3icrAnYHUAIyTMERLKYVfDCo69laJyU52r8+hE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xu//NxB9oIv2w+UXsKtszrUVLIXnSV0zeZ7ZlVlKQuY/lLYtbgu25Z0+oaUhx3TgEz+Rz/zc1A9ElkBIuL8RR++IeAAYGByK8lOcXqf2fo0IsHzAcGvhKZ4hVO+amwLUrrSq+xKVa4K29QDJVFDmzf3gr7+A6rghTmMpTCaJxsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=osasysteme.de; spf=pass smtp.mailfrom=osasysteme.de; dkim=pass (2048-bit key) header.d=osasysteme.de header.i=@osasysteme.de header.b=rL9qRFRt; arc=none smtp.client-ip=46.38.233.203 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=osasysteme.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=osasysteme.de Received: from localhost (localhost [127.0.0.1]) by secondary.pambor.com (Postfix) with ESMTP id 2D6326EFF5E; Sat, 3 Feb 2024 14:12:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=osasysteme.de; s=19022017; t=1706965974; bh=DKL9b3icrAnYHUAIyTMERLKYVfDCo69laJyU52r8+hE=; h=From:To:Cc:Subject:Date:From; b=rL9qRFRtTjPbGId30HzVsjzKPVd2dZ+fTgzPAk+cPcN5NZmgWvqCRIFDO3uOv5utI PmkJQEPOpxTkRm2syjaZqXpBqzlimnmcZHJagunTrYEAqr3C2Bw+blrvcLPhr7gRnx 8iEh/A0MRAZiTtGeY6x3S/m3OIQYKZY/USDVtA/lMECQOu3StkDuNssBj+phy+Rwu5 3vytXYY6W3Q5HzVk/0ZQKMvD6ERkT8mbW1V9FNlt3Ke6z7s1rsITmnklW+PD41HUkx G3k1PMiI0vMXoIdqtONGsrDLfRo2LVb6/4Gmq69I8EtpCezLnnrtPXDnPrXhURPsny XYEKl7umiyscQ== X-Virus-Scanned: Debian amavisd-new at secondary.pambor.com Received: from secondary.pambor.com ([127.0.0.1]) by localhost (secondary.pambor.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id wwGa7QVwNd2p; Sat, 3 Feb 2024 14:12:51 +0100 (CET) Received: from chromebook.fritz.box (dynamic-2a01-0c23-79b1-ee00-489e-3931-3658-2abd.c23.pool.telefonica.de [IPv6:2a01:c23:79b1:ee00:489e:3931:3658:2abd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.osasysteme.de (Postfix) with ESMTPSA id 52D406EFF0F; Sat, 3 Feb 2024 14:12:51 +0100 (CET) From: Tim Pambor To: Andrew Lunn Cc: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dan Murphy , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Tim Pambor Subject: [PATCH] net: phy: dp83822: Fix RGMII TX delay configuration Date: Sat, 3 Feb 2024 14:11:51 +0100 Message-ID: <20240203131152.61958-1-tp@osasysteme.de> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789884729287102062 X-GMAIL-MSGID: 1789884729287102062 The logic for enabling the TX clock shift is inverse of enabling the RX clock shift. The TX clock shift is disabled when DP83822_TX_CLK_SHIFT is set. Correct the current behavior and always write the delay configuration to ensure consistent delay settings regardless of bootloader configuration. Reference: https://www.ti.com/lit/ds/symlink/dp83822i.pdf p. 69 Fixes: 8095295292b5 ("net: phy: DP83822: Add setting the fixed internal delay") Signed-off-by: Tim Pambor --- drivers/net/phy/dp83822.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c index b7cb71817780..b061036f654a 100644 --- a/drivers/net/phy/dp83822.c +++ b/drivers/net/phy/dp83822.c @@ -398,16 +398,15 @@ static int dp83822_config_init(struct phy_device *phydev) tx_int_delay = phy_get_internal_delay(phydev, dev, NULL, 0, false); if (tx_int_delay <= 0) - rgmii_delay &= ~DP83822_TX_CLK_SHIFT; - else rgmii_delay |= DP83822_TX_CLK_SHIFT; + else + rgmii_delay &= ~DP83822_TX_CLK_SHIFT; - if (rgmii_delay) { - err = phy_set_bits_mmd(phydev, DP83822_DEVADDR, - MII_DP83822_RCSR, rgmii_delay); - if (err) - return err; - } + err = phy_modify_mmd(phydev, DP83822_DEVADDR, MII_DP83822_RCSR, + DP83822_RX_CLK_SHIFT | DP83822_TX_CLK_SHIFT, rgmii_delay); + + if (err < 0) + return err; phy_set_bits_mmd(phydev, DP83822_DEVADDR, MII_DP83822_RCSR, DP83822_RGMII_MODE_EN);