Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1409458rdb; Sat, 3 Feb 2024 05:21:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLhCm99wWbB7tDq1S8rAcmQ7LasIZVa5IVybeY8DRXcDgR7jhRheMBg7cDHwVbhCKNP2AS X-Received: by 2002:a17:90b:2397:b0:296:5219:bbf7 with SMTP id mr23-20020a17090b239700b002965219bbf7mr2740922pjb.7.1706966513699; Sat, 03 Feb 2024 05:21:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706966513; cv=pass; d=google.com; s=arc-20160816; b=LMe+rv5B6YsNwrTWWrAKf+V87KWS61DYo5qDd1kQ+BYjE/uyq9/SMq+WnskVkrklp8 pPYrQkkdkEASETHcw6ukoBwV0JXYRCBgCf2kj3MSvNh970fUm53k+wKf9lsFWji0ee6o KAU3VeLUpBGy5/eZraVtbcluXaYnL4ejHh66zrIPxsZsvJ9TkdCyEqAMxhyKk0kgKO8i VaUJAsiVf6jDIXcIKH9hU2IChSQ1/s4Gg1mIri45s5uQEoLaFc1gQIZhG2ysNmbMviPW XZqS1uy7YAqZ3CiaB0EztKZ5+6UghNp4ByFRqk3niW3gPq3G3Ad+CC0k+DFBb+2NMvOf kxRg== 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=efD3eJGjGfBjRWhwVDUgKkZ7967V6x32Q1/jNFG46OY=; b=JKi4jn1p5O2+hIkK4ovvL4pXFg09BcqBzW1dAK9ZgX0ED3U+e/FVGuau+hjVpamrTk sdrEB/F9KJq1+9imMoIU/RjKVNnu8gzmMTyCQ4iiB1rfCtEQEi4BxKtz/mr01wb6iQbA mwsYTDAmQa6HcJ+TBM6tAWX2GdtOfnSnYLJh6ysrNFZZyJehpcRH3OTK9vL8SkOTX6NU 507QydRZw9wMu5qm4b1oLwxIY8p/cVQHUwsoj5ixIc5Zaab+UDpj1sIKME/4iyCS58zX qKE1nIwquoTd7fbDaSh+J3hyzQxvn2Zh08Nyahg6H42bumGb06yEcDlTYmjZj5kB9FIa lWWQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51103-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCULV/gcNyFjKX9ZuXlvuIJUp21KdF2y4T98YQ5V6vVX2qaTk65KMQRCjHQ17ojpwrx5zC4ZaLzWdCanUG27e6vdcqNU14I11GXbqYVD5A== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ds4-20020a17090b08c400b0028c58693f96si1551577pjb.70.2024.02.03.05.21.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 05:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51103-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51103-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C90B287DAA for ; Sat, 3 Feb 2024 13:21:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFE875D733; Sat, 3 Feb 2024 13:21:45 +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 Content-Transfer-Encoding: 8bit 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); -- 2.43.0