Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp204571lqg; Fri, 1 Mar 2024 02:43:35 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9T7o4DizxDVM7lNpoJCQWxd9p7MFSZqzHURaqUJzT6Kb09Vqzj3E4yDKWuxHdND/eAoQP26cp1HywPcjovn4y3leGPFi1IZyvRoRiLg== X-Google-Smtp-Source: AGHT+IEcTDbzT08wXInxabBJHoOw7WHyFhMLb5+Ql57THT2tQs5t/w8A52N8zP06YFVbZOu8eLu/ X-Received: by 2002:a05:6a00:13a0:b0:6e5:5c34:ee34 with SMTP id t32-20020a056a0013a000b006e55c34ee34mr1665596pfg.2.1709289815215; Fri, 01 Mar 2024 02:43:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709289815; cv=pass; d=google.com; s=arc-20160816; b=cvcCS/w8Whkd9KuuZMk09tvaLQGYXh36b60OoSsjoRnJgqckxoIN6D+a2JhL+Yq3ZU YKVRKj/xCbaJDHVlYnrkiu4W2yNFGzZX+Qq8PvcJaRvTbitazmY4RQsD51Hr/toVSFgX 7LyjSgNBaZZDR+ZRM0l4Rg1lno8EPW9Kp0k/PrcGVLeoNnJ/z/hSOMAj47/Y1RbE9vHn kd5qCD/y1ggMwggk/s0cEwSeg9U0mUUsrHH3BTj5ORm3dGUyVz2KEG4hnl2IebMNRjx8 Kb5UaEDaPFwsnJiOs5qG1qQKv1Y+CfP+5UVwG2d1vRrwNMdo/km8LFZ0tNjorfvbO04X XV4w== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id gu2-20020a056a004e4200b006e549a388fbsi3125957pfb.155.2024.03.01.02.43.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 02:43:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88268-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="dI/2KUcd"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-88268-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 19072B2151B for ; Fri, 1 Mar 2024 10:43:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F8166CDAD; Fri, 1 Mar 2024 10:43:00 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= 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: 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; -- 2.40.1