Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 536F9C77B71 for ; Tue, 25 Apr 2023 08:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1uLav40hri3eanK3Jy4AVy91JvuI98IGXe5BAzhG3qY=; b=yaJlIArVYAuEAd thoHRHCxf9ShJc+4xa83g31wYKBYYJXcYvwnbEKTlWOy7cecrtd6Rp/qt+CUqWC6JXbUXbDJGEgVz 8/uVeUrekY/YnaNgjoOrWqQ4aDiIZP5cJbjssxbwwC4MvbnAbUNx2yLHv/psoXeoKH+XeaI9T1/4Z 0ruZ3cJvIAnBwjK9OhVgIoatgA87+VLvuWepMO6wjhxF+SP5OH2QzNUE0zntVamEDOtqYn2G58VHA ktC3y99BAH3xrsEtlbeKnJQPy3qPX/0hW9e75FlNzJHSQB619HKyMRTTi+kxglYQgd+VrGkpZ703R SEgMOkNt1glmEPgHQN5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1prE5h-000W4r-1g; Tue, 25 Apr 2023 08:32:01 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1prE4O-000Umd-0q; Tue, 25 Apr 2023 08:30:41 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-959a3e2dc72so416412166b.2; Tue, 25 Apr 2023 01:30:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682411440; x=1685003440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1uLav40hri3eanK3Jy4AVy91JvuI98IGXe5BAzhG3qY=; b=cvjH75DPQqlRxJGSfXV8bb+spvakoCPO+pRgYvaHQhjszaR4HJIfty1kIxqdkvg507 /kmGLkGSTYoGmbMSdDzQaG9+PPXEADtQ4T3LOTnowyVyp+boUz166MNb4r9MS4IVaBCE 8CzFmkZtnCdxpmvkzxqpVsN0y2chhZfUo+WhJI7KldRU+TBQzt2inwO0+fEcHnJhZwlQ Bly5F3SodqWFsNQ2jB9pDnnCXnUKKJownQ9HUQhJV9vp9cUyNHNnADgGkl7D1qnmFrvt UUtQ/buQ5W63FzO+dmwUnIh/s/7F/dJ7r+2bo5QrFB3FVigVsnTCD+iNDgJDdWN+AdsK pdew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682411440; x=1685003440; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1uLav40hri3eanK3Jy4AVy91JvuI98IGXe5BAzhG3qY=; b=gxWPsHnNy9vsShT0a333UK6V+/jo+/+Da+e1wergWJDG1CDlPqVRzU7qNt5OQSkh+D YBqTnj2Rfr+vwieGF5TmeH1kffblnrsCi9x7qfO+05CG+dchZUBVWojzxY95TBUebq/o Nmv37kpzeG2uda0SOvvMoIPJszc6FBIxWTjSEVLUXzlGiG4p7hhgm3PKP84OWCQFNyHx BCCQt4etX2asatiqC1+MDSn/wKF1OQHOl44ZCWww27bdc47YTtSdC1q6Jkuo7S7/vy2u y9pcqR1Uuai/40qE4qT1kAXj+VZlIbv2eh8q8SQYoDW+772cYLIYeMB1GD04HEzQ4Te5 0tMA== X-Gm-Message-State: AAQBX9c82bTgZ4wrp6VuFSiEV5hg6oplzOiqni08KDa3ptpYu783oe+U NvtugS4ZwIOA0V6XHmVsd5Y= X-Google-Smtp-Source: AKy350ZKkzSKbtmxddOSln/bZb1aezgAR66i8vfy7x3dBj2ysqx42JxhlOsAxkxx3wSoJxv2IlopoA== X-Received: by 2002:a17:906:ecb7:b0:8b1:3467:d71b with SMTP id qh23-20020a170906ecb700b008b13467d71bmr12844134ejb.48.1682411439716; Tue, 25 Apr 2023 01:30:39 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id mc2-20020a170906eb4200b0094ca077c985sm6439028ejb.213.2023.04.25.01.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 01:30:39 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Subject: [PATCH net-next 19/24] net: dsa: mt7530: remove .mac_port_config for MT7988 and make it optional Date: Tue, 25 Apr 2023 11:29:28 +0300 Message-Id: <20230425082933.84654-20-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425082933.84654-1-arinc.unal@arinc9.com> References: <20230425082933.84654-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230425_013040_322219_CB228363 X-CRM114-Status: GOOD ( 15.29 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , linux-mediatek@lists.infradead.org, Bartel Eerdekens , erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL For the switch on the MT7988 SoC, the code in mac_port_config for MT7988 is not needed as the interface of the CPU port is already handled on mt7988_mac_port_get_caps(). Make .mac_port_config optional. Before calling priv->info->mac_port_config(), if there's no mac_port_config member in the priv->info table, exit mt753x_mac_config() successfully. Remove 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. Signed-off-by: Arınç ÜNAL Co-authored-by: Daniel Golle Signed-off-by: Daniel Golle --- 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 aee1e4d71547..bdd3f63fe1ef 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2613,17 +2613,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) @@ -2664,6 +2653,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); } @@ -3107,7 +3099,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); @@ -3135,8 +3126,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.37.2