Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp205383lqg; Fri, 1 Mar 2024 02:45:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUmXYWYFJThLCk8wqq96g3cNpdvxIgmxZ6v789VVr9iMasNY3KpDdgJeQsWn1A7SGgF7WihKcrYbZReeJ4jVKqpRkwSx32ypwA1aHuebA== X-Google-Smtp-Source: AGHT+IFINX7QaGiCE3JY20mpOw06jNHdetYAn7JDpiZ4aDgHw3X2+XBLPHT9DccmcdHrf9frxTT1 X-Received: by 2002:a17:90a:9b0b:b0:29a:72bb:439f with SMTP id f11-20020a17090a9b0b00b0029a72bb439fmr1251382pjp.11.1709289942488; Fri, 01 Mar 2024 02:45:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289942; cv=pass; d=google.com; s=arc-20160816; b=r0guFxd5xvFX7Q+pRRHIWx0HdS2HTZhKPACGaLUKDzjkKkCr2XwxEtsUz9fGJYYX5H pNPIUJhOiJpjD4oVTtYFmRN9odKo8fKkiUf2eWFAMtPFhVeGhk/BWkpcWKuh6+59l3IA XrXZb2mOqJnTo4nWlrLWAuMNe3I39VLly+DWy8Lk+DIcTl2n93zLd8/EnXxbshfBQ2dk Ikkw4+jqCBZ9QY4EqcrOIggCq0X9tirXK7I8i66UT+xeASgQuuK0bOKL4XNzEgRm+j6k WzRtQXyZTg7HerAtVq4/kNoqjdOk7synAUKsYIcun1YGnjceVvT8IAm2vaNmhcFRfiVK 9HYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=qI8O4RcTZpTBkgyd/PDlAc6ZRNXz8+Z3z8sRmDFVZkA=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=qLYTyiSy48co+6g3FX8FiadyOUtxEEM1bgD8S6rmjyB22Cp89PWj2I9yF6FTnId/jv jGnbBI9Yd5UX1HxGVosuXBqisp3XGlOFqGn0cTvCMS5Ov/VZtkqjvj6WfLAXvz5V8PVC bO9l06vS+o8Mu2W1qYQqevcjFoD/o2tzmoXGIoyf+qQ0RLRAn2C7iLHTguweJE3z9r+/ GxaSshqESLlon18A3S1G8rlV0ucPSRrRhkk6fze+D80OkhGjR8ps23gyNNYNjwk8RGep jJHQZqCO97wwlBnnV/WD8kr9aJL2WInG40BKsmole6iL85xYe1watg0s/sunR6LZf2qp 8HkA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gqil/Xbc"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88277-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id t9-20020a17090ae50900b0029939864617si5381785pjy.145.2024.03.01.02.45.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="gqil/Xbc"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88277-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 28B6CB218CF for ; Fri, 1 Mar 2024 10:45:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87D876F085; Fri, 1 Mar 2024 10:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gqil/Xbc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 873FB6BFB9; Fri, 1 Mar 2024 10:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; cv=none; b=dE+pYP6x/1YEfmlhylYOhDlBA+uzgp0/MbhtIRIV4mzcNDD3ab3flLuGQI/fBhezn6RzerjpmJHq2b+ymlY0SQmS0sKoG6HDNdsP2udfVEL12KIHKHmwc+o4ZAEcRhKIwN/W2/rQQwO0/nNelDxEy6/cwIk6+Jlkme2wbqPnF1Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=sa9GDhwHLam8Wcmm30zorJWAPpLaxT+d7nBFuW01m64=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nza2RSQQSPOGlbBu0BjZDaqqnckyBBabe0BzE9ddvA1JFuJi8iR5iBbEabQFXbKX/PobjN1i2qFkWCvlxTwpngZ1448sB1qapu91hZ4LVB0JYnLhjGA7S4RSdmSIcIm8YjQ/mlVMqgzo2qyeUj9xorbKWpA0xvuF7bBvzXsT4Wo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gqil/Xbc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 38D66C4166C; Fri, 1 Mar 2024 10:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289779; bh=sa9GDhwHLam8Wcmm30zorJWAPpLaxT+d7nBFuW01m64=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gqil/Xbcmt0wVwFFx+xYoYmLuRDhAWE9HBvtEO3s2l/JWSp4eCpqH8o9w7BacLIdr +FDiho7bur0Y4TfjIwAQeLPQ+F3cXxJF/DylUpJTnuA1W8/3Fak+C1FXp0PTJgw14Y RuO8SROaKHkLGppS7N+VrG4bqMXjYOH71CUI2gEUI/mFUvoJOR56GORHRrB+Kj43Eu walh46STXmgsu06NYJqP8dBLgnFTeQC69RCaz805sAWxJK2PFV8/JFZyWOUnY5nAfG m7HYbHIDVqGu7bkgyvkI45xUYbU48DuCYQtoYdxNOq8rw0XR9RFDMXX1ApDNq40Im+ AH6gQg9OMRl/w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28EFFC5475B; Fri, 1 Mar 2024 10:42:59 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:05 +0200 Subject: [PATCH net-next v3 9/9] net: dsa: mt7530: simplify link operations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-9-449f4f166454@arinc9.com> References: <20240301-for-netnext-mt7530-improvements-3-v3-0-449f4f166454@arinc9.com> In-Reply-To: <20240301-for-netnext-mt7530-improvements-3-v3-0-449f4f166454@arinc9.com> To: Daniel Golle , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Bartel Eerdekens , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289777; l=2923; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=Y7BEseLX82gaZsmn62yVWfr/R6XW4VPG+wedT6lFZoQ=; b=L4aHWuOWf1yvKF7VB/JxV7BDpvvS36FtQzN+PMdGKvt6UIjX322sQ/GarUAxd1MI8GLvYc0O5 aozuo9vZWBDBddKZfOJSl0TvmiL0dgVUyoN6l+k4rtsFreNURKRyCTJ X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=z49tLn29CyiL4uwBTrqH9HO1Wu3sZIuRp4DaLZvtP9M= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-Xeront with auth_id=137 X-Original-From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Reply-To: From: Arınç ÜNAL The "MT7621 Giga Switch Programming Guide v0.3", "MT7531 Reference Manual for Development Board v1.0", and "MT7988A Wi-Fi 7 Generation Router Platform: Datasheet (Open Version) v0.1" documents show that these bits are enabled at reset: PMCR_IFG_XMIT(1) (not part of PMCR_LINK_SETTINGS_MASK) PMCR_MAC_MODE (not part of PMCR_LINK_SETTINGS_MASK) PMCR_TX_EN PMCR_RX_EN PMCR_BACKOFF_EN (not part of PMCR_LINK_SETTINGS_MASK) PMCR_BACKPR_EN (not part of PMCR_LINK_SETTINGS_MASK) PMCR_TX_FC_EN PMCR_RX_FC_EN These bits also don't exist on the MT7530_PMCR_P(6) register of the switch on the MT7988 SoC: PMCR_IFG_XMIT() PMCR_MAC_MODE PMCR_BACKOFF_EN PMCR_BACKPR_EN Remove the setting of the bits not part of PMCR_LINK_SETTINGS_MASK on phylink_mac_config as they're already set. The bit for setting the port on force mode is already done on mt7530_setup() and mt7531_setup_common(). So get rid of PMCR_FORCE_MODE_ID() which helped determine which bit to use for the switch model. Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 12 +----------- drivers/net/dsa/mt7530.h | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 91d927bb49f7..1ae11b180d54 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2667,23 +2667,13 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) { struct mt7530_priv *priv = ds->priv; - u32 mcr_cur, mcr_new; if ((port == 5 || port == 6) && priv->info->mac_port_config) priv->info->mac_port_config(ds, port, mode, state->interface); - mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); - mcr_new = mcr_cur; - mcr_new &= ~PMCR_LINK_SETTINGS_MASK; - mcr_new |= PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | PMCR_BACKOFF_EN | - PMCR_BACKPR_EN | PMCR_FORCE_MODE_ID(priv->id); - /* Are we connected to external phy */ if (port == 5 && dsa_is_user_port(ds, 5)) - mcr_new |= PMCR_EXT_PHY; - - if (mcr_new != mcr_cur) - mt7530_write(priv, MT7530_PMCR_P(port), mcr_new); + mt7530_set(priv, MT7530_PMCR_P(port), PMCR_EXT_PHY); } static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 8a8144868eaa..a71166e0a7fc 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -304,8 +304,6 @@ enum mt7530_vlan_port_acc_frm { MT7531_FORCE_DPX | \ MT7531_FORCE_RX_FC | \ MT7531_FORCE_TX_FC) -#define PMCR_FORCE_MODE_ID(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ - MT7531_FORCE_MODE : PMCR_FORCE_MODE) #define PMCR_LINK_SETTINGS_MASK (PMCR_TX_EN | PMCR_FORCE_SPEED_1000 | \ PMCR_RX_EN | PMCR_FORCE_SPEED_100 | \ PMCR_TX_FC_EN | PMCR_RX_FC_EN | \ -- 2.40.1