Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2854170rwd; Mon, 22 May 2023 05:28:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bxnmfUElQEmU3gg4qdf1nRZ5n7GvQZlEQMoqGPlvTeedQqcrj5CZ73DE7s7aRhKfZkc0N X-Received: by 2002:a05:6a00:10c3:b0:64d:2e0a:4812 with SMTP id d3-20020a056a0010c300b0064d2e0a4812mr13415106pfu.17.1684758497650; Mon, 22 May 2023 05:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684758497; cv=none; d=google.com; s=arc-20160816; b=JB742Nt3Xfzaw8uKo0qTam9AuBeZZo0fxbA9LJbn1o+zLc92AvDXhQASvxH8EN9IHG Zv02kQtNDrJp2qhkm8xsBqhlZtaajhpt6i4wK6Qogl7In8aiCuLtdQP9t+6fJ42OM8Z1 wIvH15JwU5GA5o9jcMXymgTSjJBTCx1E+4D21PZJJwTMNoJGPwuX3Y7fxFrV1F37Myle /mtRjmluXQUQ4V1z8QrfShede5/TZXzrPa1+gQ2n3NR3yYYe4FNkLNBBSXCJI09grVyv TzfuK2jlCXDSRqX/ji8ilfHVNSDCGZR1Gtf/881nlL1VGJSsOXXhMjw9Nfh+RG4yHDDU o4rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dlwuz8s8MG9ZZ2zJmGEfllL6UDiR42hxKGeFHL77wpU=; b=jeGOCwgCmHc5IYQCmCto55MAGGXAgkHVF6gmrJ/4Tum4RcWgyZt27nYUeKlxcp3Qig RmkuqRGSuoWEn5y5OzZQ849IE0rb92Q9wwcImzQsehviRUzly+AYFtmW+y9Crw5oUtLP No1Q4nU4VNOa09qaFqI3ukHyEuZIIApwVj5+JPdQvVM9jSLNY68Z27wXSz6MHG/LHM2f Zg3y4TQtRb6vU0ReChn7q06ChN9lJ8sUT8K2xUT7/9Syo+YHtntY4NCnT1zH7J5W5E6q z1QfSeFPUV3N4OhVHoR2DYMCQ/argmZd8598eHnlORZdhj/uP+xnJ0SyYPMpgsCdNo9Y pWYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UEIShbHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g1-20020aa79dc1000000b0064d22da9421si4718020pfq.254.2023.05.22.05.28.05; Mon, 22 May 2023 05:28:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UEIShbHZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233870AbjEVMTL (ORCPT + 99 others); Mon, 22 May 2023 08:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233042AbjEVMR5 (ORCPT ); Mon, 22 May 2023 08:17:57 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3298A1BE5; Mon, 22 May 2023 05:16:41 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-96f6e83e12fso489609266b.1; Mon, 22 May 2023 05:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684757791; x=1687349791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dlwuz8s8MG9ZZ2zJmGEfllL6UDiR42hxKGeFHL77wpU=; b=UEIShbHZWhZsbZeQbvyhXu/8Kq1bhc3dzJxhf5mfe6olRkFTrfLEijjwFLQKWL97YC 5WStn3RP1m8lgVuDZ1p+umTtHFVh4UwI8Nl0wmhKbHSUXJqDRtVH9lpHzpiQswkEw8vS EoYmqxNQgxt0os1uzsopMY3dPAgjhDyR8rdHEFFAlLKg7UBx+LJzSJm9YoEQ78XhCyd1 JfslVUBJrtI6Wc3++0vzZz8VSO4eGWNl2mm/AdqCy/yo3eFxEdVPjM2r9H1S2HPi8IQe rdMHeufvf8xKWlPY0LnoN3pkY6nDoL+O71K61V5a+batec74NzjJnpRXiSGwFUjCjTjs XVcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684757791; x=1687349791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dlwuz8s8MG9ZZ2zJmGEfllL6UDiR42hxKGeFHL77wpU=; b=LHnP0tZLj+OX+eDXvrvR4PqUsgGwnnclRWgdAO0E1yw3XD+8qUQvh7JgyMebfCHjbY Ugh953mGJIF9OS+iOV/dnqnJZBvslkbJWYFg3fytmN67MnL20AP/hwS4pP4n6UFeR1rm aOr2ZJvPCSSf5xmeJ4Li7jd9S3myOBetvlK34yFQP61OalGnE6FmaMUA9CD4FlBMQ+dw h6wC7Y1uK09g37AXmYNBJFapWTP6R2fsSXpBdljESDY1VcRLEAJeplQvH+v93y/pQPWZ LU//cBFKOuwZwhHUztWWus7hsKaRAALDnBNMz445Sc/ku9mt0U5UVEV59eTYedGuoUSL 4YfQ== X-Gm-Message-State: AC+VfDxuKrVrA3LsM8H6y1Q/m3LxVJ0D9clRYkGQFMd4cEY7d98/zYmT sbqlGtqWIpj9dO8j1Y6vldw= X-Received: by 2002:a17:907:2ce4:b0:966:a691:678d with SMTP id hz4-20020a1709072ce400b00966a691678dmr8553648ejc.51.1684757790936; Mon, 22 May 2023 05:16:30 -0700 (PDT) Received: from arinc9-PC.. ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id y26-20020a17090614da00b009659fed3612sm2999950ejc.24.2023.05.22.05.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 05:16:30 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Richard van Schagen , Richard van Schagen , Frank Wunderlich , Bartel Eerdekens , erkin.bozoglu@xeront.com, mithat.guner@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 15/30] net: dsa: mt7530: set TRGMII RD TAP if trgmii is being used Date: Mon, 22 May 2023 15:15:17 +0300 Message-Id: <20230522121532.86610-16-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522121532.86610-1-arinc.unal@arinc9.com> References: <20230522121532.86610-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arınç ÜNAL This code sets the Read Data (RD) TAP value to 16 for all TRGMII control registers. The for loop iterates over all the TRGMII control registers, and mt7530_rmw() function is used to perform a read-modify-write operation on each register's RD_TAP field to set its value to 16. This operation is used to tune the timing of the read data signal in TRGMII to match the TX signal of the link partner. Run this if trgmii is being used. Since this code doesn't lower the driving, there's no apparent benefit to run this if trgmii is not being used. Add a comment to explain the code. Thanks to 趙皎宏 (Landen Chao) for pointing out what the code does. Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 744787e38ecc..f2c1aa9cf7f7 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -404,7 +404,7 @@ static void mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) { struct mt7530_priv *priv = ds->priv; - u32 ncpo1, ssc_delta, xtal; + u32 ncpo1, ssc_delta, i, xtal; mt7530_clear(priv, MT7530_MHWTRAP, MHWTRAP_P6_DIS); @@ -455,6 +455,11 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) /* Enable the MT7530 TRGMII clocks */ core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN); + + /* Set the Read Data TAP value of the MT7530 TRGMII */ + for (i = 0; i < NUM_TRGMII_CTRL; i++) + mt7530_rmw(priv, MT7530_TRGMII_RD(i), + RD_TAP_MASK, RD_TAP(16)); } } @@ -2209,10 +2214,6 @@ mt7530_setup(struct dsa_switch *ds) mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), TD_DM_DRVP(8) | TD_DM_DRVN(8)); - for (i = 0; i < NUM_TRGMII_CTRL; i++) - mt7530_rmw(priv, MT7530_TRGMII_RD(i), - RD_TAP_MASK, RD_TAP(16)); - /* Directly access the PHY registers via C_MDC/C_MDIO. The bit that * enables modifying the hardware trap must be set for this. */ -- 2.39.2