From patchwork Thu Feb 8 05:51:29 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: 198180 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2709302dyb; Wed, 7 Feb 2024 21:53:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyZDJZTbMj3Foept8t8NZ+so8jo2vRHpDNMqxmyNZs6kVjhKAUwYlQCucrs4WNvD7rpLel X-Received: by 2002:a05:6214:19eb:b0:686:acd2:4afc with SMTP id q11-20020a05621419eb00b00686acd24afcmr10065990qvc.17.1707371613467; Wed, 07 Feb 2024 21:53:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707371613; cv=pass; d=google.com; s=arc-20160816; b=VdYSXHVHgL1OERJg0EX6DMyWZU19lbNdfCT53e47qMuuXohb6Q4XjpKmj1JVlz/qxe 6Qe8IXD39sVaCGsPhDszIVOrbfBfzis93t5S7KZEW80yYQuaDmT8aOp1qxtatTmUyUlO Owvy8A1a8c8BfQfPVpkPFaQVKu0nXi7qNGA6/5l9+Ln3IiYCsr0WaDavoNzEmskQ5Vdk 0Lo4kzikFrgxSpVcnbv6E0orNRuXxMKeAB0Prqd1xW9woU3IxygkMcN3FQ1v7yFseCBk CQi5AqrH3lrQldwIWeUWOuFnG1L7W8N4p8LDnn0GhYZ3WLouxVAwmcreH47FF/eBT3OS 7VDg== 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=Kr+IV0k9eWeHjARoeAXQNgslwFLMRXQ7eateR07uhg8=; b=mB+NK1DbC1XSifuj1mo6V5Bydy6++gpiOcBafKnOmEbyYbL8U6jEYslCFuU5jy728S DUPJg/JdrY2E9yeKty0L4tgX3ZX4+Rr+tOeLPM3UHwkIcqvQzx7Blu4C1+LYGwustH0f C+YYJnF+t+SElMVAfWDopwDSV5rUiuySn4riiScllS4YrJGE8DOhfcjyQ3Y5KQzzNnNX Rcgyst/XTmnVBkPX9H6tWV2l+uHSICt0eQ7R5Ah4WcXSvC5obRGRfC35XAektuzR51+g BfsQ+7Ulw8oa/IpgTGv40J4rsrOk08nddFrazMa3i4x14Gyy4GiKxnfSvd3exyKnpBWA 2nVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLccQsQg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57476-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUmV6g+wtZZ6GgYM+Swf1Onx8MRlc1fUIBsqQyXNPg8WUrxksyId86nPd60W5IztdVJ1r6r9Sd/burHrxNyW4ZTVCrQqA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dd8-20020ad45808000000b0068c5ca1a0a0si2654369qvb.111.2024.02.07.21.53.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 21:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLccQsQg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-57476-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57476-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 435881C22181 for ; Thu, 8 Feb 2024 05:53:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A472B6A331; Thu, 8 Feb 2024 05:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TLccQsQg" 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 8A0EC67C5D; Thu, 8 Feb 2024 05:51:33 +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=1707371493; cv=none; b=Zn7FORSXICftjfHbLxXq8iX1WZYKAi/v/Km87bMdXbE/GGEzvNPDkFbDRpLNoaNQiDdmn2MXjnt2T7Ogh11sOQAqF1TEMfs1Ln3ODL9AEEIj2cNyZPjz92chw7QX9xZG+bCzgeCwsdXs1sV1bIo3jc36d0MF6sPKSjqry4zQWN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707371493; c=relaxed/simple; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OdkUkPCztEQFs314vnbMl5/SWVeD5HB2Osl50hWxsGEfl6M3/2QBIsj5vjdsZjhV8ZhwujmJKHInq5jLxBACEqE0hWbxwqudjnyqOBPAdOIjg4Ye+YT7717d0FW03pMiSFcyv2nMOQX8Kaf+jtAMzizlhtK/ue9mNktYc/qUjXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TLccQsQg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 17DDAC433F1; Thu, 8 Feb 2024 05:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707371493; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TLccQsQgVRzqnpH5Q/I0SnwTKqtqn6A1/jqJtE9yJJlSTcH13AZC4xkwmRE2OBaTs u0f/He0+Ft6Vo/vsoMTNNTUrqQsyjvdETcdzqnXFYdB/vIjJSXPmVpH0prwfpV/HOY Y+KV1xx/S7zk/tQbiKZm4gLSFoyXYKeh1HenClZsh/3ffhJ3n+7ND3GPcngXp1rmH5 2kRO4XHtkwpWSH536LyWWearbQmpxYpRXrGNG3JKD6YTDcW9yFmeQ0pJBow/qym7pG 3EPSyXM7nXb0FI/T0cIYXykjjK3vdH+uhvxPQHzooxvL58NyTKrIyGa9n7tHaw9J4+ OaT3sGhJT3eJg== 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 F07C4C4828F; Thu, 8 Feb 2024 05:51:32 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Thu, 08 Feb 2024 08:51:29 +0300 Subject: [PATCH netnext 1/8] 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: <20240208-for-netnext-mt7530-improvements-3-v1-1-d7c1cfd502ca@arinc9.com> References: <20240208-for-netnext-mt7530-improvements-3-v1-0-d7c1cfd502ca@arinc9.com> In-Reply-To: <20240208-for-netnext-mt7530-improvements-3-v1-0-d7c1cfd502ca@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.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707371489; l=2593; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=zsBRS25Kdr7LfGGSqrR3mLbX7RMd9/oxSXqAjEC3Jr8=; b=scfRkqj8CuopVukYSeB9ymHb53Jg2osgY8Y2QJfuBsWoGPc/41KTDdsg6ZJ44rfTIPVtIHB4d BqyD+O0i/VzB2jRlNcIIliDtBy6mqitanizfe4lDIE1fXrtmrmqRhok X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=VmvgMWwm73yVIrlyJYvGtnXkQJy9CvbaeEqPQO9Z4kA= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-patatt with auth_id=115 X-Original-From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= Reply-To: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790308896775385378 X-GMAIL-MSGID: 1790308896775385378 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;