From patchwork Fri Mar 1 10:42:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990355dyb; Fri, 1 Mar 2024 02:44:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWaiBIVKAzRzsZteVgBNRiV09WZgS1LixLKiIg+vNlfAeXCqFi17SfmE7GcdlPvfMf/keJyLRVhtrshEXJcrC/i1wJCyA== X-Google-Smtp-Source: AGHT+IGQHC0lDh+LZVQ3myLmzVAQ5JyGGVcVFFhXR2LZL2n+/vxTdHb5+uJIslJw/n0lzKNQ/pvq X-Received: by 2002:a17:906:3c17:b0:a43:86f3:b00b with SMTP id h23-20020a1709063c1700b00a4386f3b00bmr928653ejg.0.1709289883391; Fri, 01 Mar 2024 02:44:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289883; cv=pass; d=google.com; s=arc-20160816; b=m3Atxp9sL3iTEqRrgInJ2jkInC+PgH4tjFGUvr0ypmAdXDrkZVxeCV5AD+rYZSqc9a uA3GNNWTzYdIwFo+Gr3+ZNSReXHUVQI9QtPWspBzG2h21JY1Sd6Xszpr6mx5LET8rWdj KGf/ej40qEo8h2aPSjRxxEH/Nj0wC86JcoSrX2uK/7WBODxc98dBP0Og/JIA40woUyqu XQr08olCOGvx4/l+jGmGlWKV+Aflveps+h8UzPBz2SIEkItDdS0iAG+JAEWV5g6UxNHt V6IEmIjTqrf9zhhhSzIx2kAcS12bjgOKODv7xEbNuXSB56JQIHIBYo5E6zCdg6/Tb3ZF 0CFg== 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=eLRScSRbeiXkqoMwIrGrlGE4z/Gkx7qoZPO6bnKhtt4=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=VKKYY27JkgMNUsL5PAkGWKuKEzchBDDuH26PrFxnzb0hvVrcpM/vA5hoWT6u2xlFtm SYpae12gi8zAVnZUo1FgR8aQwgb0R//ZtCDZAfC21pN3891ybGzGmuUPRDA+pcza39c9 gWQfW2CstFroLkg+CN/LxCsnzKfb6aZJ1x3EDrtQqVW+CSDauiv9F//TxJxXDYifIJhV afEzd4vf/LxITSs3kqwn7zbg2LofPxxnPQjgiG859+CoZuiOTq6nRYD7wbevL/CY8Snj zy2UKwl/RYBYgyEGsuHVXB0o2S4JFYXa/fm912mWZCus7CfauOE0Ci/h4/VDi2FPrcsj uqqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="dI/2KUcd"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88268-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88268-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u20-20020a170906409400b00a3d62fbc3e5si1334711ejj.255.2024.03.01.02.44.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:44:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88268-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="dI/2KUcd"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88268-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88268-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 073D41F23310 for ; Fri, 1 Mar 2024 10:44:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31F8B6EB6E; Fri, 1 Mar 2024 10:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dI/2KUcd" 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 288B320319; Fri, 1 Mar 2024 10:42:58 +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=mvQvgcx4GYDAi8MpXF5DagjOEz87U0UkawMmEi+8gtYxWxjJYq1lBz8Yubk0Tn5xMoMce8ddq9X+oeDAph/DNlJUvknhcDEAixyo0LlfczAJR2b/tOkzRSANObk5O0qX9lg2T0GPrayMujARomKoEH+UwC09biD82RDFwIuUPvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t26iq2rIq57DOXDBQz/Blxik/Y4y/KF7heAmHEWsDx0UiRGBZpz83ekt+FaSlaR3ucuDvAUQMbWGTbcv5/SyXBG0ACKDqu1O6qV6EDUL7auA5cNUAE6+tiLfpwXX1aII4bLq2C/TA9CHSoB+bQ+S+ctokXO0w0JEuE6imcpFWpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dI/2KUcd; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id C1AF6C433C7; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289778; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=dI/2KUcd+fDTnT/+PqCQ8mdvjUgbLe0MVjTKrAyNZtblt93VTNTsX2QzNWKKvzPpP tSxd8mZXVuAIWilRyZrYLCIgDVQL8z1i2q9RXscAUVKsnUyPg9H9PIeVnfc1AMActj ryD8dfnIV802q2fQ703U0n4/0fmhVW+0m7Q+W6KbAnyYdZExhvQIW7AXvJtShUntez Zo8Jbl5PJ2aXv1Wc0vtzSqFyg5If7MH3d20fh9Umz7hd1xOc4o0opz19y18zjuyLCO +5R1HOc0b4F0IOcMD19aVReofAq5LMqo8LxUYAQ94B/id8kbfQm2YPhEEDRDaKJQVP 4R3K2bRcnhkzQ== 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 A7DB0C5475B; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:42:57 +0200 Subject: [PATCH net-next v3 1/9] net: dsa: mt7530: remove .mac_port_config for MT7988 and make it optional Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-1-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=2593; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=zsBRS25Kdr7LfGGSqrR3mLbX7RMd9/oxSXqAjEC3Jr8=; b=5r5D4AVXyAxUEdPgPCrz37wKin9bxfUjIN/dykb87Ikxk23j7k5+Qfzu+IrpQlCIy+HkPLNwp 30Bvz+KpQ1cBm1DesQ/ZPQww9ihyGYAPYcI3kkJBYRBWxjY1Cu9xDRw 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320348563418870 X-GMAIL-MSGID: 1792320348563418870 From: Arınç ÜNAL For the switch on the MT7988 SoC, the mac_port_config member for ID_MT7988 in mt753x_table is not needed as the interfaces of all MACs are already handled on mt7988_mac_port_get_caps(). Therefore, remove the mac_port_config member from ID_MT7988 in mt753x_table. Before calling priv->info->mac_port_config(), if there's no mac_port_config member in mt753x_table, exit mt753x_mac_config() successfully. Remove calling priv->info->mac_port_config() from the sanity check as the sanity check requires a pointer to a mac_port_config function to be non-NULL. This will fail for MT7988 as mac_port_config won't be a member of its info table. Co-developed-by: Daniel Golle Signed-off-by: Daniel Golle Signed-off-by: Arınç ÜNAL Reviewed-by: Vladimir Oltean --- drivers/net/dsa/mt7530.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 03d966fa67b2..94d4b2c87799 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2655,17 +2655,6 @@ static bool mt753x_is_mac_port(u32 port) return (port == 5 || port == 6); } -static int -mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode, - phy_interface_t interface) -{ - if (dsa_is_cpu_port(ds, port) && - interface == PHY_INTERFACE_MODE_INTERNAL) - return 0; - - return -EINVAL; -} - static int mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) @@ -2706,6 +2695,9 @@ mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, { struct mt7530_priv *priv = ds->priv; + if (!priv->info->mac_port_config) + return 0; + return priv->info->mac_port_config(ds, port, mode, state->interface); } @@ -3169,7 +3161,6 @@ const struct mt753x_info mt753x_table[] = { .phy_write_c45 = mt7531_ind_c45_phy_write, .cpu_port_config = mt7988_cpu_port_config, .mac_port_get_caps = mt7988_mac_port_get_caps, - .mac_port_config = mt7988_mac_config, }, }; EXPORT_SYMBOL_GPL(mt753x_table); @@ -3197,8 +3188,7 @@ mt7530_probe_common(struct mt7530_priv *priv) * properly. */ if (!priv->info->sw_setup || !priv->info->phy_read_c22 || - !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps || - !priv->info->mac_port_config) + !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps) return -EINVAL; priv->id = priv->info->id; From patchwork Fri Mar 1 10:42:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990340dyb; Fri, 1 Mar 2024 02:44:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVJevy6JRexpAUJQ9acv3GJ1jvHFIj+AASyh5j2BhTMxjyFAMVVza78vyKizMkpvwnF0C4wmB7GvHQN9HFCCFcSTt5lHQ== X-Google-Smtp-Source: AGHT+IGHi7piwQfElvghriQnM9LrY1DJ5K30U4nyQoNxgiN8cQPYUFBWjA1kX3gSNjA+QfWHJym3 X-Received: by 2002:a9d:62cd:0:b0:6e4:cfc0:f91b with SMTP id z13-20020a9d62cd000000b006e4cfc0f91bmr61702otk.9.1709289879051; Fri, 01 Mar 2024 02:44:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289879; cv=pass; d=google.com; s=arc-20160816; b=Izw4PR/2hUOeqNi7d23r/o+hV8OzZ2MVXfNCnaClCnWcSyQzldco2UyWscIk3jcjmS 4OPY4AruW7VBLnIHeB3dzGxVtzPNX4MSQOEDK9lE2BPKxewPrFBKoF5hkXw8y/LfA4aF owT4C5vWTiu0q+SbLt0Fyz51bQasOPiujO5qqFRwtQ3AFbvTxQz5kTsa6p9oDFOWAKcP nDJkrKbPj9XmroWYLZnVu/iB2nFHusanse4zYVmOFLK+04wrXDa9xNfqc/aeGlcc33Ga 9DDb7DBZdMonG28hZfaXE7Kxlf5MSUGaJ3ZkTxAmhiYiWDenp+mKX4yQiHvDza0svbpr 3vkA== 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=aAT6j+peXF1gkbFazeEWy+KKBa3S8oFGztCQAserssk=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=AF5npbWE9cusa6waMwd6Veglgos69Z87vmypieIV3W23pODZg/+YKEbfKdYXn81hgT HWPVs6+2BdQGFCvY9Slr6iX2/IC9vhJYOY9RfNDVWk/TABgx5+n4SgKikQOcih10cvep NFlMnqLhKfk1WAhOlnRnEAdAI7X449lrEltURt8gBiQEdzxEGBGr3EuXQJjdL1IEWF7Z WAd+J9hbRGzOjMdYpJwOGr4eO/eM5keif/7nzAWHBXvGIC7AFw8gIT9eOcKyoHw/g7Ju 3cNQmeumyx9zIg/0GUW3UrLX2nJ8xGOJIPjnF0NCytZRgX/Ur/4hmLqBXyJe1zokwHNv rmeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WpEW0BK0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88271-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88271-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u11-20020a655c0b000000b005cf8b79f90csi3223972pgr.501.2024.03.01.02.44.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:44:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88271-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WpEW0BK0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88271-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88271-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D445B285610 for ; Fri, 1 Mar 2024 10:44:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 077D06EB66; Fri, 1 Mar 2024 10:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WpEW0BK0" 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 289806A8AD; 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=UIKSnwajho+vTGKy81UgFN51TAX0Dx9h3YPuE5R70l/i/bCu0aaj0DxakLs7PYl/CiURJLV/E48yaQYSPUys8jd25WVDEprVQuFgpgaCRdhI9SCbGIjIOJi5XZwdcXtay5MlEhgVq065jBOOx5opJGjx/k0t0qIi4z4kQuxaF94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=SU+tK2MlpgkdVnVhaHn0UQcoIzpj8l2UDGxN8QSA/B4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BvDFwfZkerm0PfgdizfhrjZWRq590xiPE2g/SZyiVoiv1WxTcsfvjKuVQCpChLvnoxfQMFitNJP2GGEjtpW9191h8x+vMMUK5tO2lyx8EV6RnNTu5danx9oymZ+pPGjkG0OAf0IGd2DHI2wBUsKnCwqgKixoHxkLDvAB7xN+Pp8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WpEW0BK0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id CF0FEC43390; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289778; bh=SU+tK2MlpgkdVnVhaHn0UQcoIzpj8l2UDGxN8QSA/B4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=WpEW0BK0JGXMO1idR1AAt80adqw95t3pmM5o39e5bqpFB9gcAE5BGHO01sFPl+2Nr OQfyup1xMyM/nN/2xw6r+ddrQqMaMstJvGMv5vHaNyHF/w3gIBx5N5jTAlC/1s7f/O C1VfhxYlqq9xQH0rtOUuQ5EGherYq9515+u8EJ+Q9GPxtMIruS+AYIBX1AkXZcu6ea cl1rAXSMsPDim5WHkFK4cLK/W28CDb6ASNoHmFfERNq4eebR1huk1IOX2LAwSDtZPG dJiMgDRj2Tz/irDnawrM4vcDeXibEMAn5RrMvgwvRBRxFLl8ynxdT3idbmH2qeXWBw 8ralK9Wn2QNbw== 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 B7037C54E55; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:42:58 +0200 Subject: [PATCH net-next v3 2/9] net: dsa: mt7530: set interrupt register only for MT7530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-2-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=921; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=JV5lkSoAmKAO6vEQKKvFpHOlOFc0GQ6XMI05UOpapU0=; b=sDN29cEjzp83tM7un6A21yIeFo9LYgnjVC4Xk7q+Zp0J0suaNg8FyIx/eXQTAZUBFsTqh/YNe O2TMg3uZy9UDrLLFlOEDdkBqwyN4G4HFBOIdLa+sYPrKWohmmjWu2VF 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320343960918372 X-GMAIL-MSGID: 1792320343960918372 From: Arınç ÜNAL Setting this register related to interrupts is only needed for the MT7530 switch. Make an exclusive check to ensure this. Signed-off-by: Arınç ÜNAL Acked-by: Daniel Golle Tested-by: Daniel Golle --- drivers/net/dsa/mt7530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 94d4b2c87799..5cfd303b773f 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2055,7 +2055,7 @@ mt7530_setup_irq(struct mt7530_priv *priv) } /* This register must be set for MT7530 to properly fire interrupts */ - if (priv->id != ID_MT7531) + if (priv->id == ID_MT7530 || priv->id == ID_MT7621) mt7530_set(priv, MT7530_TOP_SIG_CTRL, TOP_SIG_CTRL_NORMAL); ret = request_threaded_irq(priv->irq, NULL, mt7530_irq_thread_fn, From patchwork Fri Mar 1 10:42:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990330dyb; Fri, 1 Mar 2024 02:44:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW8lvwodQW3no/PGeqH6FfDvz6ONfiTNQnU4/Yr0TvDJ20a4prrII29VNck+r9XN9RNtgKpgEBdjWYZ7NfLGB5d001nhw== X-Google-Smtp-Source: AGHT+IFZEam058SD2ckK/m5vO4vyvyo+D8Y5TX1RciciAgD/ItpCRTYs+dj5zb5bTeFM2nsItOw0 X-Received: by 2002:a05:6a20:12c5:b0:1a1:2767:bc47 with SMTP id v5-20020a056a2012c500b001a12767bc47mr1207652pzg.25.1709289878205; Fri, 01 Mar 2024 02:44:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289878; cv=pass; d=google.com; s=arc-20160816; b=CqW40LJfOC878jWcGy8JOE/SCxcTRNjPw/LvNCyGvMoQqb79qVA+3fCQr07prCmNqD ix9x0syCzWOkWd6QZKqVwIziW2yVRq/Qnu5fctKRrJrxD1Ua5MPN2QxschfNiH8HnSDh Jvmz6aIZrP9Qj9yotbX/TXE57Eh2C/J912kcbZOzkZhRhCMsNLHgUBF4gxvasXH7s4iM MVWS2LAmv3UZ11EadZJWmhz+3pfipvHo4a41M6zUkW880n1nnlaTupCdkmIll089WiQv yLupbRQi7EHc4LnbMfS811w3nhD5aiYyFNG8u97fsWAmS1vHjrWW3M4uhJrUutBLu8xI Khvw== 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=d/uU7W/uTpzzuvfgVU4nRTK1vU25pcV789OeP+1QpRA=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=otLoPHMD+lz5khHnmWshiX29/mGL+vHSgmigFVVMLKr9mCV+LXyoIYsj7EEX+8OLQH cJOqlqebbuun03h9/C8LW/nqTmVpPaGz2EDwAZDuZ4U95+yvWM4E3AvLdRbXf2NvGmLP S8RDFycOewkfEN3nDraDACOMcmtFKte3NHPpPNU86VZ8amQv8Z55VdZ1aZNl+aJlEnJ1 I3Xk2hSUXckZMijiFVdFoyVdcdjpPZvi/08x1bO5PlBdHq8wanbjV58P7rvddwk7Hvey LZiu9uVFC/ri1XKnc65rfsHizuIzlRapvqqICEoTLOckcy4aM3JrwjoQZaQhWPlGLV+K FXxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kcz6v5q7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88270-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88270-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sn6-20020a17090b2e8600b002903e315e4bsi3496083pjb.81.2024.03.01.02.44.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:44:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88270-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Kcz6v5q7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88270-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88270-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 095E1284F73 for ; Fri, 1 Mar 2024 10:44:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0167D6EB64; Fri, 1 Mar 2024 10:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Kcz6v5q7" 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 288DE20B29; 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=JMs48myouFoLzuIv/2W/aEWg8pw/8vZxaW8Rw4h8Fx+izI+m4R5C0t8NcddrYXFr1Sx4al8mxMy7RBz1vHN9wXFfQcZKnaan3FZ3/cGJang8GrteRwWplOwUBO1VWZGr5rTz2hRT4QbjFrtcoIwaMNaOAzah8EHx0GjQUjCOYnU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=wUpyw43HcHACBQ/8AUAV0rAR4ahB+zKQE8l7LVuV9Hs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DiEk8RcVEhrnTO0qfq25lPtZtrw0n5hBkyZP3+blUcolMx4LU8YPHasq7Jjyv6UCqEXH/eM3bmqmkP6ilEFR3N4UgDHEevf/1+DfALb+fxSZbRVvbPlveAI/6XoH4t8yji2W73rTZuzAL32plhKMpPFcdSTATxyj9RLTZYHvqCw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Kcz6v5q7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id DD65DC433A6; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289778; bh=wUpyw43HcHACBQ/8AUAV0rAR4ahB+zKQE8l7LVuV9Hs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Kcz6v5q7MMQfEEkzl/ykwxZ+ENVTtozqoGi5h9AiOT9Pix2I0OeWyL9AYgxRRxw+h 51Lmfkx/wCQbGuuvSIVv7Nb02WGATTe6mFnfI9CS0/2PnrnABUi5II/BvjOpzkr9zv qHQpxKGFEQxHLfpldcbfhdOtg+P+sXFKIHcUdHsVMoFwLlANitHe5JYVezWSxLmWwa b9jksH9thiopFLwLBkMMxuFRJtnC3GV85nFf4qOGdGjjkLs7Ld/886YON2+es/aYKr xWiUeY1aGWIBZ+Dt0J6YJ/e0IPmZx7KstidKZINX/syjmEkaNKuxPmwQZ6g3VpXlov lQJsopR/CEunQ== 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 C3B85C54E41; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:42:59 +0200 Subject: [PATCH net-next v3 3/9] net: dsa: mt7530: do not use SW_PHY_RST to reset MT7531 switch Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-3-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=1298; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=ecurYkRWOTqqGU2AKHni4Fzup3XR61+gzZ3STlqM5Z4=; b=EcZZqAw0Px2l53CBDBN+OKBDR6BvhuwtATODCOqg0mePBSm4mjtM0F/hIs6zkpLPjTmfUVOAw G8CgcELxzmeB3sKfMJqHSwGicDtnlFN/3Ff4mY6SeGKl4qPnLVboMNF 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320343477058301 X-GMAIL-MSGID: 1792320343477058301 From: Arınç ÜNAL According to the document MT7531 Reference Manual for Development Board v1.0, the SW_PHY_RST bit on the SYS_CTRL register doesn't exist for MT7531. This is likely why forcing link down on all ports is necessary for MT7531. Therefore, do not set SW_PHY_RST on mt7531_setup(). Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 5cfd303b773f..296711fd5c43 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2451,14 +2451,12 @@ mt7531_setup(struct dsa_switch *ds) val = mt7530_read(priv, MT7531_TOP_SIG_SR); priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN); - /* all MACs must be forced link-down before sw reset */ + /* Force link down on all ports before internal reset */ for (i = 0; i < MT7530_NUM_PORTS; i++) mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK); /* Reset the switch through internal reset */ - mt7530_write(priv, MT7530_SYS_CTRL, - SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | - SYS_CTRL_REG_RST); + mt7530_write(priv, MT7530_SYS_CTRL, SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); if (!priv->p5_sgmii) { mt7531_pll_setup(priv); From patchwork Fri Mar 1 10:43:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990772dyb; Fri, 1 Mar 2024 02:45:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUka6lEp+FDBjQp6sXfiJSfA+tdmImn7jtwl3K1Kowpo7e3+NOICSnW0kOUijvi95/w2JR3SewZmNG/TWKJFXvEUwE8pg== X-Google-Smtp-Source: AGHT+IHm+LH6Qbdrxga80NAs3kHzziQ74Vn+jwTtlSnVKp5LHMLmqXEERV7UAitSymxhdHxNZWP2 X-Received: by 2002:a9d:740a:0:b0:6e4:8205:d73e with SMTP id n10-20020a9d740a000000b006e48205d73emr1158040otk.10.1709289947963; Fri, 01 Mar 2024 02:45:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289947; cv=pass; d=google.com; s=arc-20160816; b=zR6Mbi54FNBmjM4MVJOPyMsRwmhQdi8bZCQDfTFt4bxsYwpZQWs3dHii6Ac3zpVPdL XfXIKGhMJeJCbiO/selhireewZOURZI8Q//OSkdBqiRw78Q/63L9cEDz6CfWTIGPUbjI xfHLJ2/rKHRdarV9x2Wv46mt3h35S8VTOfRlj1iDYsrLvmlXDJwaGtfXvBzx7dZzsU00 d9EM1DJybd4kFtiuOHjvrXdmJevNCXFv/N1VnT5Q0VlFp15C/F4HrbGz51ZO0Ydxg7O8 y4/wg2fzzTXtaUfSMUi5ujV308Xw2BM3ltmH0GAQ4JtHVnQo0JpdY9JlsILvKe2ScWVj 0odQ== 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=TyQvMHpQ7Sn04YzBDrBPXkQku3Ek3NxrllD5OF6IN9w=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=SFDAhojdgjNWJF59dcc/zXzUKV23ydUE6dipxSLDvMy1E5Vzemq2H3BGaS6z7y+ztL cTO6j23YuNCfWo6KkTFMJ34xgBarAgcvTzh6YoariubAKDJSD+fl2M9U2lBJKSuC9Hxv 61KDr95UEy+8LlbxPez/Xmnnp2SKCVzM+jP7pwqykCg7zHag4dNrS0+rdLa2tSgqk8NK C1sLde1SHZMYwwrpkKyWTK666sldzh1fDcLQ6fQclUAAI4bvr0rbEGhX3XV1M+Mdrm+m Mv6jz6mjjPKNlPIywq8YmzpLlofipaVWiDMewsyypQnqlZBwIZYY6XblWBroPEZHSo0M 5slg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LH0LnPMF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88275-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88275-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u11-20020a655c0b000000b005cf8b79f90csi3223972pgr.501.2024.03.01.02.45.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88275-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LH0LnPMF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88275-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88275-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A8705285FBE for ; Fri, 1 Mar 2024 10:45:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C5FE70CB6; Fri, 1 Mar 2024 10:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LH0LnPMF" 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 64A836BFA7; 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=Th3ipSX+b9dkCaodU4QeX1SgXJ3yDk+L+G1KeR78qOuWlIvVlZtKQtMdL4TqI103Yj3mYQnVeszML8rgCrL8q98VI2uI25bJXcDnZ2031Nr0kmPhOqZnBhJejc2T1Z7tcBICoGd8UMpDxlQ0rp7nPyCnH7Ij8x09KXvrAqsr/sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=Jhqq9LDQAWH2mBLmfX78v2OKPVCnCExTEJn5HZPf5HA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JztPB/pFJeX5Zp5ep8qMVilIGxlej1aQqXChz2IgH24GQOmYef4I7TtnByUFbcRCaEe/vuqwhLDcOxQqsnjG82SK0jJWLUPFLttN/HbWaB8eunI5mfPaBesGUW+eI1roEJKrQ1cP3tSrQJQqmoYXT69GX053mfEbIf1PeDqB5Kg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LH0LnPMF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id E2B56C43394; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289779; bh=Jhqq9LDQAWH2mBLmfX78v2OKPVCnCExTEJn5HZPf5HA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LH0LnPMFfZp+eXivNF0nwG49fVJOovk728rzsM+zYcuyMYVzhTcXEx99gqjE2oSgj H5davJyisgAFN6a/RSLmtkOalALtmwcpSB6wG+EnuqcPl928lhVJFrh3ZY8QxkYCBT FvjCRdskamRsHX46yBzu8KEI/18sB9aNI8QfYlDiZX4sk15FyER1q6CfmR77lm6usG S1JHHum2Z7/+xHnMaTFYWopj3kliz7baKbQR/g2WWEYlYV2ixJi0zFnns0uiB9gu1a 2uHzCBRCja6rHmPPA5XpEu6+NvjfBUzoRrOQydzY70JEGUGf3EcxL4UEi4vXgfwoYd 7YGz7qhGuP98w== 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 CF70AC54E5A; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:00 +0200 Subject: [PATCH net-next v3 4/9] net: dsa: mt7530: get rid of useless error returns on phylink code path Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-4-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=6691; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=VEHAqivf2wqqhSdVx3RugkanjZYt+1wAB+Gpf3w7Br4=; b=TATdUAB71wjymjCglkL4niT8gvHMVA8Y0wI9Kpz0S8znoAj1zwBN2uCounp0z7U66H7pidPWs dltLIn61sLuBWAYqWNB40WOxx8x5wwViBnUW+J3aHiR+d6qhS6tYY3U 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320416602490463 X-GMAIL-MSGID: 1792320416602490463 From: Arınç ÜNAL Remove error returns on the cases where they are already handled with the function the mac_port_get_caps member in mt753x_table points to. mt7531_mac_config() is also called from mt7531_cpu_port_config() outside of phylink but the port and interface modes are already handled there. Change the functions and the mac_port_config function pointer to void now that there're no error returns anymore. Remove mt753x_is_mac_port() that used to help the said error returns. On mt7531_mac_config(), switch to if statements to simplify the code. Remove internal phy cases from mt753x_phylink_mac_config(), there is no need to check the interface mode as that's already handled with the function the mac_port_get_caps member in mt753x_table points to. Acked-by: Daniel Golle Tested-by: Daniel Golle Signed-off-by: Arınç ÜNAL Reviewed-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 81 ++++++++++-------------------------------------- drivers/net/dsa/mt7530.h | 6 ++-- 2 files changed, 19 insertions(+), 68 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 296711fd5c43..c069bf273733 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2587,7 +2587,7 @@ static void mt7988_mac_port_get_caps(struct dsa_switch *ds, int port, } } -static int +static void mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { @@ -2597,22 +2597,14 @@ mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, mt7530_setup_port5(priv->ds, interface); else if (port == 6) mt7530_setup_port6(priv->ds, interface); - - return 0; } -static int mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, - phy_interface_t interface, - struct phy_device *phydev) +static void mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, + phy_interface_t interface, + struct phy_device *phydev) { u32 val; - if (priv->p5_sgmii) { - dev_err(priv->dev, "RGMII mode is not available for port %d\n", - port); - return -EINVAL; - } - val = mt7530_read(priv, MT7531_CLKGEN_CTRL); val |= GP_CLK_EN; val &= ~GP_MODE_MASK; @@ -2640,20 +2632,14 @@ static int mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, case PHY_INTERFACE_MODE_RGMII_ID: break; default: - return -EINVAL; + break; } } - mt7530_write(priv, MT7531_CLKGEN_CTRL, val); - - return 0; -} -static bool mt753x_is_mac_port(u32 port) -{ - return (port == 5 || port == 6); + mt7530_write(priv, MT7531_CLKGEN_CTRL, val); } -static int +static void mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { @@ -2661,42 +2647,21 @@ mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, struct phy_device *phydev; struct dsa_port *dp; - if (!mt753x_is_mac_port(port)) { - dev_err(priv->dev, "port %d is not a MAC port\n", port); - return -EINVAL; - } - - switch (interface) { - case PHY_INTERFACE_MODE_RGMII: - case PHY_INTERFACE_MODE_RGMII_ID: - case PHY_INTERFACE_MODE_RGMII_RXID: - case PHY_INTERFACE_MODE_RGMII_TXID: + if (phy_interface_mode_is_rgmii(interface)) { dp = dsa_to_port(ds, port); phydev = dp->user->phydev; - return mt7531_rgmii_setup(priv, port, interface, phydev); - case PHY_INTERFACE_MODE_SGMII: - case PHY_INTERFACE_MODE_NA: - case PHY_INTERFACE_MODE_1000BASEX: - case PHY_INTERFACE_MODE_2500BASEX: - /* handled in SGMII PCS driver */ - return 0; - default: - return -EINVAL; + mt7531_rgmii_setup(priv, port, interface, phydev); } - - return -EINVAL; } -static int +static void mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, const struct phylink_link_state *state) { struct mt7530_priv *priv = ds->priv; - if (!priv->info->mac_port_config) - return 0; - - return priv->info->mac_port_config(ds, port, mode, state->interface); + if (priv->info->mac_port_config) + priv->info->mac_port_config(ds, port, mode, state->interface); } static struct phylink_pcs * @@ -2725,17 +2690,11 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, u32 mcr_cur, mcr_new; switch (port) { - case 0 ... 4: - if (state->interface != PHY_INTERFACE_MODE_GMII && - state->interface != PHY_INTERFACE_MODE_INTERNAL) - goto unsupported; - break; case 5: if (priv->p5_interface == state->interface) break; - if (mt753x_mac_config(ds, port, mode, state) < 0) - goto unsupported; + mt753x_mac_config(ds, port, mode, state); if (priv->p5_intf_sel != P5_DISABLED) priv->p5_interface = state->interface; @@ -2744,16 +2703,10 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, if (priv->p6_interface == state->interface) break; - if (mt753x_mac_config(ds, port, mode, state) < 0) - goto unsupported; + mt753x_mac_config(ds, port, mode, state); priv->p6_interface = state->interface; break; - default: -unsupported: - dev_err(ds->dev, "%s: unsupported %s port: %i\n", - __func__, phy_modes(state->interface), port); - return; } mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); @@ -2836,7 +2789,6 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int port) struct mt7530_priv *priv = ds->priv; phy_interface_t interface; int speed; - int ret; switch (port) { case 5: @@ -2861,9 +2813,8 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int port) else speed = SPEED_1000; - ret = mt7531_mac_config(ds, port, MLO_AN_FIXED, interface); - if (ret) - return ret; + mt7531_mac_config(ds, port, MLO_AN_FIXED, interface); + mt7530_write(priv, MT7530_PMCR_P(port), PMCR_CPU_PORT_SETTING(priv->id)); mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL, diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 26a6d2160c08..b1665de7f640 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -730,9 +730,9 @@ struct mt753x_info { void (*mac_port_validate)(struct dsa_switch *ds, int port, phy_interface_t interface, unsigned long *supported); - int (*mac_port_config)(struct dsa_switch *ds, int port, - unsigned int mode, - phy_interface_t interface); + void (*mac_port_config)(struct dsa_switch *ds, int port, + unsigned int mode, + phy_interface_t interface); }; /* struct mt7530_priv - This is the main data structure for holding the state From patchwork Fri Mar 1 10:43:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990783dyb; Fri, 1 Mar 2024 02:45:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXPXpIm62tdRfSOuuu2oDaWYhQDSeSlXR/2LQgzCtPgMEG6vSrVqF5A83b/ZI/CRLJ/SGSTz9DzrU25XKG2yNdw59xVzg== X-Google-Smtp-Source: AGHT+IFC67o8q8OTGNk3OzH0LDYOWbYpcfazQhzZIydCKsImauCI33hHs/g7H6WHofuM7wgyMH+d X-Received: by 2002:a05:6808:7ca:b0:3be:d897:2880 with SMTP id f10-20020a05680807ca00b003bed8972880mr1177376oij.52.1709289951784; Fri, 01 Mar 2024 02:45:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289951; cv=pass; d=google.com; s=arc-20160816; b=d/w1XkAsIHzGKTStinhNHiO6c9t1sdLPFWWNlMwA4ckzWVaJ7NK/XhreUMPGYBxP4p oNhi/EHXFDDunpKhbjZ2fWMLdmSFBEDPdkUJgi8qTO1T1El3dW0xF3H2387Irccg4bhU YnT/AHkkhLWQPHoZONw9HuWBKHVybSkxo4w2L8ifth31MiOFa86MhzTe9+PE+cn2gx2R mR4bsFdE0Q1x+rMimigTkFamrYRc8Cxo7Tp123EvovIp67jpwhZO40oep6uhWL8thMBg H3GUq36JgLOca3cTNiNX0AU/5toPS5VLW0A8rZEscrhOAeaRvjI4JZsQsnGZmmlpaHFa 11eQ== 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=lPPx7vfVnrE3GcfPF0PsLAFB4j4KX9yu/ze2LZ9YWdc=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=suiLb/l3+xN5QVUtk6zhqcKynBKokfoawzGaBNl8tA23O87Ol2prSm6KuLYNVAzJaX UmJyoIgl14vo4Z7b19iZPH3hYnB/t8IjydPmP7h5/z2CSBXPFoQdKUV2hdXRgRTy2OI7 4YXg53TaRJ57KgFtk4QFQ6Cb8LKjKEPEP0HtwTPhAiI6cv6hwUwKw9BuL2HT3qU0JAfu UAp7nPMzY77WSrV4yKb02RSziIlT5ICiCUP3AoPVMrEVo/mlbrdrW+YCWix2c8Jci3i8 8NuPtx2vUO/ePLsS+q7VJfOvIpX3dljQe+MFrfaJOhPGjK/U+QjecMWqMCkGg0QXFiQb 2YYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I8bHXvF3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88273-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88273-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b10-20020a056a00114a00b006e4bb525845si3264634pfm.274.2024.03.01.02.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88273-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I8bHXvF3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88273-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88273-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 88AD22860F2 for ; Fri, 1 Mar 2024 10:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD77670CBE; Fri, 1 Mar 2024 10:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I8bHXvF3" 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 64A006BFA4; 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=CnfCrW6SXm1V4V8ew1qUzDpwlm6ponqvT+g0sQ/pdB9gBMmoBxp2Hs3K1TVRH7OJ4rP1ROkuvWBul9AqoHiLYzp7UIoarp43izUcaVIchhTz4Oq2H35WqpR6P9olvw1dDD+/kPPcUvnhajtmTgvBv/8uvNrqE/1twARsy1N/TM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=DR53Fwp6HNZjxK1JVF84xhxkGcyxADr/AxiABLJCtN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HsDbkQyvjQK78nIFi47WgxgmUEPoLLDeJjB6P92H+tV76iUzDMNH9beVtsntERjkqN898ITrZpGTCpe428En/UdJWGh30P0Y2rR0KA/liIlBI5wHXJBbRNZzOUaoWVuv4bSjS+8TIZgWK9gtlyq5NTTFxaPy7NqcZTyKBqfcTRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I8bHXvF3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id EF1A7C433B1; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709289779; bh=DR53Fwp6HNZjxK1JVF84xhxkGcyxADr/AxiABLJCtN8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I8bHXvF3o7elVJA8BKugGEBG9vcZROdGoj3r1naAd9HleeL7O6SbjJUmzOBLE/QgE e7SxM7A5ZidFlnePB2b1j5R/lAfR++SFINXOmenRyRSa2Tgesehstqj5Vyse4mFIu2 PXFFM9XvTYGIr2Zk2MI5EJ9AZIfeqkw9Um9ibpO3q34oJMPA5fwEUopkQXWnbESxnU wnDSYHDrAipfy8xQcus0BTG5syuWyAnMR5qrURc3KZcHQHrW6aaJvkNimLAt1PHaLY YjmkT3TDmK/4Bm1b56LPZitqi4O8fP8eaONr01sbgpK3W3ob4vtqVNXNZ2Um0NlWOe MslhUHQTPVu6Q== 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 DC232C5478C; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:01 +0200 Subject: [PATCH net-next v3 5/9] net: dsa: mt7530: get rid of priv->info->cpu_port_config() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-5-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=10123; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=Y1TCfcdqvG7M9i52Rn8kNxeSZjlmBTTpQoxELLR7z1I=; b=urv+2TWJiwr6/poCf0c7I1eYy8HybNgPMsKXd6ydEaiPkVeGLvtPSD9Q+yEe3+X2jfxizX3zB XoCFRjgdNvxBockuvSY19J+iad7K+se9fkEC4w3P3dkiGjx/wIqRw7t 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320420545355589 X-GMAIL-MSGID: 1792320420545355589 From: Arınç ÜNAL priv->info->cpu_port_config() is used for MT7531 and the switch on the MT7988 SoC. It sets up the ports described as a CPU port earlier than the phylink code path would do. This function is useless as: - Configuring the MACs can be done from the phylink_mac_config code path instead. - All the link configuration it does on the CPU ports are later undone with the port_enable, phylink_mac_config, and then phylink_mac_link_up code path [1]. priv->p5_interface and priv->p6_interface were being used to prevent configuring the MACs from the phylink_mac_config code path. Remove them now that they hold no purpose. Remove priv->info->cpu_port_config(). On mt753x_phylink_mac_config, switch to if statements to simplify the code. Remove the overwriting of the speed and duplex interfaces for certain interface modes. Phylink already provides the speed and duplex variables with proper values. Phylink already sets the max speed of TRGMII to SPEED_1000. Add SPEED_2500 for PHY_INTERFACE_MODE_2500BASEX to where the speed and EEE bits are set instead. On the switch on the MT7988 SoC, PHY_INTERFACE_MODE_INTERNAL is being used to describe the interface mode of the 10G MAC, which is of port 6. On mt7988_cpu_port_config() PMCR_FORCE_SPEED_1000 was set via the PMCR_CPU_PORT_SETTING() mask. Add SPEED_10000 case to where the speed bits are set to cover this. No need to add it to where the EEE bits are set as the "MT7988A Wi-Fi 7 Generation Router Platform: Datasheet (Open Version) v0.1" document shows that these bits don't exist on the MT7530_PMCR_P(6) register. Remove the definition of PMCR_CPU_PORT_SETTING() now that it holds no purpose. Change mt753x_cpu_port_enable() to void now that there're no error cases left. Link: https://lore.kernel.org/netdev/ZHy2jQLesdYFMQtO@shell.armlinux.org.uk/ [1] Suggested-by: Russell King (Oracle) Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 114 +++-------------------------------------------- drivers/net/dsa/mt7530.h | 11 ----- 2 files changed, 7 insertions(+), 118 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index c069bf273733..80b65f064310 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -966,18 +966,10 @@ mt753x_trap_frames(struct mt7530_priv *priv) MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY)); } -static int +static void mt753x_cpu_port_enable(struct dsa_switch *ds, int port) { struct mt7530_priv *priv = ds->priv; - int ret; - - /* Setup max capability of CPU port at first */ - if (priv->info->cpu_port_config) { - ret = priv->info->cpu_port_config(ds, port); - if (ret) - return ret; - } /* Enable Mediatek header mode on the cpu port */ mt7530_write(priv, MT7530_PVC_P(port), @@ -1003,8 +995,6 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port) /* Set to fallback mode for independent VLAN learning */ mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, MT7530_PORT_FALLBACK_MODE); - - return 0; } static int @@ -2261,8 +2251,6 @@ mt7530_setup(struct dsa_switch *ds) val |= MHWTRAP_MANUAL; mt7530_write(priv, MT7530_MHWTRAP, val); - priv->p6_interface = PHY_INTERFACE_MODE_NA; - mt753x_trap_frames(priv); /* Enable and reset MIB counters */ @@ -2277,9 +2265,7 @@ mt7530_setup(struct dsa_switch *ds) mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); if (dsa_is_cpu_port(ds, i)) { - ret = mt753x_cpu_port_enable(ds, i); - if (ret) - return ret; + mt753x_cpu_port_enable(ds, i); } else { mt7530_port_disable(ds, i); @@ -2383,9 +2369,7 @@ mt7531_setup_common(struct dsa_switch *ds) mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); if (dsa_is_cpu_port(ds, i)) { - ret = mt753x_cpu_port_enable(ds, i); - if (ret) - return ret; + mt753x_cpu_port_enable(ds, i); } else { mt7530_port_disable(ds, i); @@ -2474,10 +2458,6 @@ mt7531_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7531_GPIO_MODE0, MT7531_GPIO0_MASK, MT7531_GPIO0_INTERRUPT); - /* Let phylink decide the interface later. */ - priv->p5_interface = PHY_INTERFACE_MODE_NA; - priv->p6_interface = PHY_INTERFACE_MODE_NA; - /* Enable PHY core PLL, since phy_device has not yet been created * provided for phy_[read,write]_mmd_indirect is called, we provide * our own mt7531_ind_mmd_phy_[read,write] to complete this @@ -2689,26 +2669,9 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; - switch (port) { - case 5: - if (priv->p5_interface == state->interface) - break; - + if (port == 5 || port == 6) mt753x_mac_config(ds, port, mode, state); - if (priv->p5_intf_sel != P5_DISABLED) - priv->p5_interface = state->interface; - break; - case 6: - if (priv->p6_interface == state->interface) - break; - - mt753x_mac_config(ds, port, mode, state); - - priv->p6_interface = state->interface; - break; - } - mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port)); mcr_new = mcr_cur; mcr_new &= ~PMCR_LINK_SETTINGS_MASK; @@ -2744,17 +2707,10 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK; - /* MT753x MAC works in 1G full duplex mode for all up-clocked - * variants. - */ - if (interface == PHY_INTERFACE_MODE_TRGMII || - (phy_interface_mode_is_8023z(interface))) { - speed = SPEED_1000; - duplex = DUPLEX_FULL; - } - switch (speed) { case SPEED_1000: + case SPEED_2500: + case SPEED_10000: mcr |= PMCR_FORCE_SPEED_1000; break; case SPEED_100: @@ -2772,6 +2728,7 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, if (mode == MLO_AN_PHY && phydev && phy_init_eee(phydev, false) >= 0) { switch (speed) { case SPEED_1000: + case SPEED_2500: mcr |= PMCR_FORCE_EEE1G; break; case SPEED_100: @@ -2783,61 +2740,6 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, mt7530_set(priv, MT7530_PMCR_P(port), mcr); } -static int -mt7531_cpu_port_config(struct dsa_switch *ds, int port) -{ - struct mt7530_priv *priv = ds->priv; - phy_interface_t interface; - int speed; - - switch (port) { - case 5: - if (!priv->p5_sgmii) - interface = PHY_INTERFACE_MODE_RGMII; - else - interface = PHY_INTERFACE_MODE_2500BASEX; - - priv->p5_interface = interface; - break; - case 6: - interface = PHY_INTERFACE_MODE_2500BASEX; - - priv->p6_interface = interface; - break; - default: - return -EINVAL; - } - - if (interface == PHY_INTERFACE_MODE_2500BASEX) - speed = SPEED_2500; - else - speed = SPEED_1000; - - mt7531_mac_config(ds, port, MLO_AN_FIXED, interface); - - mt7530_write(priv, MT7530_PMCR_P(port), - PMCR_CPU_PORT_SETTING(priv->id)); - mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL, - speed, DUPLEX_FULL, true, true); - - return 0; -} - -static int -mt7988_cpu_port_config(struct dsa_switch *ds, int port) -{ - struct mt7530_priv *priv = ds->priv; - - mt7530_write(priv, MT7530_PMCR_P(port), - PMCR_CPU_PORT_SETTING(priv->id)); - - mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, - PHY_INTERFACE_MODE_INTERNAL, NULL, - SPEED_10000, DUPLEX_FULL, true, true); - - return 0; -} - static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, struct phylink_config *config) { @@ -3096,7 +2998,6 @@ const struct mt753x_info mt753x_table[] = { .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, - .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, }, @@ -3108,7 +3009,6 @@ const struct mt753x_info mt753x_table[] = { .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, - .cpu_port_config = mt7988_cpu_port_config, .mac_port_get_caps = mt7988_mac_port_get_caps, }, }; diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index b1665de7f640..8a8144868eaa 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -311,13 +311,6 @@ enum mt7530_vlan_port_acc_frm { PMCR_TX_FC_EN | PMCR_RX_FC_EN | \ PMCR_FORCE_FDX | PMCR_FORCE_LNK | \ PMCR_FORCE_EEE1G | PMCR_FORCE_EEE100) -#define PMCR_CPU_PORT_SETTING(id) (PMCR_FORCE_MODE_ID((id)) | \ - PMCR_IFG_XMIT(1) | PMCR_MAC_MODE | \ - PMCR_BACKOFF_EN | PMCR_BACKPR_EN | \ - PMCR_TX_EN | PMCR_RX_EN | \ - PMCR_TX_FC_EN | PMCR_RX_FC_EN | \ - PMCR_FORCE_SPEED_1000 | \ - PMCR_FORCE_FDX | PMCR_FORCE_LNK) #define MT7530_PMEEECR_P(x) (0x3004 + (x) * 0x100) #define WAKEUP_TIME_1000(x) (((x) & 0xFF) << 24) @@ -724,7 +717,6 @@ struct mt753x_info { int regnum); int (*phy_write_c45)(struct mt7530_priv *priv, int port, int devad, int regnum, u16 val); - int (*cpu_port_config)(struct dsa_switch *ds, int port); void (*mac_port_get_caps)(struct dsa_switch *ds, int port, struct phylink_config *config); void (*mac_port_validate)(struct dsa_switch *ds, int port, @@ -750,7 +742,6 @@ struct mt753x_info { * @ports: Holding the state among ports * @reg_mutex: The lock for protecting among process accessing * registers - * @p6_interface Holding the current port 6 interface * @p5_intf_sel: Holding the current port 5 interface select * @p5_sgmii: Flag for distinguishing if port 5 of the MT7531 switch * has got SGMII @@ -772,8 +763,6 @@ struct mt7530_priv { const struct mt753x_info *info; unsigned int id; bool mcm; - phy_interface_t p6_interface; - phy_interface_t p5_interface; enum p5_interface_select p5_intf_sel; bool p5_sgmii; u8 mirror_rx; From patchwork Fri Mar 1 10:43:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990675dyb; Fri, 1 Mar 2024 02:45:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWpY6e8Ow26RpUIOT2fQoagcK+Qnbciqk8b9aw7HpIxDss8O/BZTWwtJMQm7jufGiTer7q4K0WtHCLcumdVgcn1MoQObQ== X-Google-Smtp-Source: AGHT+IH/F4NsO7nxUlaIEZgy4bXjPm3D/fe6fK9sRvnbhtMk3+r9KudGnXyydtqcCwTlfhUjwDvG X-Received: by 2002:a05:6a21:6d81:b0:19e:5ac2:a342 with SMTP id wl1-20020a056a216d8100b0019e5ac2a342mr1863992pzb.17.1709289934045; Fri, 01 Mar 2024 02:45:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289934; cv=pass; d=google.com; s=arc-20160816; b=E9iXwWWcCenfz34hRrYCJhE9kP9Kh859k11h2qJx0ylDbmpOlsxwuQwXVl8HHXB2RB psk9yMTmTk/DkqDKPi0zRIs+nVKVJhzA/8L0oXkeejb16pEBneJB3FAMR+lZqgtUXQJl V5vGaZc4Fp5qiNJT9hyHowiHcFkoTAUqeHE+rhAlMrz9GGIZr0pO7ierfFCGBDKItIbh Or2G5Z/idt+LHmJYfo5whFksPufTNBkb6qSorA/kZHggGUxWBR3tbFTFRzKY5vmY5P5y iTOF9Ijyb4ci8JoBAhp5cOx/4EnnnlZ+LsKzv5TaJVgu703vcugChOtp4CHeQZTXQsOI H6fg== 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=D7Glp+FTdSQTPYlNgz0Rlu6sscJo3c4ZMaJwNOngbAU=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=uKrl/HK/ZcmecELZry/L4IRodT9w+ODepe+vk4V6bCmJ9wjhSxCJ2U7teMWrsA5gJP GkKBl/8XIeT/7+eyKvfVpHafLPtINIAR/H1beBVp/Bo9KzkUtEANNiCFAjc9LsYt49Dc kHMXPz/xQF/Aphivf1d9lGW4/vp13/LcJrYFOVvEtyysi2FTTgM+xKlKbjXcSnlt9vpm doC8wZXlS65VEKlR/rDcUkDyNQEKljT8NEJZoEqDLDwpo6q0PdFaxdCqFiFBlCS+RqEH ZRu05f9FZiCPT0MmOC0D73YDwhSKHMtwqA9Nw1NJzcr46MrfOyslPgLHf3AYYE9V4ow7 mpsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uSYTX+tw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88274-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88274-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lp17-20020a056a003d5100b006e5a7a66846si2289125pfb.150.2024.03.01.02.45.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88274-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uSYTX+tw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88274-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88274-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D6B2A2859B0 for ; Fri, 1 Mar 2024 10:45:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2332870ACB; Fri, 1 Mar 2024 10:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uSYTX+tw" 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 64A446BFA5; 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=r6PGwHTFlsLSC90Z7PsXd+NyEo4VLrxApqYDN6Y+cz6pZDILl0UX7C3BELa1GXCOhhyLLkDCs0ae+ehIuxZyTAaeAZb3LGy+/jekHgmB5P05cb7hPGmroIzHgChSko2aWeC+wz0/+WDL1SL+pxfYPyQ5DmkhspO4hI2hsXZbKVM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=kX85+BHUILFIoP4X6xIr9jJ6kAHMS4KcDN2tshuSuHQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HxZZf5wKoZYXYgI4GDOfnxc456ZZsl72JJcdR5MgHefPVKZ7VTwynJGzI0JoiCKwfXd+OxwYFu6pWHMnAY7egCqaW9KpZSS1FrgkWX1lAQbPepxes9abaxe65w10m0R7QnZ/sgIsj1Xy63SwhMsrUZCFhKfgqPgN4EXVbXq4Ifw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uSYTX+tw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 0C25DC43609; 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=kX85+BHUILFIoP4X6xIr9jJ6kAHMS4KcDN2tshuSuHQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uSYTX+twQJfmMJBIippEzWC8M8R2zkbkT8fF/X4cxDCledXVZ3G6FuwEOuj/5m8G4 OGagzDS6BsU+CKbEoeQV1CguLIO7Tm7SkfY04qEZOeTXGgo1eUOfERF/AvEIT2vEQf cE2criWG4dS6eMgJlBdHWfG3U0SKeWAxqMJvZBjSX0xFlIzP+T2q0WCjtDSOzk1g43 Lhw1zhaFDK4XatcCqJz9W3JBBDR9dcuLecaSFyR8s/vTczL332QqT510V2Oi/Go/UU JcL2pmp4TFfnqhQdUgj406XrAzSHviwVG2aR7uI47gfJhNacvCBIcyMBSTlSuZ1fM5 /nafAIahokwJw== 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 ECBF0C5475B; Fri, 1 Mar 2024 10:42:58 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:02 +0200 Subject: [PATCH net-next v3 6/9] net: dsa: mt7530: get rid of mt753x_mac_config() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-6-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=1494; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=8u7euwYTcc58UJEZ934iSyhrRKaOIduS6lOdsKOd2oQ=; b=CuKSG8ZKfZXUavxJ8+US5J8hRU3RJR/w4dge8UOfky7+xPVutxnu5IricMLLQQWyejQQOG5+g 6kgpOcLdoJiBe6485TrqwGcf1yu5j/s0HRJPH2k+UYkVhi87eHDrPkE 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320401985993961 X-GMAIL-MSGID: 1792320401985993961 From: Arınç ÜNAL There is no need for a separate function to call priv->info->mac_port_config(). Call it from mt753x_phylink_mac_config() instead and remove mt753x_mac_config(). Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 80b65f064310..e353c03dd1db 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2634,16 +2634,6 @@ mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode, } } -static void -mt753x_mac_config(struct dsa_switch *ds, int port, unsigned int mode, - const struct phylink_link_state *state) -{ - struct mt7530_priv *priv = ds->priv; - - if (priv->info->mac_port_config) - priv->info->mac_port_config(ds, port, mode, state->interface); -} - static struct phylink_pcs * mt753x_phylink_mac_select_pcs(struct dsa_switch *ds, int port, phy_interface_t interface) @@ -2669,8 +2659,8 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; - if (port == 5 || port == 6) - mt753x_mac_config(ds, port, mode, state); + 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; From patchwork Fri Mar 1 10:43:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990540dyb; Fri, 1 Mar 2024 02:45:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXbVf3noP+JDWPy4OqhQ4HAA4ekYfoFUsGQ0EpUQi1sgTggWVkrC/ER/EByNXJlwXnhqe8U/RkoFeUvNB3yQjPLYHf7TQ== X-Google-Smtp-Source: AGHT+IGQvT7U0PzE9doAD81XEM2E6Vcyptbdk7n7sxpO1937B52Dp/ZnGKKbDrUIKKFUCGytPyQH X-Received: by 2002:a05:6a21:6d81:b0:19e:5ac2:a342 with SMTP id wl1-20020a056a216d8100b0019e5ac2a342mr1863170pzb.17.1709289915528; Fri, 01 Mar 2024 02:45:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289915; cv=pass; d=google.com; s=arc-20160816; b=UJemSTUeEjdjb0O/U0J+pgiASwXKzrOddTiGwExbgT/oAgCVniDX1dBeu+HKzUNOD+ 8xARMmHDOBQqBM9q5LljZg6oLAYsyx0Ze/x6LpEphzrXFUpGDRo1itwWgeOD3X2+oZgO lPOUENuBnDqkMzYwhPxlbTGlq2AOUQuMMw9muULWVJCOaLnucB/Xb1PUei4qBKyynVMF DaGmkpVwOU3/x1qVMkbT3Ttk9jWjTxVCzvfNV7rdZyXJTHoqNwjIkirqizaQBaYn0eyT LQ+4dWnNeQc9CuIQaN1AjsaWDmVN0pB6K2PJaVbz7zP8JsTawDdKlr/y6xEb3osBcWJo DFJQ== 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=ne7hOGU2S5DStLf3lgxkOQSl3E4nSb1cKjrcJ4FWwQ0=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=uWRmWV/ckjQ+PgKawnEiOIOp7/fIPhOeFhQK/mG0VSNvE7tf4GhmidwnPVIx2uHJoJ 1WZ9IPmPY7FylD+kh/++gD9RwUiiuzO7K8R5JlRiKmtikgWTCSUoh+liwWupee5gN3qH euJh2nVUPUb57YypEKnuoV5YvOAyVyVUEywyoagZdDNv1BPwZ+khr3KUtHJDj1Fgmopl vIcyu3INRIkEM+jiCxZIxA/M9168EfFioh7na5OPfg4CovoNmx7AxIyoEcRtsCI0BC6q /kdp5M7gkCeNUAjx9MMXuxscle8+UWB4D5VCH4SldmcarTMdvWePSK871wBQTToQDXqG 3+pQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I8pnK0O6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88272-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88272-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y1-20020aa78541000000b006e53eb409c5si3231321pfn.182.2024.03.01.02.45.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88272-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I8pnK0O6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88272-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88272-ouuuleilei=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 B7F0BB23B61 for ; Fri, 1 Mar 2024 10:44:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29EDA6EB6D; Fri, 1 Mar 2024 10:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I8pnK0O6" 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 532EE6BFA3; 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=ek6h404bPtUXgFp+pstPd6aKR9uvKH7YOl2mFwMYZoV+jAU+0O/HM/bY9/rJhjSHITcnda+4iWScOrRIbJOTLJVcSttbusgh0z8GcIYLAcXDdBcU7g5FY6ud/dvApXoze2z65VT3RzVALMuOvtXGBpuL3KOF5l3SOBI9blSvzT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=bdj2sXbKKEcSVYU72hwdKppcUWhM0GPYmoe4dwmAPtA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GWhv8iQ0Y4J9dDNInQC+etWULp+5SwXaWbQOCnbBrY9WhfqS4XjZpz++OXWWxE5j1XREMylb0mK+3kQd2JnwIT+9cduHoVzrF0C/JOlOldps9iyRFgATMIQM12kMv7v9qD2IuTBx2ox+98Cd/hbsiCJ4zcmHdy7suPRmPI2Mknk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I8pnK0O6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 19053C43142; 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=bdj2sXbKKEcSVYU72hwdKppcUWhM0GPYmoe4dwmAPtA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=I8pnK0O6SunHZxJiOSjoPzu6eLrP/erBBlrYjVIt9YA+hIs1pPWabn56SSzh5DK8Q W6yfvcM+9gWMXKH3rWOIXjrgPxzbcIS4LrnPdUZu9Y+Mt1Hfjq12APfcJAKIlz4RBk akfIgkZBR/6ZW0KotndncFGPKuSCKA6YcX2km6VPMVu0CgYrA+hFxKxv0JpgvYq6Io mwybjn1zxwhkAE1xw/hbpn87cmULjWhfqtxMEaBX3cJQhJmnneYUSASgMyOFqD0gJV ig2I7GdDEuN8npR8zGWBITMZhseJlbZdtGG7RJGsAnTMqo1/M5qA3N3n47o211KcPC t+/9UCEEgT15g== 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 05C52C54E41; Fri, 1 Mar 2024 10:42:59 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:03 +0200 Subject: [PATCH net-next v3 7/9] net: dsa: mt7530: put initialising PCS devices code back to original order Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-7-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=1570; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=/2CkKGukm0R4V69WhBvbbIMKcr0CwYye/LAy2VcbSV0=; b=jhj5rpVeLTk6pp6nZ74IqJOF62xtP/gZRjxzV6gmsJ/mCB/nP34kSs028tQQ0/2WrX6tvkMGJ ykUTxIRPKOhARn1bax3sYOsUZQsHfG6i6H4204OyFLMD8QH9wvCic4L 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320382426365100 X-GMAIL-MSGID: 1792320382426365100 From: Arınç ÜNAL The commit fae463084032 ("net: dsa: mt753x: fix pcs conversion regression") fixes regression caused by cpu_port_config manually calling phylink operations. cpu_port_config was deemed useless and was removed. Therefore, put initialising PCS devices code back to its original order. Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index e353c03dd1db..5c8ad41ce8cd 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2812,17 +2812,9 @@ static int mt753x_setup(struct dsa_switch *ds) { struct mt7530_priv *priv = ds->priv; - int i, ret; - - /* Initialise the PCS devices */ - for (i = 0; i < priv->ds->num_ports; i++) { - priv->pcs[i].pcs.ops = priv->info->pcs_ops; - priv->pcs[i].pcs.neg_mode = true; - priv->pcs[i].priv = priv; - priv->pcs[i].port = i; - } + int ret = priv->info->sw_setup(ds); + int i; - ret = priv->info->sw_setup(ds); if (ret) return ret; @@ -2834,6 +2826,14 @@ mt753x_setup(struct dsa_switch *ds) if (ret && priv->irq) mt7530_free_irq_common(priv); + /* Initialise the PCS devices */ + for (i = 0; i < priv->ds->num_ports; i++) { + priv->pcs[i].pcs.ops = priv->info->pcs_ops; + priv->pcs[i].pcs.neg_mode = true; + priv->pcs[i].priv = priv; + priv->pcs[i].port = i; + } + if (priv->create_sgmii) { ret = priv->create_sgmii(priv); if (ret && priv->irq) From patchwork Fri Mar 1 10:43:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990690dyb; Fri, 1 Mar 2024 02:45:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXsbZQ+N2FI5I7rwmWlcmTz7pw3e1gfAZXkLH2UtDK1+kETTfziV/xE9+t52MtcgigyjDRPGBtA/IN7qI8lJWHWBavsJw== X-Google-Smtp-Source: AGHT+IFxqvx9akfJz0okE4NYrBfjc7SuGhwwLLyGejrO8+EykVFhju3jXWVw9CNpJv2tzLjRfhj3 X-Received: by 2002:a17:90a:3004:b0:299:6389:2961 with SMTP id g4-20020a17090a300400b0029963892961mr1215796pjb.13.1709289936645; Fri, 01 Mar 2024 02:45:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289936; cv=pass; d=google.com; s=arc-20160816; b=rg/HdwqRbdhLe4iaTR2plwCpgn9I/8iHni7HNfy589WHeDJRCQ7ffj6CLKj4cOIfYg pTCJsL2fFAkNqZ8zDaD7DE4B5bVHZ6q8J1g1+LTuYNoHIsfVebdEhwvlzgbpbyXjxNFz +r0X+oEYXVhNzOoQC/vzXydORO+r/zrAFMOZlAQG8Ilm+QJpGpgbf0pMLOWHXoIpUU0e fFGMSwS7mnxa1jy2Pw4XtFoiJAekhgv5VjY//NCR7/Dh8SD+C7/jimh1oDhDJIrfCWqi CnG00DcYozfaVADIPOD3TLIENJiJhNVPKWOBFZCZK54gs9sfYDisxpX/q8H2lPvn0ij0 zrZQ== 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=fj8a0YcRXjwwoVuxtWZa7leH8QPCDc+QQ3OI36VOixE=; fh=xNlE86XmqkSplYYMvvd74gD/RbF2aUqtHPBgVCVc3H8=; b=rGTisl9aLSBk/k2Uk+cVCDuy3dTdanN5xphxkrf/51DevcwTOhhHZPta0rTpoKObNK c2oAeHndYDNSSg44EfnPoNtsd0A8ieB1+BBkLz0IhXa6+tjbpVfWsrYYWJU2ts2rggwt N3nVBTdmjH3tBNz3SCy/cepu6w7IqRY40aLVbS4w1SNzSbVax5OD+m7xNrtpKq+EX+6L Gb/3EW4p1LmxOwQEc30QkT8Tal5TtNblv6Cqam9tDPaqU78Mwm9wpxeNdAwHExQgy8fw mNNS5L/jSHfoOQOh3ZoFIAWfiXYyI/q8BdIMRyAdGs3Huaniei2mP+pFF/mjn/YJqEFT 5u1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q6ytghsN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88276-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88276-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id pv13-20020a17090b3c8d00b0029b2c7b7b9asi131894pjb.120.2024.03.01.02.45.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:45:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88276-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Q6ytghsN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88276-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88276-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 77E9E283BF6 for ; Fri, 1 Mar 2024 10:45:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5397370ADB; Fri, 1 Mar 2024 10:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q6ytghsN" 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 64AC56BFA8; 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=liHqFI30MjCwRfrCFyuj3tjsPJHwi3fB4iyPZI/1TQuvp3rRFJLuDpsqTSaYSeEh/Y7aMv5wNp6HyYjMfTJcJKl0mUz8dDw0vFvZ4AZYSGsXYHRtei23/Uet0HJLMZzY3SlKZFP/ZYb6RYOFkIosRWs4K8nTJnWy2WR7+3g6rIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709289779; c=relaxed/simple; bh=9OAw1+rum7epPqDadmyP8sgcI2N4oduq36yqdy67hu0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KJ9VoI4HnpRk7FnD95C51KiML8ZMcvx4bkn8M7fTAEX/F7kF8dshjD7ubIZmJPaW9RZi0xhV0tA2PfJ/IrFOWuLEElMySuKpEUTqeGvJRaFKDAzOIdnWk2U7Xlawwz+vZ2t0uOuLoHtHnArCjyFNoIZQ4ZMEfOlKJFTi0VipSFQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q6ytghsN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 23052C43399; 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=9OAw1+rum7epPqDadmyP8sgcI2N4oduq36yqdy67hu0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Q6ytghsNRg8TjKbIqvx5vqLAdWrDW0Gy+9JujyLZr81xADgRM8+2WSmV5ipMMJMaW W/0LDzR7AfAU56JPTDwdYHFq3uc7f+V2MputpyhNzIO3Q4WU/K0U2jCZ187kuYITvs TLgQc6ZR8dwec5PrN5zn7Vm5DgU3PSM+YqioNKHXO2rlS7lfwwtcBKpP1liRvm6bBR 2oz86kTazcxneqbmvceETJiib14hPeuqBccDO38JKa+Amd1aeiw9iE2/v+aHWNKVpg VG4HQ73zJGSVqexIjIZjlRxjtBIgZVLEegeL/o7a2Drp6uY0HOQcNYlUGZPvwVXU0y WtnAPI/XyT5/g== 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 1246DC54E55; Fri, 1 Mar 2024 10:42:59 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 01 Mar 2024 12:43:04 +0200 Subject: [PATCH net-next v3 8/9] net: dsa: mt7530: sort link settings ops and force link down on all ports Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-for-netnext-mt7530-improvements-3-v3-8-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?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709289776; l=2434; i=arinc.unal@arinc9.com; s=arinc9-Xeront; h=from:subject:message-id; bh=Lk4340C7GwrRpdUGlGvETd3f0JsF8UjRCdCF02XBua4=; b=UFudaq/QD+WxDRhDFOF14id6HYvCGEsmKQCDhlW4fp3Ns3/BchHbNue0R2ECqZJDdK0eCfeVT zR5NRb3Y2HeCfkGFSPZDRnPbva00Cun3Ki9O89cEU4ZvtTVlM/aEDBu 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320404861638388 X-GMAIL-MSGID: 1792320404861638388 From: Arınç ÜNAL port_enable and port_disable clears the link settings. Move that to mt7530_setup() and mt7531_setup_common() which set up the switches. This way, the link settings are cleared on all ports at setup, and then only once with phylink_mac_link_down() when a link goes down. Enable force mode at setup to apply the force part of the link settings. This ensures that disabled ports will have their link down. Suggested-by: Vladimir Oltean Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 5c8ad41ce8cd..91d927bb49f7 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1018,7 +1018,6 @@ mt7530_port_enable(struct dsa_switch *ds, int port, priv->ports[port].enable = true; mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, priv->ports[port].pm); - mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); mutex_unlock(&priv->reg_mutex); @@ -1038,7 +1037,6 @@ mt7530_port_disable(struct dsa_switch *ds, int port) priv->ports[port].enable = false; mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, PCR_MATRIX_CLR); - mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK); mutex_unlock(&priv->reg_mutex); } @@ -2257,6 +2255,12 @@ mt7530_setup(struct dsa_switch *ds) mt7530_mib_reset(ds); for (i = 0; i < MT7530_NUM_PORTS; i++) { + /* Clear link settings and enable force mode to force link down + * on all ports until they're enabled later. + */ + mt7530_rmw(priv, MT7530_PMCR_P(i), PMCR_LINK_SETTINGS_MASK | + PMCR_FORCE_MODE, PMCR_FORCE_MODE); + /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, PCR_MATRIX_CLR); @@ -2359,6 +2363,12 @@ mt7531_setup_common(struct dsa_switch *ds) UNU_FFP_MASK); for (i = 0; i < MT7530_NUM_PORTS; i++) { + /* Clear link settings and enable force mode to force link down + * on all ports until they're enabled later. + */ + mt7530_rmw(priv, MT7530_PMCR_P(i), PMCR_LINK_SETTINGS_MASK | + MT7531_FORCE_MODE, MT7531_FORCE_MODE); + /* Disable forwarding by default on all ports */ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, PCR_MATRIX_CLR); From patchwork Fri Mar 1 10:43:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 208768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp990723dyb; Fri, 1 Mar 2024 02:45:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUvBB+gbWQ7Sc0UEid+cYOVvJSrEUsSM0n8/vZNoD3AtFSIEArvK/Yn+jyvCPpwjJWJXCxhnxq6HNMeK1MVvrBk4FvnwQ== X-Google-Smtp-Source: AGHT+IEaiuAi5yaVvICFGiuuI/acK5Gznq1iq5izpqfqzkNQJoh+YDbyRxhQvN9a++iiUpalqBDH X-Received: by 2002:a17:90a:af90:b0:29a:be1b:6fbe with SMTP id w16-20020a17090aaf9000b0029abe1b6fbemr1283998pjq.31.1709289942207; 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=hAXY19YW84axF5Gibwt2jeIi6jJmveCv/42g5dnYQ3LwWVj0/nneZOAtV1s1bUTPot zE+1kbmQSPdLVSLfqkEqEU4Zm/hboiCmEbkb9vsP4ALtiI80D9CgefFWe2Vdq/MoAx0a nV67Fl4eg0nlPICoY46zYZ0CiGn5PVrLXZH8tvzB/oxILVlQ4Jceb67zye7wFJVs67xG jtrny9N0EpOKcqT8JqU1esRpCrRreLu6hl3V096r4qNTd+AxHBDNUMPz0RXXeOqa8Ud2 F2mtuaIbnyng9kk9oqR2Mcy5uQGcHVqmgKeW5cgkc9N53iKuLkKdJwdak2mjamRQG/eF qC6w== 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88277-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bg20-20020a17090b0d9400b0029acaf4162asi5454608pjb.87.2024.03.01.02.45.42 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88277-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F2EB3283D67 for ; Fri, 1 Mar 2024 10:45:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95A5270CA4; Fri, 1 Mar 2024 10:43:05 +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 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?b?QXLEsW7DpyDDnE5BTA==?= 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: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792320410692720736 X-GMAIL-MSGID: 1792320410692720736 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 | \