Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1028334rdb; Fri, 16 Feb 2024 03:12:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVqdlfoVsiz8XcLHzWNFub/6wE7xzheeeQUU/vLMPDAE7CNsYmcOLGIt+/71fHOFo19BLsKHhvmxQQGy83+7ukXAu1fKjJXdvgX20Wh2w== X-Google-Smtp-Source: AGHT+IEkUPN9n3ejSAJySW8+rSvsXIaiILHzfkoBU6alle8or7ftScKgkCIIByc4CwLFku0Vbfjp X-Received: by 2002:a17:90a:dc12:b0:299:d98:c761 with SMTP id i18-20020a17090adc1200b002990d98c761mr3883345pjv.6.1708081965951; Fri, 16 Feb 2024 03:12:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708081965; cv=pass; d=google.com; s=arc-20160816; b=LFkT4IBAwm8F+gFzcu5838xgqkG1pbT9mLqu+12G1ZW4+jDZPsmJqhMEpn/x+QEP0x QnK6Uh5Qltx0Zpx3mu1ke3CVA5UR4LOtk+k7ad08Kg+j2V0LCzrO7ijEHesdqn4EnVy8 ZpCreVInsYAiMhS14mteVxmpbw1vUgKOL0ZKDaEg/GhpawCCXAT8Wqe9nM9SAzu1S1ln Cx1GGeiHKoU8vhlkdrui2gFDqpxZplSs7s1MvrQCXf1WFFBqM4MFVvmlXXmr33tsv6O7 jDI33FK3gMoMH5glczp+b6zYgBQAwlzwW4Nd+2bTxEm7e0QCcRCtMCAAul4Ehy3rfWmP RHPw== 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=dYJ4wmTrS9IJXrGVqtBFVPuNL/bFGb+u0Fs32OKuYo6emcIbXwy2mbqUrAg4MUMy+3 pj+7NVmE07LnbhY7TsDeO7VztfNayqYc5gkPITwiIGHEAZS2jB6PDncIc4C5fQG05D70 +HHIk3W7y8lcschJMqVOsXKwXVn4z+A4Q2Y6h98BBGH7HEqxzGgUDN7XYlPAIb4GviAW Zbs/IGuc/3wzpyrWnii2Sqn/qTcOseO5nGDYRPYPtuOrWaU+KpmegU2SLVPzD5xybKcd eH4S+vWGdLlJJCY/EmsfAAaZTcpo7G//8/usaEZbn9Wplthu3zweAj8LgRMLsWjC2Dz9 NMHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LnmhAoaG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68490-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 se7-20020a17090b518700b00296a6604850si2947292pjb.169.2024.02.16.03.12.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 03:12:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68490-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=LnmhAoaG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-68490-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68490-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 EA521B250F4 for ; Fri, 16 Feb 2024 11:06:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71D8559B72; Fri, 16 Feb 2024 11:05:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LnmhAoaG" 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 742F35822B; Fri, 16 Feb 2024 11:05:44 +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=1708081544; cv=none; b=Gos96jP9sk9Dfkz2RLPjFT3/yjszAfC/e6k+Lz7jPxlpp8ELOuz/DsqA4bp7CvwC4PJvlNWmV8CmWO5ZDLyKB0N3KsL/i5X87SnLFuE+c1bsutdv1/zhwnTkXgo3ne07V6XbraFHB6rpyDtdzAEt/xX4HA864+GS84mhoWOQJwg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708081544; c=relaxed/simple; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bl5OJxEEGeYCmScPsdd3mkkJJ0ONq1kyrFQMVng8UrQ4Z3oU12cA437v9a1aRm79iDOVY+DCofqd1HHEgs7i8xHQs57pbZIug3KxDbqD2X2GLlWWXg8Z/5qbWp6Aye88ykdhbjZv1zXSX07wgZ21xelKXPSTthKkJ4TGYWAGI10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LnmhAoaG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 077E7C43390; Fri, 16 Feb 2024 11:05:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708081544; bh=r9/r4cAgofxq2YbjbbxXvYSIDlSWSINkDrq9AA9RzRc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LnmhAoaG/n0fhczqyH5t6mKC/wcilGZQaUs+r7vvHlEnfE3heHFDh6CdG1/FzSMlB +Kq0ftoIm32qrChLaxPeNctcaf1NHkHpLiSA38PYVXpztdbJqcPuALceqYeLIzX0pE MgU7RKgemMAaqb90DlvUPlIBQJu9zmWJ1ypCqldCDodtaw+4jWWuFi3noRNSdL2TBy NNtB6tLdVFzAk/Xk87ooVV47XQZZs9ZR0q2gMlrue2J0ZiC2dDybSLNvw0Kn2OLWuw NBIRdaR4dPLEdeh+LlQD9aInBqvI/oxguzpBXXlwbm/fepDOv2uKqifrECO3YPrug6 FTobw0db8bPmw== 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 DFF49C48BEB; Fri, 16 Feb 2024 11:05:43 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 16 Feb 2024 14:05:29 +0300 Subject: [PATCH net-next v2 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240216-for-netnext-mt7530-improvements-3-v2-1-094cae3ff23b@arinc9.com> References: <20240216-for-netnext-mt7530-improvements-3-v2-0-094cae3ff23b@arinc9.com> In-Reply-To: <20240216-for-netnext-mt7530-improvements-3-v2-0-094cae3ff23b@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.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708081540; l=2593; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=zsBRS25Kdr7LfGGSqrR3mLbX7RMd9/oxSXqAjEC3Jr8=; b=vF2L9NK6OyRK16reEhB75WUImHKGciv3O6Y0W0oNc9o4O4TlHjL/V3WziVoOr3V3Iqdudmz9O 77xXUCAaJHuBL3WS62LLUYJecjLZPR4LucIcn8MqGHWsVRyvIAZS5pf 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: 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